HOWTO: Ubuntu USB reverse tethering
def:"Reverse tethering" : sharing your PC's internet connection with your Android phone.
This is suppose to work with any rooted Android device with the latest of Busybox. I own an Atrix and I use Ubuntu, and it works. If you own X and use Y, I don't care
. It is also suppose to work with any USB tether-able Android device (like in proper, not the kind where you need to download an app for your PC to set up a SOCKS proxy of some kind).
I also use the Gingerbread ROM leaked for AT&T. This was done on Ubuntu 11.04 Natty, but the principles stay the same.
Let's get on with, shall we:
- Install Firestarter and DHCP server
sudo apt-get install firestarter dhcp3-server
- Connect to the internet
Like you normally would. If you connected via WiFi, your connected device would probably be wlan0, if via ethernet - eth0, if via dialup - ppp0. If you are unsure, click on the Network Manager icon and click on Connection information. Otherwise, run ifconfig to see which device has got what IP address (to give you a hint as to what network device your PC is using).
- Start USB tethering on your Atrix
Plug in the USB cable in your Atrix.
Under Settings -> Wireless -> Tethering & Mobile Hotspot -> USB Tethering checked.
Your Network Manager will try to get an IP address (and will probably succeed). Click on the Network Manager icon (probably the icon has changed to an ethernet port to signify that you are connected via USB) and click on "Edit Connections".
Under the "Wired" tab double-click on USB0 to edit it
Under the "IPV4" settings click on the "Routes" button
Check the "Use this connection only for resources on its network"
You'll see the Network Manager icon will change back to its previous icon.
- Configure Firestarter
If it is your first time to start firestarter, it will prompt you with the First Run Wizard. Otherwise, click on Firewall -> Run Wizard
Click Forward to get past the intro screen.
In the drop down box, select the device you are connected to the internet with.
Check the "Enable internet sharing" option
On the checkbox, select the "Unknown Device (usb0)" as your Local Area Network device
Check the "Enable DHCP for local network" option
On the DHCP server details, select the "Create new DHCP configuration:" option
Uncheck the "Start Firewall now"
Great, so Firestarter is set up. But, it saves the dhcpd.conf file (Natty specific? I don't know) in the wrong directory (/etc/dhcpd.conf instead of /etc/dhcp/dchpd.conf).
sudo mv /etc/dhcpd.conf /etc/dhcp/dhcpd.conf
Start the Firestarter firewall (in Firestarter, press CTRL-S)
- Configure the Atrix
1) While the device is connected via USB (and Applications -> Development -> USB debugging is enabled)
sudo adb shell
netcfg usb1 dhcp
2) Run in your terminal on your phone:
netcfg usb1 dhcp
If nothing failed, then everything worked. The principle is this : IP Chains between USB0 and <internet connecting device> (set up by Firestarter) with DHCP server running. This may not be the most über geek way of doing things but is sure point-and-clicky-easy-ish.
Et voilà, sweet reverse tethered nettubes...