HTC Magic tethering with Linux and OSX Snow Leopard without Android’s root permissions

Editor’s Note: Unfortunately, my HTC died just before I finished posting this, so not all steps were thoroughly tested although I did test the end results on both Snow Leopard and Linpus.

For all those still waiting for HTC to update it’s Magic smart phone to Android 2.2, where not a lot of options for tethering you device with Linux or OSX machines: root it, pay for PDAnet (and it only works on OSX), or follow the following steps ๐Ÿ™‚

How it works

Android 1.6 doesn’t offer any capability to use a cell phone as a simple UMTS Modem, as almost every single cell phone I know does, including my old Nokia E61i, which allows for USB and Bluetooth tethering out of the box. There’s a single application which allows for USB tethering, which is PDANet, and it is expensive.Another alternative, is to root your Android cell phone, thus braking any warranty you might still have, and for some models, it’s a pain, and install a custom IPTables module, making the phone a router. Finally, the way I found easier: use a program called AZlink, which is basically an OpenVPN emulator. It emulates the OpenVPN interface to the host machine, but it doesn’t really any of the security stuff, it simply acts as an generic IP proxy and sends all traffic trough Android’s adb application for debugging.

Most steps are shared between operative systems, so here goes:

Step Snow Leopard Linpus Linux
1 On you Android phone, enable “USB Debugging” at Settings -> Applications -> Development
2 Download the current Android SDK. Versions for Windows, Snow Leopard and Linux, are available at Android’s development website.
3 Extract the SDK, then navigate to the folder where the adb application is, usually on the tools directory
Create/edit/save a rules file for udev to allow your machine to see your devicesudo vi /etc/udev/rules.d/91-android.rules

SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", SYMLINK+="android_adb", MODE="0666", OWNER="USERNAME"


If you have an HTC(instead of Motorola) Android phone – use this rule instead of the one above:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", SYMLINK+="android_adb", MODE="0666", OWNER="USERNAME"

5 Set the appropriate permissions to the rules file you just created.

sudo chmod a+r /etc/udev/rules.d/91-android.rules
6 Restart udev to load the new rule.

sudo restart udev

7 Connect your Droid to the computer with the USB cable and then use the following adb command to check for your device.

adb devices

adb devices
List of devices attached

8 Install openvpn on your computer so you can connect to your device with it.
(you need to have macports installed on you system)sudo port install openvpn
Install openvpn on your computer so you can connect to your device with it.Linux (Fedora, Linpus and every distro using Yum):


sudo yum install openvpn
sudo /etc/init.d/networking restart

9 Install openvpn on your Android. Note: the line “adb install” actually installs the azilink application on your Android device. After azilink is installed, an icon that looks like a flying insect will appear on your Android in the applications area.

adb install -r azilink-2.0.2.apk

10 Create a replacement resolv.conf file to be copied over to your /etc directory at run-time with the following contents:

domain lan
search lan

11 Now create a very small script to start the modem, called โ€œstart modem.shโ€ with this text:

adb forward tcp:41927 tcp:41927
sudo cp resolv.conf /etc/
sudo openvpn --config azilink.ovpn

Download this file, into the directory of adb.
12 It seems that openVPN and Snow Leopard don’t get along so well on the TUN drivers, so it’s a good idea to install TunnelBlick. Remember to allways open TunnelBlick, but it’s not necessary for anything else.
13 Set your new script to be executable.

chmod 755

14 On your Android, launch the azilink app and place a checkmark by “Service active” so it can receive the connection from your machine.
15 Start the application on the terminal.



If everything went accordingly to plan, on your terminal you should have something of this sorts:


Thu Jul 15 19:35:13 2010 OpenVPN 2.1_rc15 i386-redhat-linux-gnu [SSL] [LZO2] [EPOLL] built on Nov 30 2008
Thu Jul 15 19:35:13 2010 WARNING: --ping should normally be used with --ping-restart or --ping-exit
Thu Jul 15 19:35:13 2010 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
#If you get the following line on OSX, you need to use the above configuration file
Thu Jul 15 19:35:13 2010 ******* WARNING *******: all encryption and authentication features disabled -- all data will be tunnelled as cleartext
Thu Jul 15 19:35:13 2010 TUN/TAP device tun0 opened
Thu Jul 15 19:35:13 2010 /sbin/ip link set dev tun0 up mtu 1500
Thu Jul 15 19:35:13 2010 /sbin/ip addr add dev tun0 local peer
Thu Jul 15 19:35:13 2010 Attempting to establish TCP connection with [nonblock]
Thu Jul 15 19:35:13 2010 TCP connection established with
Thu Jul 15 19:35:13 2010 TCPv4_CLIENT link local: [undef]
Thu Jul 15 19:35:13 2010 TCPv4_CLIENT link remote:
Thu Jul 15 19:35:23 2010 Peer Connection Initiated with
Thu Jul 15 19:35:24 2010 Initialization Sequence Completed

As soon as it started, with first important task was to test if going to the Droid impacted the performance of the connection, so I did a quick speedtest: and no, it’s still at the contracted 2Mbps. Great! It’s not anything worth writing home about, but good enough to use in case of emergency (although I’ve used less than 300Kbps, and it was well worth the trouble)

When you’re finished – hit ctrl+c at the Terminal from which you started the connection script. Then uncheck “Service active” in Azilink on your Android.

Leave a Reply

Back to Top