Getting iPhone Internet Tethering Working in Linux
By on April 11th, 2010

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 favourite package manager.

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:

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.
Switch on iPhone tethering

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:

iPhone tethering done

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.

Tags: ,
Author: Sathya Bhat Google Profile for Sathya Bhat
Sathyajith aka "Sathya" or "cpg" loves working on computers, and actively participates in many online communities. Sathya is a Community Moderator on Super User, a collaboratively maintained Q&A site which is part of the Stack Exchange network. Sathya also contributes to and is a Super Moderator at Chip India Forums. While not writing SQL queries or coding in PL/SQL, Sathya is also a gamer, a Linux enthusiast, and maintains a blog on Linux & OpenSource. You can reach Sathya on twitter.

Sathya Bhat has written and can be contacted at sathya@techie-buzz.com.
  • Indian Art

    Thanks, handy tip.

  • Pingback: Links 12/4/2010: Awn 0.4.0, VP8 Becoming Free Software | Techrights

  • http://www.officiel-massage.fr massage

    Usefull
    thx

  • JF

    Thanks alot, worked 4 me

  • Wayne McDougall

    How to use

    sudo apt-get install libimobiledevice-dev

    before I could compile using Lucid Lynx Ubuntu

  • http://matthewshore.tumblr.com Matthew

    great!! it works a treat, and i can't tell you how happy I am to have this working now, but just to mention that you need to have libimobiledevice-dev and libimobiledevice-utils installed first….

  • http://www.dr.dk PerDK

    Thx alot for this tutorial :)

  • thw.kuco

    every time i connect i got disconnect

    dmesg:

    ipheth: ipheth_tx_timout: TX timeout

    what does this mean?

  • Geoff

    Followed instructions and on my samsung Q30 it works fine. However when I try to get it to work on a Dell D531 the driver does not load. Everything seems ot go as per the instructions but

    dmesg | grep iPhone

    gives no response so the driver does not appear to have loaded? Can you suggest what I should try?

    Geoff

    • http://sathyasays.com Sathya

      Geoff,

      This may sound kinda stupid but have you tried plugging into another USB port ?

      • Geoff

        Thanks for the response. No I had not but I have now and the result is the same. Worse still, the Samsung that was working is now not working!

        The good news is that I have managed to get the bluetooth tethering working although that too requires intervention using a terminal and the dhclient bnep0 command.

        Sadly, it is things like this that drive people away from linux. To check the tethering was enabled last night I connected to my wife's apple mac and within 30 seconds, I was on the internet! So far it has taken me several hours over many days and I only have a flaky solution to show for it.

        For some reason the

        sudo insmod ipheth.ko

        returns a message that the module is already loaded but

        dmesg | grep iPhone

        does not give an ipheth response.

        Is there a list of files I can delete to try to start all over? I have reinstalled several times but it does not seem to work again for me.

        G

        • http://sathyabh.at Sathya Bhat

          Geoff,

          I'm not sure, but my guess is probably a hardware problem or a USB driver conflict. I know how frustrating it can be, as I've been in your boat couple of times, but none in the recent past.

          Try this:

          1. First remove the Kernel mod: rmmod ipheth.ko

          2. Disconnect the iPhone.

          3. Install libimobiledevice-dev and libimobiledevice-utils as Mattew mentions.

          4. Reconnect the iPhone. Check if the iPhone gets detected( you can verify this by typing dmesg | tail or you should get prompted about iPhone connected). If you're having problems at this stage I'd say the problem lies in the USB port(s).

          5. If the iPhone does get detected ( dmesg | grep iPhone returns a value). If this doesn't work, I'm at a loss. Try asking at Ubuntu Forums ( http://ubuntuforums.org/ ) or SuperUser ( http://superuser.com ) for further suggestions.

          HTH.

        • Mariusz

          Linux understands Darwinism.

  • Pingback: [How-To] Get iPhone Internet Tethering Working in Linux : Sathya Says

  • Mike H

    Very interesting.. Linux now has a 'client' driver for the iphone tether.

    Has there been any work on making a 'server' driver, that works with the usb_gadget stuff? I want Android to look to OSX like a bloody iPhone so I don't have to try and hack together a strange CDC_ETHER driver: http://projects.goldelico.com/p/AJZaurusUSB/
    and modify Android-wired-tether to try and work with cdc_ether instead of bastardized microsoft RNDIS…

    I don't even know if this is doable, but i'm damned sure going to try.

    • http://sathyabh.at Sathya Bhat

      I am not sure if there is a server driver. Do keep us updated if you succeed :) All the best!

  • gaarby

    Hi

    I have succesfully installe ipheth but when I plug Iphone ipheth is not loaded:
    Aug 16 02:37:39 gaarby kernel: [ 2434.592261] usb 2-4: Product: iPhone

    a modprobe ipheth work:
    Aug 16 02:37:31 gaarby kernel: [ 2426.567940] usbcore: registered new interface driver ipheth

    What can I do to ipheth load when plugging iphone?

    Thanks for your help

  • Andres

    Now, iPhone internet tethering works natively on Ubuntu 10.10 !

  • butcher

    Had to install libimobiledevice-dev and -utils mentioned by Matthew to get modules to build.
    Didn’t connect the first time I plugged it in. Did the rmmod mentioned by Sathya Bhat. Unplugged iphone and plugged back in. Worked!!! Running iOS 4.1 on iPhone 4.

    Thanks for the help!

    • http://www.4stripe.com winslow

      Perfect comment! yea i was missing -utils , as soon as i installed disconnect iphone and plugged in back in again and worked straight away, oh after i had removed the ipheth.ko.

      -utils must control the modules because i kept getting a error before saying that ipheth.ko wasnt there but wouldnt let me add it

  • Vivek

    i couldn’t get past compiling the kernel driver :
    gt this error message :

    chil@chilEnterprises:~/ipheth/ipheth-pair$ cd ipheth/ipheth-driver
    bash: cd: ipheth/ipheth-driver: No such file or directory

    wt shud i do ?

    • http://sathyabh.at Sathya Bhat

      cd ..

      cd ipheth-driver

      And then proceed.

  • Reginald

    I too could not get past the first driver. I tried the solution below and it did not work either.
    Below is the error I got: (It is edited for content and brevity)

    #####Begin Quote#################
    user:~/ipheth/ipheth-pair$ pwd
    /home/user/ipheth/ipheth-pair
    user:~/ipheth/ipheth-pair$ ls -l
    total 16
    -rw-r–r– 1 2010-11-05 20:57 90-iphone-tether.rules
    drwxr-xr-x 5 2010-11-05 21:00 ipheth
    -rw-r–r– 1 2010-11-05 20:57 ipheth-pair.c
    -rw-r–r– 1 269 2010-11-05 20:57 Makefile
    user:~/ipheth/ipheth-pair$ make
    cc -Wall -O2 -c -o ipheth-pair.o ipheth-pair.c
    ipheth-pair.c:25: fatal error: libimobiledevice/lockdown.h: No such file or directory
    compilation terminated.
    make: *** [ipheth-pair.o] Error 1

    ### End of error###############
    Thanks for your help. I am looking forward to the iphone fun with Ubuntu!!

    Reggie

    • http://www.4stripe.com winslow

      sudo apt-get install libimobiledevice-utils

      sudo apt-get install libimobiledevice-dev

      and then try it all again, this worked straight away for me after

  • Kalle

    Under maverick just do the following:

    apt-get install ipheth-dkms ipheth-utils

    Then plug in the iphone and you’re up & running!

    • http://sathyabh.at Sathya Bhat

      @Kalle Ah awesome, thanks for that update!

    • Chris Barker

      Works like a charm. Thanks.

    • Kieron

      Works 100%! Thank you very much! Now, if only iTunes was this easy to get working on Ubuntu …….

    • Matze

      Thanks!

      It works wonderful!

      But I still have to reboot to get it work. Maybe because I’ve load the ipheth modul before I installed the ipheth-dkms package. It’s just a hint for those who think it doesn’t work. Try a reboot, maybe it helps.

      P.S. I’m sorry for a bad English *blushing*^^

  • http://brendanboyd.com Brendan Boyd

    After slaving at this for hours I finally got a combo working together for Ubuntu 10.10. I went about this by adding the PPA for Paul McEnery to my software center and installing ipheth-utils, ipheth-dkms, libimobiledevice-dev, libimobiledevice-utils, libimobiledevice1, libusbmuxd-dev, libusbmuxd1, libusbmuxd, and several restarts of my machine. Finally got that glorious eth1 network connection. Very helpful. Thanks!

    • http://www.sydseter.com Johan Sydseter

      If the network connection continously connects and disconnects, then update your iphone to 5.1

  • Philipp

    Works like a charm! Thanks for the article.

    On Ubuntu 10.10 (2.6.35-25) I had to add #include
    to ipeth.c to make it compile.

  • Espen Amble Kolstad

    Worked right away on openSUSE 11.3

    Thanks!

  • Pablomartino

    Thanks a lot for this! it works fine for me but maybe you have to explain a little bit better how to get some packages that are available to download via SYNAPTIC, I’ve searched for updated ipheth packages because I didn’t have it installed and maybe the first step before working with the Terminal should be check that packages are correctly installed!
    By the way… THANKS! it finally works and I was looking for this!!

  • Tom

    Hello, I was wondering if anyone can help me?
    I am new to linux and am running ubuntu 10.04. I followed the instructions and after entering “dmesg | grep iPhone”
    successfully receive the output:

    [ 165.272517] ipheth 2-2:4.2: Apple iPhone USB Ethernet device attached

    However Network Manager does not register a new wired connection. Can anybdoy help?

  • http://www.multigaming-inso.com/ Dobi

    Very good Thanks !

    Don’t follow to enter :

    sudo apt-get install libimobiledevice-dev

    before do the fisrt compilation (make, make install in ipheth/ipheth-pair folder)
    =)

 
Copyright 2006-2012 Techie Buzz. All Rights Reserved. Our content may not be reproduced on other websites. Content Delivery by MaxCDN