Getting iPhone Internet Tethering Working in Linux

I’ve owned couple of mobile phones now, all in increasing number of features. But the one thing that remained common amongst all of them, was the ability to use a tethered Internet connection in both Windows and Linux. Until I got the iPhone, that is. With the iPhone, I could no longer use the iPhone as a modem in Linux. Not anymore.

I was recently researching about claims that Ubuntu could sync with the iPhone, even the non-jailbroken ones. I was a little skeptical about this. What I found was libimobiledevice, and the iPhone Ethernet driver for Linux. I’ll write on libimobiledevice at a later day.

Let’s have a look at the USB Ethernet driver: The iPhone USB Ethernet driver was written by Diego Giagio, and is a kernel driver which adds support for iPhone tethering through USB cables. Like libimobiledevice, the driver doesn’t require you to jailbreak your iPhone, so bonus marks here.

Let’s start on how we can achieve this. This post is written from a Ubuntu/Debian system perspective, if you’re using some other distribution, the steps should remain same, with the exception of getting the packages via your favorite package manager.

Source: ubuntu.com

First: Get the source from Diego’s git repository. If you don’t have git installed, open the terminal and type:

sudo apt-get install git-core

Once git is installed, get the source for the drivers

git clone git://github.com/dgiagio/ipheth.git

The output should be something like

sathya@shaman:~$ git clone git://github.com/dgiagio/ipheth.git
Initialized empty Git repository in /home/shaman/ipheth/.git/
remote: Counting objects: 10, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 10 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (10/10), 8.11 KiB, done.
sathya@shaman:~$

Now, compile the pairing program.

cd ipheth/ipheth-pair

make

You should get an output like:

sathya@shaman:~/ipheth/ipheth-pair$ make
gcc -Wall -O2 ipheth-pair.c -o ipheth-pair -liphone

Next, type:

sudo make install

You should get an output like:

sathya@shaman:~/ipheth/ipheth-pair$ sudo make install
install -m 0755 ipheth-pair /lib/udev/
install -m 0644 90-iphone-tether.rules /etc/udev/rules.d
/sbin/udevadm control –reload-rules
sathya@shaman:~/ipheth/ipheth-pair$

Compile the Kernel driver:

Source: github.com

cd ipheth/ipheth-driver

make

You should get an output like:

sathya@shaman:~$ cd ipheth/ipheth-driver
sathya@shaman:~/ipheth/ipheth-driver$ make
make -C /lib/modules/2.6.28-15-generic/build M=/home/sathya/ipheth/ipheth-driver modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.28-15-generic’
CC [M] /home/sathya/ipheth/ipheth-driver/ipheth.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/sathya/ipheth/ipheth-driver/ipheth.mod.o
LD [M] /home/sathya/ipheth/ipheth-driver/ipheth.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.28-15-generic’
sathya@shaman:~/ipheth/ipheth-driver$

The kernel module is ready. Now load the module.

sudo insmod ipheth.ko

We’re all set to try the new driver out. Now connect the iPhone. The iPhone should get detected, as shown in the picture.

To confirm that the USB Ethernet driver is in use, open the terminal and type

dmesg | grep iPhone

You should get an output like:

sathya@shaman:~/ipheth/ipheth-driver$ dmesg | grep iPhone
[22871.808469] ipheth 2-2:4.2: Apple iPhone USB Ethernet device attached

Yay! That means the USB Ethernet driver is ready. Lets switch on Tethering on the iPhone.

Lets see what happens. Prior to installing the driver, I would get no notification and nothing would happen. Not now.

To confirm that we have indeed connected using iPhone let’s have a look at Network Manager connections:

And there you go, iPhone tethering on Linux!

Notes:
1: You need to have tethering option enabled with your service provide to use this tip. From what I know, tethering is not officially allowed under AT&T’s plan, so I don’t think this method will work.
2: I tested this on my iPhone 3G running on iPhone OS 3.1.2. Although mine is a jailbroken iPhone, the author mentions that jailbreaking is not required.