Friday, 10 July 2009

iPhone Tethering Notes for Ubuntu Vancouver LoCo

I gave a lightning talk at the Ubuntu Vancouver Local Committee July 9, 2009 on accessing the Internet from an Ubuntu computer through the iPhone.
  • Use the instructions from the Ubuntu forums here. This other page gives the underlying commands used by the script from the Ubuntu forum. You may find it helpful if the script doesn't work for you.
  • During installation, when you're asked to make the iPhone discoverable, go to Settings-> General-> Bluetooth and turn on Bluetooth.
  • Part way through the instructions in the Ubuntu forum you're asked to "pair" your iPhone with the computer. To "pair" your iPhone with your computer:
  1. Click on the blue icon with white triangles that you'll find amount the other notification icons, typically in the upper-right corner of your screen.
  2. Select "Set up new device..."
  3. Click "Forward".
  4. Wait for your iPhone to appear in the list. If it doesn't, go back to Settings-> General-> Bluetooth on the iPhone and make sure Bluetooth is on. Also, make sure your iPhone is less than a 1/2 metre from your computer.
  5. Select your iPhone in the list and click "Forward".
  6. Ubuntu will show you a four-digit code and ask you to enter it on the device. The iPhone will have a keypad showing. Enter the code.
  7. Ubuntu will ask if you want to allow the connection. Select "Always allow" and click "OK".
  8. You're now paired.
  • Before trying to tether your computer to the iPhone, go back to Settings-> General-> Bluetooth. Your computer's name with "-0" appended should appear below the on/off button. If it says "Not connected" beside your computer's name, click on the computer name and wait for it to change to "Connected".
  • Using Network Manager, turn off other network connections you may have running before tethering.
  • Finally, before running the script, don't forget to turn on Internet Tethering on the iPhone. Go to Settings-> General-> Network-> Internet Tethering and turn Internet Tethering on.
  • Keep the iPhone with 1/2 metre of your computer. (You can try more, but I suspect that the flaky connection I sometimes experience may be associated with the distance between the phone and the computer.)
  • After running the script, you still won't be able to browse the Internet. (You don't have any usable DNS servers defined on your computer.) Do the following in a terminal:
sudo cat >>/etc/resolv.conf <<-END nameserver 208.67.220.220 nameserver 208.67.222.222 END
  • I put the above in my uit.sh script at the appropriate place.
  • Remember to turn off Internet Tethering and Bluetooth on the iPhone when you're done.
  • Disconnect tethering on your computer by running: sudo ./uit.sh -d
  • Don't forget to reconnect your computer to your usual networks after you turn off tethering.
Troubleshooting
  • My experience is that you have to do everything in exactly the right order. If something goes wrong, do the following and then start over:
  1. On the iPhone, go to Settings-> General-> Network-> Internet Tethering and turn Internet Tethering off.
  2. On the iPhone, go to Settings-> General-> Network-> Bluetooth and turn Bluetooth off
  3. On your computer, run the disconnect script: sudo ./uit.sh -d
  4. On your computer, restart Bluetooth: sudo /etc/init.d/bluetooth restart
  • The Bluetooth connection seems to be unreliable. Sometimes I can browse a page or two and then it stops working. Sometimes it just doesn't connect at all. After two or three tries I usually get a reliable connection. Every time it fails, be sure to do all the steps in the above list.

1 comment:

Unknown said...

Karmic Koala (9.10) has new Bluetooth support using GNOME-BLUETOOTH. From what I hear, Bluetooth has essentially been broken since Intrepid, especially for USB bluetooth dongles. (Fedora 11 already has the new Bluetooth stack.)

More info here: http://live.gnome.org/GnomeBluetooth

Perhaps this will make tethering your iPhone easier/more reliable...