Locked History Attachments All Actions

iPhoneEthernetDriver

iPhone USB Ethernet Driver

This is a Linux Kernel driver that adds support for iPhone tethering through USB cables. Unlike other solutions out there, you don't need to jailbreak your phone or install third-party proxy applications.

Attention: The ipheth kernel module has been accepted upstream as of Apr 21 2010 for kernel 2.6.34. The following instructions for compiling and installing this module are deprecated, unless you want to use the module on an older kernel. You still need the pairing program for the driver to work. You can also pair your device by using the libmobiledevice utilities.

  • Update Dec 01 2009: Added support for newer kernels (Ubuntu Karmic, Fedora 12, etc). Patches by Matthew Garrett (mjg@redhat.com)

  • Update Jan 01 2010: Fixed a bug on retrieving iPhone MAC address. Patch by Daniel Borca (dborca@yahoo.com)

  • Update Jan 01 2010: Deprecated the pairing program written in Python in favor of a new pairing program written in C. Contributed by Daniel Borca (dborca@yahoo.com)

  • Update Apr 21 2010: ipheth kernel module has been accepted upstream. It should be part of 2.6.34 kernel release. More info: http://lkml.org/lkml/2010/4/22/17

  • Update Oct 06 2011: Some people pointed out a problem with libmobiledevice libraries path on an x86_64 environment. More details on the troubleshooting section below.

Devices supported

The driver was tested with iPhone 3G and iPhone 3GS with firmware 3.0 or better. iPhone 2G with some patches is also expected to work.

What you need

You need both the kernel driver and an user-space program. The user-space program is necessary in order to do a handshake and pair the device with the computer, otherwise it won't respond to kernel driver requests and thus won't work.

I won't get into much detail here, but basically the pairing of the device can't be done at kernel level since it heavily makes use of XML (Apple PList's) and other certificates and crypto keys stuff.

You can pull the repository to your local machine by running:

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

Package dependencies

To build the kernel driver you only need the kernel source of your distribution. The pairing program is written in Python and makes use of the excellent libiphone and python-iphone libraries from the iFuse Project. The pairing program is written in C and makes use of libiphone libraries from iFuse Project. As of Jan/01/2010 only the git version of libiphone library is supported!. You can find it on this git repository.

If you are on x86_64 environment, make sure the libmobiledevice libraries are being installed on $(libdir)/lib64 instead of $(libdir)/lib.

Step-by-step

Please note: I'm assuming the package dependencies outlined above were successfully installed.

  • Retrieve the source:

diego@eeepc:~$ git clone git://github.com/dgiagio/ipheth.git
Initialized empty Git repository in /home/diego/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.
diego@eeepc:~$
  • Compile and install the pairing program:

diego@eeepc:~$ cd ipheth/ipheth-pair
diego@eeepc:~/ipheth/ipheth-pair$ make
gcc -Wall -O2 ipheth-pair.c -o ipheth-pair -liphone
diego@eeepc:~/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
diego@eeepc:~/ipheth/ipheth-pair$
  • Compile the kernel driver:

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

diego@eeepc:~/ipheth/ipheth-driver$ sudo insmod ipheth.ko
diego@eeepc:~/ipheth/ipheth-driver$ 
  • Plug in your iPhone and check your dmesg for success:

diego@eeepc:~/ipheth/ipheth-driver$ dmesg
... lines stripped ...
[ 8181.461000] ipheth 1-6:4.2: Apple iPhone USB Ethernet device attached
[ 8181.463067] usbcore: registered new interface driver ipheth
diego@eeepc:~/ipheth/ipheth-driver$ 

At this point you should have a new ethernet interface on your computer. Mine is eth1, but your mileage may vary.

Now you only need a DHCP client and you are all set. Most recent Linux distributions ships with NetworkManager, and it works great. If you don't use it, just dhclient ethX, where ethX is your interface.

Troubleshooting

Make sure you have Internet Sharing active on your iPhone.

The driver keeps complaining: "TX timeout"

This happens when you have the driver running but the device isn't yet paired. Don't forget to pair your device every time you connect it to your computer.

Some people pointed out that on x86_64 environment the libmobiledevice libraries are installed on $(libdir)/lib instead of $(libdir)/lib64 which is used by the pairing utility, causing it to unable to pair and display the TX timeout error.


CategoryProgramming