Wednesday, October 27, 2010

Tethering HTC Desire to Mandriva Linux 2010.1

The other day, I found myself in a situation where I needed to go online but there was no Wifi around. So I plugged my HTC Desire (Android 2.1) smartphone into my laptop running Mandriva Linux 2010.1 Spring and got tethering working. Here are the steps.

Preparation


While connected to a wired or Wifi Internet, install the dhcpcd package. As root user (or using sudo):
$ urpmi dhcpcd

It was also useful to install usbview.
$ urpmi usbview

Connecting the phone


First, connect to Mobile Internet from the phone (this must be done before plugging into laptop). Then plug the phone into the laptop using the USB cable and select the Internet sharing mode.

On the laptop, start usbview and confirm that Android Phone was shown.

As root user, start the usb0 interface:
$ ifconfig usb0 up
Check that it had really started the usb0 interface:
$ ifconfig usb0

Getting an address


Finally, on the laptop, obtain an address from the phone using:
$ dhcpcd usb0

When this command had completed, confirm that an IP address had been assigned using:
$ ifconfig usb0

After this, the laptop can get online using the HTC Desire phone as a gateway.