iPhone Hotspot USB tethering to TrueOS Laptop


#1

So I had a pretty awful weekend with my atheros wifi NIC not working after last stable update. I was in a hotel room with no wired options so I was kind of dead in the water. So I started messing around with my iPhone and USB tethering and got it to work. The process I went through to get it working is ugly. I’ve informed some of the TrueOS developers about this and they’ll be working with me to find a more automated and less painful solution to accomplish this same thing. Until then I thought I’d post what I have in case somebody else finds themselves in a pinch like I was.

PRELIMINARY STEPS
Make sure /etc/network.subr exists
if not then search this forum for network.subr

Load the iphone ethernet driver (you can also do this via /boot/loader.conf. Check the handbook)
kldload if_ipheth

Make a copy of your network ethernet service
sudo cp /etc/init.d/network.em0 /etc/init.d/network.ue0

Plug in the iphone then do the following command
where x.x corresponds to the device id in /var/log/dmesg
(search the file for Apple) For me it was ugen0.2 in dmesg. This command
makes the device visible to the OS in /dev.
usbconfig -d 0.2 set_config 3

Turn on hotspot on the iphone and trust the computer
then turn hotspot off again…

Check to see if the device is now available via ifconfig
At this point I have a new device in ifconfig called ue0

Next we add the gateway ip of iphone. I’ve read that the subnet
for iphones are supposed to be 172.20.10.xxx and they have 16 addresses
available. I happened to have my wife’s macbook with me so I checked to see
what the gateway was there and I used that address. Not sure why the last digit is
6 and not 1, but I went with the flow here
sudo route add default 172.20.10.6

Start network service
sudo service network.ue0 start

Turn on hotspot on the iphone
Start dhcp client on TrueOS
sudo dhcpcd ue0

So there it is in all it’s ugly glory. Hopefully in the next few weeks we can find a nicer solution to this. I’ll
update this post when we do.


TrueOS Tips, Tricks, and FAQ
#2

I also put a link in the “Tricks and Tips” section pointing to this as well


#3

Yep I saw that thanks! I cleaned up the markup a little so it’s easier to read.


#4