#!/bin/sh gateway=`nslookup tinc | awk -F': ' 'NR==6 { print $2 } '` route="172.31.0.0/16" iface="eth0" ip route add $route via $gateway dev $iface