#!/bin/sh gateway=`getent ahostsv4 tinc | awk '{ print $1 }' | head -n 1` route="${network_address}/${global_prefix:-16}" iface="eth0" echo "Routing \$route to \$gateway via \$iface" ip route add \$route via \$gateway dev \$iface || echo "Failed to add route; does it already exist?"