Home –  Android – Android Tethering: Using Android to access internet on your Linux machine

Android Tethering: Using Android to access internet on your Linux machine

Android tethering Linux

What is Android Tethering?

Android Tethering is a way to access internet on your computer with the help of your Android smartphone. USB and Wi-Fi access point tethering is natively supported from Android Froyo 2.2.

Android tethering Linux

USB tethering

For USB tethering you must have root access to the phone and a USB cable to connect your phone to computer.

Step 1: First of all you will have to enable USB debugging on your Android. Go to Settings -> Applications -> Development -> USB debugging and enable it. After enabling just reboot your phone.

Step 2: Connect your phone to computer using USB cable.

Step 3: Now enable tethering option from your phone. For this go to Settings -> Wireless & Networks -> Internet tethering and enable it.

Step 4: Open up terminal on your computer and run the command given below

chankey@linuxstall:$ ifconfig -a

The output will be like:

eth0      Link encap:Ethernet  HWaddr 40:61:86:B1:E9:33
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:480 (480.0 b)  TX bytes:480 (480.0 b)

usb0      Link encap:Ethernet  HWaddr C2:5A:11:8D:43:F5
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

usb0 is denoting your Android device. If you don’t see it then you will have to load the usbnet module and you can do that using modprobe command as:

chankey@linuxstall:$ modprobe usbnet

Step 5: Now to configure new network device via DHCP use the command given below:

chankey@linuxstall:$ ifconfig usb0 up && dhcpcd usb0

For configuring the new network device using iproute toolkit the command is:

chankey@linuxstall:$ ip link set usb0 up && dhcpcd usb0

For stopping the network sharing the command is:

chankey@linuxstall:$ dhcpcd -x usb0

 

Netcfg

You can use Netcfg to configure USB tethering, for that just add a static ethernet configuration like:

/etc/network.d/usb-tether

CONNECTION='ethernet'
DESCRIPTION='A basic dhcp ethernet connection using iproute'
INTERFACE='usb0'
IP='dhcp'

9 thoughts on “Android Tethering: Using Android to access internet on your Linux machine

  1. You don’t need to do any of this or need root access, i’ve had 3 android phones (hero, desire, galaxy SII) and I’ve never had to do any of this. Just plug it in and select USB tethering and it is recognised by ubuntu as an ethernet adapter.

    • You will need root access to the phone (for old Android versions, Froyo (Android 2.2) and beyond can do it natively). I agree that most Linux distros will recognize it automatically as soon as you enable USB tethering but there are some distros which will not do the same, in that case you will have to follow the steps given above.

    • asda

      ubuntu is not a real distro, just some toy that rarely works right and can’t be updated without destroying the system. just try do apt-get upgrade on a minimally customized system. it’s windows ME all over again.

  2. jamespcole

    Fair enough, did you add the bit to the start of the article about 2.2 or do I just suck at reading and comprehension(in which case apologies)

  3. jamespcole

    My bad, sorry, looks like i need to work on my reading skills. BTW cheers for the guide on the cinamon install trying it right now, pretty slick

  4. BTW the HTC Hero supported tethering since Android 1.5, hence why i was confused. I didn’t realise it was vendor specific before 2.2 because it seems all factory unlocked HTC’s(and some carrier locked ones) have supported tethering since 1.5 without rooting.

    http://insidesprintnow.files.wordpress.com/2009/09/hero_gsg.pdf

    Lol, had to look it up for my own piece of mind, i was sure i could remember tethering on my old Hero back in the day.

  5. MoFro

    I keep getting : “The program ‘dhcpcd’ can be found in the following packages:
    *dhcpcd
    *dhcpcd5

    Try: sudo apt-get install

    When I try sudo apt-get install dhcpcd i grt:
    Package dhcpcd is not available, but is referred by another package, or is only available from another source
    E: Package ‘dhcpcd’ has no installation canidate.
    And install dhcpcd5 is.
    E: Unable to locate package dhcpcd5

Leave a Reply

Your email address will not be published. Required fields are marked *