Sunday, November 2, 2008

Thether Ubuntu using an iPhone and PDANet

Tethering a netbook with a smartphone like the iPhone 3G sound like a great way to be connected 'on the road'. On a jailbroken iPhone, PDANet can share your celular data connection over Wi-fi. This isn't as simple as it seems however, it took me a while to get this figured out to work, but now finally it does on my Aspire One running Ubuntu Intrepid (8.10).

First of all, your Wi-Fi driver needs to support ad-hoc mode. On my Aspire One, Ubuntu 8.04 did not, for some reason. Upgrading to 8.10 (Intrepid) also brought me a new Atheros driver (ath5k), which does support ad-hoc mode, which can be verified with the following command:
# iwconfig wlan0 mode ad-hoc

This should not return any errors (if your root, that is). The old driver responded with something like "command not supported".

If it does, chances are you should be able to connect your computer and iPhone using an ad-hoc connection, which is required for PDANet to function. You should follow these steps:
  1. Remove ALL working wi-fi connections on your iPhone (forget this network for all that the iPhone can connect to where you are while using PDANet)
  2. Remove ALL wi-fi connections on your Computer
  3. Execute the following commands (as root) in a command-line on your computer:
    # iwconfig wlan0 mode ad-hoc

    # iwconfig wlan0 essid pdanet
  4. Go to wi-fi settings on you iPhone and connect to the pdanet network
  5. Start PDANet on your iPhone.
  6. If PDANet instructs you to go to wireless settings and connect to the network created on your computer execute the follow command again:
    # iwconfig wlan0 essid pdanet
  7. PDANet should come up with Computer Connected! and show the MAC address and other stuff related to your computer.
Step 1 and 2 seem to be key here, either my iPhone and netbook seemed to refuse to connect to the ad-hoc network when another (infrastructure) network that it was allowed/configured to connect to was availlable.

YMMV, but let me know if you had any success with this..

update: find instructions for Windows and Mac OSX at the iphone 2.0 blog.

No comments: