Difference between revisions of "IPhone tethering"

From ArchWiki
Jump to: navigation, search
(Tethering over USB using Personal Hotspot: fixed installation instructions, see Help:Style#Package management instructions)
m (Indigo moved page IPhone Tethering to IPhone tethering: apply sentence case Help:Style#Title)
 
(14 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
{{Lowercase_title}}
 
{{Lowercase_title}}
[[Category:Networking]]
+
[[Category:Network sharing]]
 
[[Category:Mobile devices]]
 
[[Category:Mobile devices]]
 +
[[ja:iPhone テザリング]]
 +
{{Related articles start}}
 +
{{Related|IPod}}
 +
{{Related articles end}}
 
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.
 
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.
  
Line 18: Line 22:
 
  # fusermount -u /path/to/mountpoint
 
  # fusermount -u /path/to/mountpoint
  
Once your iPhone's filesystem is mounted, you should be able to use any [[List of Applications#Network Managers|network manager]] to connect to the internet through the new iPhone ethernet device just like you would any other ethernet connection.
+
Once your iPhone's filesystem is mounted, you should be able to use any [[List of applications#Network Managers|network manager]] to connect to the internet through the new iPhone ethernet device just like you would any other ethernet connection.
  
==== Troubleshooting ====
+
==== Using systemd-networkd with udev ====
  
===== The iPhone appears in the device list but it doesn't connect =====
+
Using [[systemd-networkd]] you can simply adjust the networking to use the iphone as the gateway.
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
+
  
===== "Trust This Computer" Alert Loop =====
+
{{hc|/etc/udev/rules.d/90-iphone-tethering.rules|<nowiki>
 +
# Execute pairing program when appropriate
 +
ACTION=="add|remove", SUBSYSTEM=="net", ATTR{idVendor}=="05ac", ENV{ID_USB_DRIVER}=="ipheth", SYMLINK+="iphone", RUN+="/usr/bin/systemctl restart systemd-networkd.service"
 +
</nowiki>}}
  
At the time of this writing Feb 12, 2014, the library that enables this functionality, [https://github.com/libimobiledevice/libimobiledevice libimobiledevice] and/or [https://github.com/libimobiledevice/usbmuxd its dependencies] are not up to date on the AUR. The bug, however is fixed in the master branch and until the package maintainer updates the AUR packages, a [https://gist.github.com/keyvanfatehi/8922430 script has been made available for self-compilation of the required libraries under ArchLinux].
+
{{hc|/etc/systemd/network/enp0s26u1u2c4i2.network|<nowiki>
 +
[Match]
 +
Name=enp0s26u1u2c4i2
  
Alternatively, install {{AUR|usbmuxd-git}}, {{AUR|libimobiledevice-git}}, and {{AUR|ifuse-git}} from the [[Arch User Repository]].
+
[Network]
 +
DHCP=ipv4
 +
</nowiki>}}
  
=== Tethering over USB using SSH and itunnel ===
+
''enp0s26u1u2c4i2'' being the name of the network device that is created from the iphone.
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 ===
+
==== Troubleshooting ====
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.
+
 
 +
===== 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 Bluetooth ==
 
== Tethering over Bluetooth ==
Line 50: Line 61:
  
 
==== Gnome/XFCE ====
 
==== Gnome/XFCE ====
Install the [[Blueman]] GTK+ Bluetooth manager
+
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).
 
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).

Latest revision as of 16:50, 11 April 2016

Related articles

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 will need to install these packages: usbmuxd, libimobiledevice and 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 any network manager to connect to the internet through the new iPhone ethernet device just like you would any other ethernet connection.

Using systemd-networkd with udev

Using systemd-networkd you can simply adjust the networking to use the iphone as the gateway.

/etc/udev/rules.d/90-iphone-tethering.rules
# Execute pairing program when appropriate
ACTION=="add|remove", SUBSYSTEM=="net", ATTR{idVendor}=="05ac", ENV{ID_USB_DRIVER}=="ipheth", SYMLINK+="iphone", RUN+="/usr/bin/systemctl restart systemd-networkd.service"
/etc/systemd/network/enp0s26u1u2c4i2.network
[Match]
Name=enp0s26u1u2c4i2

[Network]
DHCP=ipv4

enp0s26u1u2c4i2 being the name of the network device that is created from the iphone.

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 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

See the main article Bluetooth and setup the bluetooth daemon.

Gnome/XFCE

Install the Blueman GTK+ Bluetooth manager.

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

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: netcfg has been superseded by netctl (Discuss in Talk:IPhone tethering#)

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