Difference between revisions of "IPhone tethering"

From ArchWiki
Jump to: navigation, search
m (removed intro header)
(15 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 +
[[Category:Mobile devices]]
 
{{Lowercase_title}}
 
{{Lowercase_title}}
[[Category:Other hardware (English)]]
+
Unless disabled by your provider, it's possible to share your iPhone's 3G data connection over WiFi, USB and Bluetooth without needing to jailbreak. WiFi requires no additional configuration provided your computer can connect to wireless networks, and you'll find instructions for USB and Bluetooth below.
With the release of iPhone OS 3.0 it is possible to use the device as a 3G data modem over either USB or Bluetooth on Windows and OS X systems, without the need for jailbreaking. There is no official support for tethering on Linux systems and by the time of writing no working USB driver has been developed. However, tethering over Bluetooth is still an option.
+
 
 +
== Tethering over USB ==
 +
=== Tethering over USB using Personal Hotspot ===
 +
Tethering natively over USB is the optimal choice as it provides a more stable connection and uses less batteries than bluetooth or wifi.
 +
 
 +
To tether your iPhone over USB, you'll need the following packages installed:
 +
# pacman -S usbmuxd libimobiledevice ifuse
 +
 
 +
Then ensure the ipheth module is loaded (currently included in the default and LTS Archlinux kernels)
 +
# modprobe ipheth
 +
 
 +
Assuming everything's gone smoothly so far, enable '''Personal Hotspot''' on your iPhone and plug it into your computer. At this point you'll have a new ethernet device available, but connecting through it might not work quite yet; for some reason, the '''ipheth''' module only works when the iPhone's filesystem has been mounted by '''ifuse''', so unless your system did it automatically when you plugged your iPhone in, you'll need to do it manually:
 +
# ifuse /path/to/mountpoint
 +
To manually unmount it later, run:
 +
# fusermount -u /path/to/mountpoint
 +
 
 +
Once your iPhone's filesystem is mounted, you should be able to use netcfg, NetworkManager, wicd, dhcpcd etc to connect to the internet through the new iPhone ethernet device just like you would any other ethernet connection.
 +
 
 +
==== Troubleshooting ====
 +
 
 +
===== The iPhone appears in the device list but it doesn't connect =====
 +
Its possible that you may need to connect your iPhone and pair it with your computer before connecting in some circumstances (iPhones using a PIN unlock?):
 +
# idevicepair pair
 +
 
 +
=== Tethering over USB using SSH and itunnel ===
 +
You'll need '''aur/itunnel''' and '''community/ifuse''' before following these instructions: http://dev.squarecows.com/2009/05/06/iphone-linux-tethering-via-usb-cable/
 +
 
 +
=== Tethering over USB from within a Windows guest in Virtualbox ===
 +
One potential way to accomplish this is to use a Windows guest in [[VirtualBox]], and present the host Arch system with a network interface (Host Only?). The working iPhone network device in Windows might then be bridged to the host only interface device within Windows. The iPhone USB network driver is installed together with iTunes. However, this has yet to be tested successfully. More info to come.
  
 
== Tethering over Bluetooth ==
 
== Tethering over Bluetooth ==
Line 26: Line 55:
  
 
To start bluetooth automatically on boot, add bluetooth to your daemons array in rc.conf:
 
To start bluetooth automatically on boot, add bluetooth to your daemons array in rc.conf:
  DAEMONS=(... bluetooth)
+
  DAEMONS=(... bluetooth ...)
  
 
No further configuration seems to be necessary on Arch systems. If problems arise, see the first sources link for possible config file edits.
 
No further configuration seems to be necessary on Arch systems. If problems arise, see the first sources link for possible config file edits.
  
==== Gnome/Xfce4 ====
+
==== Gnome/XFCE ====
 
Install the [[Blueman]] GTK+ Bluetooth manager
 
Install the [[Blueman]] GTK+ Bluetooth manager
  
Line 40: Line 69:
  
 
Blueman will have created a new network interface, typically bnep0. To connect to it, run the following as root.
 
Blueman will have created a new network interface, typically bnep0. To connect to it, run the following as root.
 
 
  # dhcpcd bnep0
 
  # dhcpcd bnep0
 
Optionally, if you have [[NetworkManager]] installed and want it to automatically connect to the bnep0 interface, '''blacklist''' the interface in your rc.conf just as with the other interfaces you want to be automatically handled:
 
INTERFACES=(!eth0 !wlan0 '''!bnep0''' ...)
 
 
NetworkManager might still automatically connect to the new interface initially, but on subsequent boots the above action is necessary.
 
 
==== KDE ====
 
To be added...
 
  
 
==== netcfg ====
 
==== netcfg ====
Line 64: Line 84:
  
 
Then,  either as root or using sudo,  execute:
 
Then,  either as root or using sudo,  execute:
 
+
# netcfg tether
  netcfg tether
+
  
 
To bring the interface down and un-tether:
 
To bring the interface down and un-tether:
 
+
# netcfg down tether
  netcfg down tether
+
 
+
== Tethering over USB ==
+
You need '''aur/itunnel''' and '''aur/ifuse''' to do so.
+
 
+
Then follow up http://dev.squarecows.com/2009/05/06/iphone-linux-tethering-via-usb-cable/
+
 
+
 
+
=== USB tethering from within Windows guest in Virtualbox ===
+
One potential way to accomplish this is to use a Windows guest in [[VirtualBox]], and present the host Arch system with a network interface (Host Only?). The working iPhone network device in Windows might then be bridged to the host only interface device within Windows. The iPhone USB network driver is installed together with iTunes. However, this has yet to be tested successfully. More info to come.
+
 
+
== Tethering via USB with libimobiledevice: Native Support==
+
{{Note|This section needs to be reviewed for style}}
+
 
+
With the release of libimobiledevice it's now possible to natively tether the iPhone 3G and 3GS with firmware 3.0 or superior (Not tested with 4.0, now in developer release).
+
 
+
=== Requirements ===
+
*'''In the iPhone:''' Enable tethering
+
*'''In your computer:''' Install usbmuxd
+
*'''In your computer:''' Install libimobiledevice (previously libiphone)
+
*'''In your computer:''' Install The iPhone Ethernet Driver (ipheth)
+
 
+
Though there are packages for all of these, the usbmuxd is the only requirement  recommended to install from arch. Both libimobiledevice and ipheth are recommended to install from the [[git]].
+
 
+
==== Enable tethering in the iPhone ====
+
If your carrier hasn't already enabled tethering you can do it by:
+
*Using blackra1n tu unlock your iPhone http://blackra1n.com/
+
*Installing a carrier update (a new .ipcc) more instructions in http://gizmodo.com/5175391/how-to-enable-3g-tethering-in-your-iphone-30-now
+
All of these methods are really easy to find in google. Notice that the 3rd method will just work in fw inferior to 3.1.2, following that you'll first need to use Blackra1n
+
 
+
 
+
 
+
==== Installing usbmuxd ====
+
You can easily install it with [[yaourt]] or [[clyde]]:
+
 
+
$ yaourt -S usbmuxd
+
 
+
# clyde -S usbmuxd
+
 
+
==== Installing libimobiledevice ====
+
You can get libimobile device from MCoyler site at github http://github.com/mcolyer
+
 
+
To get the source and install run the following commands. This should be pretty much straight forward
+
 
+
# git clone git://github.com/mcolyer/libiphone.git
+
# cd libiphone
+
# ./autogen.sh
+
# make
+
 
+
As always check there are no errors so far; if everything looks good you are ready to install
+
 
+
# sudo make install
+
 
+
==== Install ipheth ====
+
 
+
The following section is based in the tutorial available here http://giagio.com/wiki/moin.cgi/iPhoneEthernetDriver
+
 
+
Again we will be getting a git repository, but this install is divided in two sections. Install the kernel module, and installing the pairing program.
+
 
+
Remember that this depends on libimobiledevice and usbmuxd, so install those first.
+
 
+
'''Since 2.6.34 kernel (available in testing repo) ipheth module is already in kernel, so everything you need is [http://aur.archlinux.org/packages.php?ID=37584 ipheth-utils] pkg from AUR.'''
+
 
+
If you are using 2.6.33 kernel or earlier the right way is described below:
+
 
+
# git clone git://github.com/dgiagio/ipheth.git
+
 
+
Now we are good to install the Kernel Module.
+
 
+
# cd ipheth/ipheth-driver
+
# make
+
 
+
If there are no errors you can load the module
+
# sudo insmod ipheth.ko
+
 
+
Now plug your iPhone and run dmesg. It should give you something like the following:
+
# ...
+
# [ 8181.461000] ipheth 1-6:4.2: Apple iPhone USB Ethernet device attached
+
# [ 8181.463067] usbcore: registered new interface driver ipheth
+
# ...
+
 
+
If you have a hard time finding these lines run
+
 
+
# dmesg | grep ipheth
+
 
+
Now you should have a new network device, mine is called eth1 but it can be different. If you are ussing the NetworkManager Applet you should  see a wired network device called Apple iPhone.
+
 
+
Just one step to go. Installing the pairing program. You will have to run this program every time you plug your iPhone, I really don't know why but otherwise it won't work.
+
 
+
# cd ipheth/ipheth-pair
+
# make
+
# sudo make install
+
 
+
This will install '''ipheth-pair''' (the pairing program) in /lib/udev/ipheth-pair Not the most practical location since it's not in your PATH. With you iPhone plugged rud
+
 
+
# /lib/udev/ipheth-pair
+
 
+
If you don't get any errors you should now be able to connect to tether your iPhone with NetworkManager
+
 
+
You can also use [http://aur.archlinux.org/packages.php?ID=34953 ipheth-git] from AUR.
+
 
+
=== Trouble shooting ===
+
 
+
==== iPhone not appearing in the devices list ====
+
If you can't see the device in dmesg or in the NetworkManager device list you probably didn't reload the module. Just run:
+
 
+
# sudo insmod ipheth.ko
+
 
+
You can also add the module to rc.conf just
+
 
+
# cd ipheth/ipheth-driver
+
# make clean
+
# make
+
# sudo make install
+
 
+
and then edit the [b]rc.conf[/b] since it's still in a beta stage I don't recommend this, but if it works for you there shouldn't be trouble.
+
 
+
==== The iPhone appears in the device list but it doesn't connect ====
+
Did you pair the iPhone? run
+
 
+
# /lib/udev/ipheth-pair
+
 
+
Now you should be able to connect
+
 
+
==== You run ipheth-pair but it returns there's no libimobiledevice ====
+
 
+
If you get this error
+
 
+
# ./ipheth-pair: error while loading shared libraries: libimobiledevice.so.1: cannot open shared object file: No such file or directory
+
 
+
You can solve it by running
+
 
+
# sudo ln -s /usr/local/lib/libimobiledevice.so.1.0.0 /usr/lib/libimobiledevice.so.1
+
 
+
== Sources ==
+
# [http://jkeating.livejournal.com/75270.html jkeating: Tethering iPhone 3.0 with Linux (Fedora 11) over bluetooth]
+
# http://www.libimobiledevice.org/
+
# http://giagio.com/wiki/moin.cgi/iPhoneEthernetDriver
+
# http://github.com/mcolyer/libiphone
+
 
+
== TroubleShooting ==
+
* If you get "interface bnep0 does not exist" when trying tethering, you must enable "tethering" in the iPhone :<br>
+
See http://informationmadness.com/cms/blog/25-blog/1531-iphone-3g-s-tethering-without-installing-anything.html if you are stuck.<br>
+
sputnick, Thu apr 1 2010.
+
 
+
* If your iPhone stopped showing in NetworkManager after installing 2.6.34 kernel remove ipheth from kernel
+
 
+
# sudo rmmod ipheth
+
 
+
and than install ipheth-git from AUR.
+
This will compile old kernel module, which is detected fine.
+
 
+
--[[User:Blasse|Blasse]] 05:49, 30 May 2010 (EDT)
+

Revision as of 04:39, 19 September 2012

Unless disabled by your provider, it's possible to share your iPhone's 3G data connection over WiFi, USB and Bluetooth without needing to jailbreak. WiFi requires no additional configuration provided your computer can connect to wireless networks, and you'll find instructions for USB and Bluetooth below.

Tethering over USB

Tethering over USB using Personal Hotspot

Tethering natively over USB is the optimal choice as it provides a more stable connection and uses less batteries than bluetooth or wifi.

To tether your iPhone over USB, you'll need the following packages installed:

# pacman -S usbmuxd libimobiledevice ifuse

Then ensure the ipheth module is loaded (currently included in the default and LTS Archlinux kernels)

# modprobe ipheth

Assuming everything's gone smoothly so far, enable Personal Hotspot on your iPhone and plug it into your computer. At this point you'll have a new ethernet device available, but connecting through it might not work quite yet; for some reason, the ipheth module only works when the iPhone's filesystem has been mounted by ifuse, so unless your system did it automatically when you plugged your iPhone in, you'll need to do it manually:

# ifuse /path/to/mountpoint

To manually unmount it later, run:

# fusermount -u /path/to/mountpoint

Once your iPhone's filesystem is mounted, you should be able to use netcfg, NetworkManager, wicd, dhcpcd etc to connect to the internet through the new iPhone ethernet device just like you would any other ethernet connection.

Troubleshooting

The iPhone appears in the device list but it doesn't connect

Its possible that you may need to connect your iPhone and pair it with your computer before connecting in some circumstances (iPhones using a PIN unlock?):

# idevicepair pair

Tethering over USB using SSH and itunnel

You'll need aur/itunnel and community/ifuse before following these instructions: http://dev.squarecows.com/2009/05/06/iphone-linux-tethering-via-usb-cable/

Tethering over USB from within a Windows guest in Virtualbox

One potential way to accomplish this is to use a Windows guest in VirtualBox, and present the host Arch system with a network interface (Host Only?). The working iPhone network device in Windows might then be bridged to the host only interface device within Windows. The iPhone USB network driver is installed together with iTunes. However, this has yet to be tested successfully. More info to come.

Tethering over Bluetooth

Tethering over Bluetooth will drain the batteries relatively quickly, but simultaneous charging from an USB port works well.

Hardware Requirements

  • iPhone running OS 3.0 with tethering enabled. See Settings > General > Network and turn on the tethering option.
  • Bluetooth Adapter or similar, preferably with EDR(Enhanced Data Rate) for acceptable speeds. Tested with a Belkin F8T016NE.

Setup

From the article entitled Bluetooth:

To use Bluetooth, the bluez package for the Linux Bluetooth protocol stack must be installed:

# pacman -S bluez

Once bluez is installed, both the dbus daemon and the bluetooth daemon must be running:

# /etc/rc.d/dbus start
# /etc/rc.d/bluetooth start

The dbus daemon is used to read settings and for pin pairing, while the bluetooth daemon is required for the Bluetooth protocol. It is important that dbus is started before bluetooth. If dbus was not running when bluetooth was started, then try (after dbus is running):

# /etc/rc.d/bluetooth restart

To start bluetooth automatically on boot, add bluetooth to your daemons array in rc.conf:

DAEMONS=(... bluetooth ...)

No further configuration seems to be necessary on Arch systems. If problems arise, see the first sources link for possible config file edits.

Gnome/XFCE

Install the Blueman GTK+ Bluetooth manager

# pacman -S blueman

A Bluetooth icon should appear in your notification area. Note: the icon may not appear if bluetooth was not turned on at startup. Click it, and search for nearby devices, adding your iPhone (note, you may need to have the Bluetooth setting screen up on your iPhone for discovery to work).

Once the iPhone has been added to the devices list, open the Device menu and select pair. This will require the usual entering of a PIN on the computer then the iPhone. Now open the Device menu again, and choose Network Access > Network Access Point. If everything goes well, blueman reports a success and the status bar on your iPhone should glow blue, indicating a successful tether.

Blueman will have created a new network interface, typically bnep0. To connect to it, run the following as root.

# dhcpcd bnep0

netcfg

Alternatively, you can create a netcfg network profile to allow easy tethering from the command line, without requiring Blueman or Gnome. Assuming an already paired iPhone with address '00:00:DE:AD:BE:EF', simply create a profile in /etc/network.d called - for example - 'tether':

 CONNECTION="ethernet"
 DESCRIPTION="Ethernet via pand tethering to iPhone"
 INTERFACE="bnep0"
 IPHONE="00:00:DE:AD:BE:EF"
 PRE_UP="pand -E -S -c ${IPHONE} -e ${INTERFACE} -n 2>/dev/null"
 POST_DOWN="pand -k ${IPHONE}"
 IP="dhcp"

Then, either as root or using sudo, execute:

# netcfg tether

To bring the interface down and un-tether:

# netcfg down tether