Tethering iPhone 3.0 to Ubuntu 9.04
June 17th, 2009So, I found myself with a copy of iPhone OS 3.0 a little ahead of the general release and felt the urge to get tethering working properly. (People who jailbreak have previously had the option of a few third-party products, the best known and easiest to use being PdaNet, also known as that software that wrought havoc upon the LCA 2009 wireless
.) It turns out to be pretty seamless on OS X (and apparently also on Windows), but of course, that doesn’t do an awful lot for me as an Ubuntu user.
The iPhone provides two options for tethering: USB and Bluetooth. The USB option looks promising, but is a bit beyond my knowledge of the USB subsystem: lsusb provides information on a configuration called PTP + Apple Mobile Device + Apple USB Ethernet with a couple of interfaces labelled Vendor Specific Class; someone with crazy USB hacking skills will probably get that turned into a network device in due course, I suspect.
That leaves Bluetooth. The iPhone uses Bluetooth Personal Area Networking The good news for lazy people like me is that NetworkManager support is in the works, but until then, it’s still not too painful, as people have been tethering to mobile devices using PAN for a while.
The tutorials I found generally covered other distributions or older versions of Ubuntu, so here’s the process for Jaunty. First the one-time configuration:
- Install the bluez-compat package.
- Edit /etc/default/bluetooth to add the following lines:
PAND_ENABLED=1 PAND_OPTIONS="--role=PANU"
- Restart the Bluetooth service: /etc/init.d/bluetooth restart
- Add the BNEP network adapter to the /etc/network/interfaces file by appending the following line: iface bnep0 inet dhcp
- Get the Bluetooth address of your phone by running hcitool scan and jotting down the address next to your phone’s name.
Now the bits and pieces that need to be done each time:
- Pair your computer with your iPhone. If you’re using GNOME, the standard Bluetooth applet can handle that; presumably that’s true of the other flavours of Ubuntu as well.
- To connect, run these commands in your favourite shell, replacing 00:aa:bb:cc:dd:ee with the Bluetooth address you jotted down earlier:
sudo pand --connect 00:aa:bb:cc:dd:ee -n sudo ifup bnep0
- At that point, life should be good and you should be connected. To disconnect later:
sudo ifdown bnep0 sudo pand -K
This seems to work rather well. The speed test results were noticeably better than they had been previously using the various ad-hoc network + jailbreak based solutions that I tried with iPhone 2.x; here at the office in sunny Osborne Park, I got about 850 kilobits down and 350 kilobits up (and a ping around 250 ms) on the notoriously crummy Optus 3G network, which is enough to actually be genuinely useful.
Thanks to InfoSec812 and wilbur.harvey (no relation!) for writing rather good tutorial posts on the Ubuntu Forums, which this howto is based on.