How do you set up internet pass-through (reverse-tether) on linux? I have an HTC Desire S that has the option to connect through usb, and use the computer's internet connection. This works fine on Windows, but I'm struggling to set it up in Ubuntu.
When I plug in and select internet pass-through from the usb menu, the usb1 device is created and I can ping it's ip address. I have tried various iptables configurations and setting up nat, but I'm not sure if I'm doing it right, or if there needs to be some additional configuration...

Thanks for any help.
The following works for a while, but only for the browser.

When you plug in your phone via usb and choose Internet pass-through, you should get a new RNDIS device (usb0 or usb1).
For ubuntu, edit /etc/network/interfaces and add the following lines:

iface usb0 inet dhcp
iface usb1 inet dhcp


This will assign an IP automatically when the device is added.
If a network address is not assigned automaticly to usb0 or usb1 you have to do it manually.

Then you need to set up NAT on your linux computer. Something like:

sudo iptables -A POSTROUTING -t nat -j MASQUERADE
sudo echo 1 &gt; /proc/sys/net/ipv4/ip_forward 


You also need a DNS server:

sudo apt-get install bind9


This works for a few minutes, but after a while the phone gives up looking for HTC Sync and disconnects.

For rooted phones

You can connect permanently if you have a rooted phone (fre3vo worked for me).
Execute the following with adb.

Enable usb mode for network and adb:

adb shell echo 6 &gt; /sys/devices/platform/msm_hsusb/usb_function_switch


Assign an IP to the usb0 device on the phone:

adb shell ifconfig usb0 192.168.99.5 netmask 255.255.255.0 up


Add a default route. The IP should be the IP assigned to usb0 in linux:

adb shell route add default gw 192.168.99.1 dev usb0


Set the DNS server. This is google's open DNS server, but it can be the IP of your linux computer if you have a DNS server:

adb shell setprop net.dns1 8.8.8.8