Tethering Your Android to Linux (without rooting your phone)

Posted in computers on March 2nd, 2010 by karrth

If you’re stuck in an area with no internet connection except your Android phone, you can use your phone as a proxy for your laptop’s internet connection.

Setup on AndroidProxoid barcode for Android

First, you need to enable USB Debugging by going to Settings/Applications/Development/ and clicking the checkbox.  Be sure to plug your Android device into your computer with the USB cable.

Next, you need to install Proxoid.  You can do this by searching the market on your phone, or scanning the barcode to the right.

The final step is to open up the application, and check the “Start/Stop Proxoid” box.

Tethering the Phone

The first thing you need is the Android SDK.  Download it and extract the contents into /opt/android/

As root, create the file /etc/udev/rules.d/90-android.rules
with these contents:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"

Now as root, create the file /usr/sbin/tether
with these contents (or download it here):

#!/bin/bash
/opt/android/tools/adb kill-server
/opt/android/tools/adb start-server
/opt/android/tools/adb devices
/opt/android/tools/adb forward tcp:8080 tcp:8080

Make sure you make the file executable:
chmod 744 /usr/sbin/tether

Finally, run the program tether as root.

If you’re having issues, try running each command in the tether file individually so you can see any error messages.

If you don’t setup the “Run as a service” section below, type

killall adb

as root to disconnect your tether.

Setting up the proxy in Firefox

Go to Edit/Preferences/Advanced/Network/Settings…

Under the HTTP Proxy, type “localhost”, and under Port type “8080″ so it looks like the screenshot below:

Firefox Proxoid Proxy SettingsHit “Ok” twice to get out of your Preferences window, and you should be good to go!

Optional: Make it a service in Arch Linux

You can do this in other Linux distros as well, but for Arch you can download this file to /etc/rc.d/tetherd.

As root, chmod it as such to make it executable:

chmod 744 /etc/rc.d/tetherd

Now you can start tether automatically as a service by putting it in your rc.conf file, or manually by typing:

/etc/rc.d/tetherd { start | stop | restart }

Enjoy!

Further Reading

Tags: , , ,