#!/bin/bash #Copyright 1999, William Stearns. #No license is granted for this program's use at this time. #TDEV="tunl0" TDEV="gre0" TSERVER="Z.Z.Z.Z" CLIENTREALIP="Z.Z.Z.Y" case "$1" in start|START) if [ -z "$CLIENTDIALIP" ]; then echo Please run with CLIENTDIALIP set. exit fi echo 1 >/proc/sys/net/ipv4/ip_forward echo $CLIENTDIALIP >>/root/bin/CLIENTIPS insmod ip_gre ifconfig $TDEV $TSERVER pointopoint $CLIENTREALIP netmask 255.255.255.255 up route del -host $CLIENTREALIP route add -host $CLIENTDIALIP $TDEV route add -host $CLIENTREALIP gw $CLIENTDIALIP $TDEV route del -host $CLIENTDIALIP $TDEV route add -host $CLIENTDIALIP dev eth0 arp $CLIENTREALIP -Ds eth0 pub ;; stop|STOP) for AHOST in `cat /root/bin/CLIENTIPS` ; do route del -host $AHOST eth0 done rm -f /root/bin/CLIENTIPS #route del -host $CLIENTREALIP gw $CLIENTDIALIP $TDEV route del -host $CLIENTREALIP $TDEV ifconfig $TDEV down rmmod ip_gre ;; *) echo Use \"$0 start\" or \"$0 stop\". ;; esac