# cat usbdnet #!/bin/bash num=`ifconfig | grep usb0 | wc -l` if [ $num -eq 0 ] ; then # ifconfig usb0 192.168.1.220 netmask 255.255.255.255 up ifconfig usb0 192.168.1.220 netmask 255.255.255.0 up route delete -net 192.168.1.0/24 usb0 route add -host 192.168.1.221 usb0 # Set up our tables. iptables -t nat -F iptables -t nat -A POSTROUTING -j SNAT -o eth0 --to 192.168.1.212 echo 1 > /proc/sys/net/ipv4/ip_forward fi