What I did so far:
i followed the great USB tethering guide and had great success setting it up with my Android 14 based phone, works like a charm. However when using my iPhone I have a strange issue.
The issue:
The phone seems to connect fine, but I cannot see the network interface it should provide. As far as I have understood the USB tethering guide the iPhone will not show up as "usb0" (like my Android phone does) but should show up as ethX (with X beeing some number). But I have tried to assign wan and wan6 to eth0 and eth1 with no luck (when assigning wan to usb0 connectioon worked immediately, leading me to think that eth0 and eth1 are in this case the two NICs that are built into my router HW).
Background context:
I am running openWRT 23.05 on my GL-MT3000 HW.
I have installed all necessary packages and setup the watchdog script etc. according to the USB tethering guide on the wiki.
I am using an iPhone 11, running iOS 17.4.1, connected via a known good (charging and data) USB-A to lightning cable.
[ 7.958091] usbcore: registered new interface driver ipheth
[ 15.299568] ipheth 1-1:4.2: Apple iPhone USB Ethernet device attached
system log excerpt:
Tue May 21 15:29:40 2024 kern.info kernel: [ 4.473544] usb 1-1: new high-speed USB device number 2 using xhci-mtk
Tue May 21 15:29:44 2024 daemon.err usbmuxd[2163]: [15:29:44.590][3] Connecting to new device on location 0x10002 as ID 1
Tue May 21 15:29:44 2024 daemon.err usbmuxd[2163]: [15:29:44.591][3] Connected to v2.0 device 1 on location 0x10002 with serial number YYYYYYYY-XXXXXXXXXXXXXXXX
Tue May 21 15:29:44 2024 kern.info kernel: [ 15.299568] ipheth 1-1:4.2: Apple iPhone USB Ethernet device attached
If further logs are needed, please say so, I will try to do my best to provide them!
After running ls /sys/class/net/ and discovering the "eth2" interface (which did not show up with ifconfig, I don't know why), I think this is the iPhone's ethernet interface, as running cat /sys/class/net/eth2/device/interface returns AppleUSBEthernet. However, when creating a new WAN interface via the web interface and assigning it to eth2, it does still not work (I did it the same way as I did with usb0 with the Android, which worked, so the config should be fine?). After setting it up, a few packets get sent, as below image shows .
However an Internet connection / ping is still not working. Maybe this is a config problem afterall and I am just too foolish to see my error?
I also just saw that the iPhone says "1 Connection" below the icon of "Personal Hotspot" in the quick settings menu (swipe down from the right top corner). This indicates to me that the basic connection between openWRT and the iPhone works now, as I don't have any other devices connected. This leads me to think that this is a configuration issue of some sorts. I therefore created two new blank interfaces via the web GUI, one for my android, one for the iPhone. I set both up completely identical apart from the network interface referenced (usb0 for android, eth2 for iPhone). The android config works fine, iPhone still does not work (nslookup and ping not working).
Did you follow all the additional steps iOS devices require?
e.g.
For iPhones, you may have to disable and re-enable the Personal Hotspot/Allow Others to Join setting on the iPhone to force the OpenWrt DHCP client to get an IP address from the eth1 iPhone interface. Disabling and re-enabling the Personal Hotspot/Allow Others to Join setting on the iPhone is also required if you disconnect the iPhone from the OpenWrt USB port and re-connect it later, unless you cache Trust records (see watchdog section and/or LeJeko's Github repository in reference section).
iPhones starting from iOS 11 will terminate the USB data connections after one hour by default to improve security. This can easily be changed via:
Settings > Touch ID/Face ID & Passcode > USB Accessories > ON (macworld)
Yes I did and eventually I got it working. It sometimes works and sometimes doesn't. Don't know what the problem could be but trying to find out to get it working more stable.
It look like it also has something to do with cable and power supply but can't say for sure.
Just to update. My "solution" is to just not use an iPhone for USB-Tethering as Android works great without any hassle. I am not marking this thread as solved, as this is not a real solution, just wanted to let everyone reading this know that I never got the iPhone to work as nicely as the Android and that they should probably expect to experience similar things.
After putting this in scheduled task using * * * * * /root/wan-watchdog.sh then every minute my connection goes down, signal is lost and modem restarts.
After disabling this scheduled task everything stays connected and works without problems.
Why does this script not work as it should and do I need this script?