There is a version 2.0 available at the end of the post, but its still good to read through it to realize how it works and that it took some time for me to put this up 🙂
Fixed code (indentations were gone thanks to wordpress!, and they are needed for python) and made some small changes. Also included an udev rule file to automatically run the script when the phone is connected, and also take down dhclient when it is disconnected.
New udev rules are proposed, since the ones in the prev¡ous edit depend on the MAC address assigned to the phone, which changes everytime it is released. This new method is based on the serial number of the phone, and is therefore more reliable.
Hi. As I am now in a foreign country, I do not have 3G/UMTS/(whatever it is called) internet access on my HTC Desire S. Also, in the place I am living, there is no internet WiFi access available (only over wired LAN).
In these conditions, the only way to hook up my phone to the network is to boot into Window$ XP and use the standard HTC drivers to use the “connect to internet through pc” (also known as “reverse tethering” in some places) on the phone. BUT as the W. XP on my laptop is running slower every time I use it, I wanted to give it a try and set up the reverse tethering on linux. Oh, and one little thing more: myphone is not rooted (yet).
After a whole afternoon playing with perl (which I do not know), python (this I know just a little), wireshark and a bit of fumbling with iptables,dhclient, and some more, I got it working.