don't set page size by default
[tridge/junkcode.git] / ssh.tunnell
1 #!/bin/sh
2
3 GATEWAY=tridgell.net
4 GATEWAY_ADDR=192.168.2.2
5 GATEWAY_IFACE=eth0
6 CLIENT_ADDR=192.168.2.15
7 NETWORK=192.168.2.0/24
8 TUNDEV=7
9
10 pkill -f tun$TUNDEV
11
12 ssh -f -w $TUNDEV:$TUNDEV root@$GATEWAY "/sbin/ifconfig tun$TUNDEV up $GATEWAY_ADDR; /sbin/route add $CLIENT_ADDR dev tun$TUNDEV; /usr/sbin/arp -Ds $CLIENT_ADDR $GATEWAY_IFACE pub; while /sbin/ifconfig tun$TUNDEV > /dev/null; do sleep 5; done;"
13
14 sleep 2
15
16 sudo /sbin/ifconfig tun$TUNDEV up $CLIENT_ADDR
17 sudo /sbin/route add -net $NETWORK dev tun$TUNDEV
18 /sbin/ifconfig tun$TUNDEV
19
20 echo "Tunnel up - to bring it down run \"pkill -f tun$TUNDEV\""