Hotpluging usbnet

USB Networking is not my preferred way of networking but it is quite usable with palmtops or Neo1973 phone (which spend most of time connected to USB due to charging problems in GTA01Bv3). But this also has some problems due to fat that this is hotplugable:

Today I moved my Zaurus c7x0 back to using WiFi so second problem disappeared for me (now only Neo1973 is connected over USB) but first problem was still present. I was tired to having to write sudo ifdown usb0;sudo ifup usb0 each time when I reconnected phone so after reading some man pages I updated my /etc/network/interfaces with this:

allow-hotplug usb0
iface usb0 inet static
        post-up iptables -A POSTROUTING -t nat -j MASQUERADE -s
        post-up echo 1 > /proc/sys/net/ipv4/ip_forward
        post-up iptables -P FORWARD ACCEPT

And now when I connect phone (which has IP) it gets connection to world automatically.

debian openmoko phone zaurus