USB Tether to iPhone from Linux

Once you connect your iPhone to the Linux host with a USB cable, you should get the usual Trust dialog, tap Trust, otherwise, the Linux host won’t be able to communicate with the iPhone via the USB cable.

After you trust the iPhone check the dmesg log for evidence of the iPhone being detected by the computer

[ 4670.866484] usb 1-2: new high-speed USB device number 6 using xhci_hcd
[ 4671.009493] usb 1-2: New USB device found, idVendor=05ac, idProduct=12a8, bcdDevice=11.02
[ 4671.009498] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4671.009502] usb 1-2: Product: iPhone
[ 4671.009505] usb 1-2: Manufacturer: Apple Inc.
[ 4671.009508] usb 1-2: SerialNumber:
[ 4671.039802] audit: type=1130 audit(1574722083.595:53): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=usbmuxd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[ 4671.065013] ipheth 1-2:4.2: Apple iPhone USB Ethernet device attached
[ 4671.065133] usbcore: registered new interface driver ipheth
[ 4671.073395] ipheth 1-2:4.2 enp0s20f0u2c4i2: renamed from eth0
[ 4676.306473] ucsi_acpi USBC000:00: PPM NOT RESPONDING

Umm.. enp0s20f0u2c4i2, okay, eth0 would have been fine, but you know… Or you can run ip link to find it.

$ ip link
...
3: enp0s20f0u2c4i2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000    link/ether 3a:53:9c:09:4f:de brd ff:ff:ff:ff:ff:ff

Now that the iPhone is linked with the computer, time to grab an IP address.

$ sudo dhclient enp0s20f0u2c4i2

No errors from dhclient let’s check if we got our IP address.

$ ip addr
...
5: enp0s20f0u2c4i2:  mtu 1500 qdisc fq_codel state UP group default qlen 1000
     link/ether 3a:53:9c:09:4f:de brd ff:ff:ff:ff:ff:ff
     inet 172.20.10.2/28 brd 172.20.10.15 scope global dynamic noprefixroute enp0s20f0u2c4i2
        valid_lft 84663sec preferred_lft 84663sec
     inet6 fe80::ac11:fcb6:de39:d9b5/64 scope link noprefixroute 
        valid_lft forever preferred_lft forever

Looks good. Let’s test connectivity with a simple ICMP Echo Request.

$ ping cormier.co
PING cormier.co (104.27.175.48) 56(84) bytes of data.
64 bytes from 104.27.175.48: icmp_seq=1 ttl=59 time=21.8 ms
64 bytes from 104.27.175.48: icmp_seq=2 ttl=59 time=27.6 ms  
64 bytes from 104.27.175.48: icmp_seq=3 ttl=59 time=28.5 ms  
64 bytes from 104.27.175.48: icmp_seq=4 ttl=59 time=22.4 ms^C
--- cormier.co ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms  
rtt min/avg/max/mdev = 21.831/25.060/28.464/2.973 ms

Dec 3rd, 2019 • Posted in Linux, Networking
No comments yet.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>