Print
Category: Software
Hits: 13473

This is a brief "How To" tether your Raspberry Pi to an iPhone5 for the purpose of providing an internet connection to the RaPi:

Power Considerations (Important!):

The iPhone draws considerable power and the current available at the RaPi USB port is limited. My experience has shown that I can connect the iPhone 5 and a DVAP to a RaPi B, but  if you experience problems you should try to resolve the issue with a powered USB hub.

Note: The Raspberry Pi B+ feature list mentions "Now possible to drive power hungry USB devices" .

This article is based on an iPhone5 running IOS7.1.1 (11D201), Raspberry Pi B and the Rasbian image Debian Wheezy release 20 June 2014.  

Installing and configuring software:

sudo su -
apt-get install ipheth-utils apt-get install libimobiledevice-utils
aptitude install ifuse
mkdir /media/iphone

Your RaPi is now ready to accept the iPhone. Enable the "Personal Hotspot" on the iPhone but before you connect it to the USB port check interfaces on the RaPi:

ifconfig -s

You will see a table with the first column (titled Iface) showing the interface name.

Connect the iPhone and run ifconfig -s again, this time you should see and additional interface (probably eth1) - that's the interface provided by the iPhone.

Edit you network interface configuration file:

sudo nano /etc/network/interfaces

Add the following lines to the file (replace eth1 with the interface name of your iPhone

allow-hotplug eth1
iface eth1 inet dhcp 

^O to save, ^X to exit

Reboot the Pi, connect your iPhone and enter the following commands:

sudo su -
ifuse /media/iphone

Your internet connection should be now be working. Since you don't want to enter the above commands every time the following instructions automate that process.

If you see "Trust This Computer" on your iPhone answer "Don't Trust" - to connect to the internet you do not require a "Trusted" connection.

nano /lib/udev/iphoneconnect

and copy the following contents into the editor:

#!/bin/bash
umount /media/iPhone #when the iPhone is unplugged, it is not automatically unmounted.
ifuse /media/iPhone
ipheth_pair

^O to save, ^X to exit

now make the file executable:

chmod 755 /lib/udev/iphoneconnect

No modify the iPhone tether rules file 

nano /lib/udev/rules.d/90-iphone-tether.rules

Edit the 5th line to read:

ACTION=="add", SUBSYSTEM=="net", ENV{ID_USB_DRIVER}=="ipheth", SYMLINK+="iphone", RUN+="iphoneconnect"

That's it, the RaPi will now link to internet automatically.  

Most of the information in this article is based on Dave Conroy's How To article found here.