Sometimes I have the need to get on the internet using my laptop instead of my lovely HTC Magic. To do that, I’d have to get mobile internet, which is yet another expense I don’t really want. Before I go ahead, I’d like to strongly discourage doing this on a regular basis. Vodafone’s “unlimited” internet is 500MB fair use policy, which when using a laptop can be used up really quickly – so proceed with caution! In addition, I do not know your contract to confirm that this will not void your warranty or violate your terms of service. You carry out these steps at your own risk and are provided here for informational purposes only. Basically, if you mess things up and Vodafone (or whoever your carrier is) comes knocking on your door, I’m not being held responsible.
This process does involve a bit of fiddling and knowledge of how things work, and the instructions on the app’s page are pretty straightforward anyway.
Tethering has been made really easy by using an app called Azilink. All it is is an OpenVPN server on your phone, which allows your laptop to connect to it via a USB cable.
Here’s the steps – pretty much the same as on the instruction page linked above – but specifically for Ubuntu:
- Install OpenVPN (don’t bother with Network Manager): sudo apt-get install openvpn
- Enable USB debugging on your phone. From the home screen, this is under Settings > Applications > Development > USB debugging.
- Download the Android 1.5 SDK: http://developer.android.com/sdk/download.html?v=android-sdk-linux_x86-1.5_r3.zip
- Extract to /opt/android-sdk-linux_x86-1.5_r3
- Add the /opt/android-sdk-linux_x86-1.5_r3/tools directory to your path (e.g. in .bashrc add PATH=/opt/android-sdk-linux_x86-1.5_r3/tools:”${PATH}”
- Log out and back in again for the .bashrc to update
- You should be able to run adb now – type “adb”, hit RETURN and it should say it’s starting a daemon.
- Create and open /etc/udev/rules.d/51-android.rules in your favourite editor
- Add the line: SUBSYSTEM==”usb”, SYSFS{idVendor}==”0bb4″, MODE=”0666″
- Set the permissions of the file: sudo chmod a+rx /etc/udev/rules.d/51-android.rules
- Connect your HTC Magic via USB cable to your laptop (hint: “tail -f /var/log/messages &” gives you information when your phone is connected)
- Check adb recognises your device: “adb devices” you should see a device listed
- Download: http://lfx.org/azilink/azilink.apk
- Install the app to your phone by doing “adb install azilink.apk”
- You should see the Azilink app in your apps list (its a little moth icon).
- On your laptop, type “adb forward tcp:41927 tcp:41927″
- On your phone, run the Azilink app, and check the “Service active” checkbox. Status will change to “waiting for connection”
- Download: http://azilink.googlecode.com/files/azilink.ovpn
- On your laptop, run “sudo openvpn azilink.ovpn”
- In a few moments on your phone, Azilink should report the status is now “Connected to host”.
- In a new terminal (don’t close the openvpn program, you’ll lose your connection!) edit /etc/resolv.conf and add “nameserver 192.168.56.1″
With any luck you should now have internet. Next time you want to connect, I think you’ll have to do something like (and I’ve not checked this yet!):
- On phone, check USB debugging is enabled (if you disabled it)
- Connect HTC Magic to laptop with USB cable
- On laptop terminal, type: “adb forward tcp:41927 tcp:41927″
- On phone, check the “Service active” box (if you disabled it — recommended as it will probably drain your battery!)
- On laptop run “sudo openvpn azilink.ovpn”
- Add “nameserver 192.168.56.1″ into your /etc/resolv.conf (assuming Network Manager over-writes your resolv.conf)
I did this on Ubuntu 9.04 (Jaunty Jackalope) and this worked for me. Hopefully this should work pretty straightforward without problems.
Essentially what this app does is run a VPN server on your phone. ADB (Android Debugging Bridge) is a development tool that allows forwarding of TCP traffic from your laptop to the phone (and vica-versa) – working in a similar way to an SSH tunnel, but this is all unencrypted. Then all you have to do is open an unecrypted VPN connection to the forwarded port (i.e. 127.0.0.1:41927), and route the traffic through that. The nameserver isn’t auto set of course so that has to be done manually.
I have no idea why tethering is so difficult on the HTC Magic – it should be made much easier, especially as it’s such an open phone. However, thanks to it’s open-ness, apps like Azilink exist and make tethering possible!
Handy tip: You can download this article and keep it on your PC which may help if you’re trying to set this up and you dont have an alternative internet connection. Don’t forget to download all the files mentioned above as well! Right click this link and Save As….
July 25th, 2009 at 11:01 pm
[...] Tethering your HTC Magic Android Phone in Ubuntu 9.04 (Jaunty Jackalope) [...]
August 4th, 2009 at 9:35 pm
thank you for the introduction
greets heavy from Esslingen germany
August 28th, 2009 at 9:01 pm
[...] some random bit of software: they ask you to download the Android SDK and install Proxoid or install OpenVPN and AziLink or use adb forward to forward a port for a proxy server or put shell scripts on your phone (!) or [...]
September 1st, 2009 at 1:24 am
Nice. Thanks for the help, and being able to save the instructions as HTML for offline viewing is class. Cheers!
-
September 8th, 2009 at 12:02 pm
Dude, you saved my life.
Your guide is awesome and I’m gonna translate it to french on my blog (hope you don’t mind)
I’m gonna fix some issues however as I had to run some commands from the sdk/tools/ dir with root access (sudo). Hope you don’t mind. No worries i’m gonna link to your page and give you all the credits!
Thanks again! I’m now writing this from a restaurant where there is no wireless so I’m using your solution! Yay! thanks again!
September 8th, 2009 at 12:45 pm
Hi David, yes please feel free to translate and redistribute the article! All content on the site is under Creative Commons license, so I ask that you license your version in the same way!
See: http://creativecommons.org/licenses/by-nc-sa/3.0/
January 26th, 2010 at 12:23 am
Thank you for sharing this terrific guide. It worked great in Ubuntu 9.10 for me. I had long since given up on tethering.
February 2nd, 2010 at 4:57 am
Works great on Droid and Ubuntu 9.10, thanks. Now if I could get through my Cisco VPN I’d be golded. vpnc-connect gives me this message:
TYPE := { vlan | veth | dummy | ifb | macvlan }
SIOCSIFMTU: Invalid argument
RTNETLINK answers: File exists
vpnc-connect: quick mode response rejected: (ISAKMP_N_UNEQUAL_PAYLOAD_LENGTHS)(30)
this means the concentrator did not like what we had to offer.
Possible reasons are:
* concentrator configured to require a firewall
this locks out even Cisco clients on any platform expect windows
which is an obvious security improvment. There is no workaround (yet).
* concentrator configured to require IP compression
this is not yet supported by vpnc.
Note: the Cisco Concentrator Documentation recommends against using
compression, expect on low-bandwith (read: ISDN) links, because it
uses much CPU-resources on the concentrator
February 23rd, 2010 at 8:23 pm
Hi James,
Thanks for your clear and exceptional detailed guide. Unfortunately I was not able to get it working. I seem to have no access from my desktop to my phone. On both the desktop and the google magic (I downloaded azilink via the phone’s browser) everything seems to work a-okay.
But I cannot establish the connection between the desktop and the phone (settings on the phone are as you suggested, but:
root@ubuntu:/opt/android-sdk-linux_86/tools# ./adb devices
List of devices attached
???????????? no permissions
or
root@ubuntu:/opt/android-sdk-linux_86/tools# ./adb forward tcp:41927 tcp:41927
error: insufficient permissions for device
Any further suggestions? Your help is appreciated! Thanx,
Will
February 24th, 2010 at 8:54 am
Hi Will, after a quick Google, the first result for “adb devices no permissions” was:
http://groups.google.com/group/android-discuss/browse_thread/thread/f85a795644e65b59?pli=1
Apparently you have to sudo restart the adb server, although by the looks of things for some reason you’re logged in as root (a security issue, I might add!) so that may not be the issue…
February 24th, 2010 at 7:11 pm
Hi James, Thanks for your response, Yesterday I became root after encountering the described permission restrictions. Today I went through all your instructions again, carefully, step by step and testing results all the time (with root permissions during the whole process). And it works great
Thanks to your very clear step by step instructions. I was able to do this as Linux newby, that tells a lot more about your teaching skills than my learning skills! Thanks!
March 4th, 2010 at 8:13 am
[...] La fonte originale dalla quale ho tratto le informazioni รจ questa. [...]
March 25th, 2010 at 5:06 pm
[...] the guide from here, I’ve managed to use the ‘net connection of my Nexus One with my Eee PC running Ubuntu [...]
May 9th, 2010 at 8:36 pm
hy
works great on Ubuntu 10.04 32 bit
May 28th, 2010 at 4:26 am
I created a simple script to set this up. The script also creates an icon on your desktop to use to launch the connection. Check it out here:
http://www.humans-enabled.com/2009/12/how-to-tether-your-verizon-droid-as.html
July 22nd, 2010 at 12:53 am
Works w/ HTC Evo 4G and Ubuntu 10.04. Thanks!
August 3rd, 2010 at 4:20 pm
Not sure how the guy above me got this to work with Ubuntu 10.04 and the HTC Evo. I have tried these instructions as well as the (slightly) different instructions posted by Shannon VanWagner (he uses a different name for the rules file, slightly different permissions, and also passes in the –config switch when starting openvpn with the azilink.ovpn file). Neither of them work with my Evo.
The connection says that it’s established on both the phone and in terminal, but I can’t actually reach any sites. Any idea what I should do to troubleshoot?
August 3rd, 2010 at 8:22 pm
[...] Froyo (Android 2.2) update disables USB tethering Just FYI my co-worker has upgraded his Evo to run Froyo today. The update takes quite a while to execute so be patient, but one thing I noticed was that the USB tethering no longer works. On my phone (still running 2.1) I can plug in the USB cable, enable the 4G radio, and then go to Menu -> Settings -> Wireless & networks and click on the "Internet sharing" option. Once I do this, my computer automatically picks up the new USB device and can use it for internet access (it shows up as "usb0" in my ifconfig on Ubuntu 10.04). Note that this USB tethering ONLY works when the phone has a connection to the 4G network, otherwise tapping the "Internet sharing" option will produce an error 67 message. I tested on my co-worker's phone after he upgraded to 2.2 and found that: 1) The "Internet sharing" option has been renamed to "USB tethering" 2) Tapping the "USB tethering" option will immediately disconnect your phone from the 4G network. Consequently, this means that you cannot tether. Anyone else notice this issue after moving to Froyo? I have downloaded the update but I haven't applied it yet (for this and other horror stories I have heard). If you do lose the ability to perform USB tethering after the upgrade, have you been successful with tethering the Evo to a Linux machine? I have tried these two tutorials and been unsuccessful: Linux + GNU = Humans Enabled: How to Tether your Android to Ubuntu(or Fedora) GNU+Linux for Internet Connectivity James Titcumb Blog Archive Tethering your HTC Magic Android Phone in Ubuntu 9.04 (Jaunty Jackalope) [...]
August 4th, 2010 at 7:44 am
Hi Brandon – hmm it could be a routing issue, perhaps they changed the nameserver IP address since I wrote this (i.e. the one you put in /etc/resolv.conf). As I don’t have an HTC Evo (still on contract with my Magic!) I’m probably not that useful, but perhaps try doing an “ifconfig” to find the gateway IP address when you’re connected, and put that IP address in /etc/resolv.conf instead of the 192.168.56.1. Sorry I can’t be of more help!
August 5th, 2010 at 5:00 pm
Doesn’t seem like a routing issue — the default gateway is still the same. I’m wondering if it’s actually caused by my version of adb? I seriously doubt it but the instructions on the azilink site specifically mention to use “ADB from the 1.1 or 1.5 Android SDK or from the download section”. I’m not using the 1.1. or 1.5 SDK because they don’t appear to be available any longer. Thus, I’m copying the adb binary out of the latest SDK. Could this be an issue?
It’s really bizarre because adb recognizes my phone and will even transfer over the .apk file and install the azilink application. When I start it up and then fire up openvpn, the status on the phone changes to “connected to host” but I can’t reach anything and the bytes received/sent/total all remain at 0.
This is frustrating. I also found it interesting that my post from the android forums showed up here in your comments. I was hoping someone there might know what was going on but so far — no such luck!
August 5th, 2010 at 9:39 pm
Ok nevermind — I got it working. I found another blog talking about how to get this setup and they used the 91-android.rules files. They also had two additional options in the rules file (SYMLINK and OWNER). When I added those values into my rules file, everything works now!!!
An example is below, just replace yourUserName with the value of your user in Ubuntu.
SUBSYSTEM==”usb”, ATTRS{idVendor}==”0bb4″, SYMLINK+=”android_adb”, MODE=”0666″, OWNER=”yourUserName”
August 6th, 2010 at 8:31 am
Great, glad you got it sorted and thanks for posting the information back here!