Android reverse tethering on linux

In this guide i will a demonstrate a way to connect your android phone to the internet using just the usb cable. This will only work on rooted phones with a terminal emulator installed.

Step 1:
Connect your android phone to the linux box via USB and then go to Settings > Wireless & networks > Tethering & portable hotspot and enable USB tethering.

Step 2:
Disable any wi-fi or 3g connection from your android phone.

Step 3:
On your linux box, run the following command as root.

ifconfig usb0 192.168.42.135 up

Step 4:
Install and run a firewall program called firestarter and enable internet connection sharing for usb0 as shown below.

Step 5:
Run your android terminal emulator and execute the following commands.

su
ifconfig usb0 192.168.42.130 up
busybox ifconfig usb0 192.168.42.130 up
route add -net default gw 192.168.42.135 usb0
busybox route add -net default gw 192.168.42.135 usb0

Step 6:
Enjoy!

Share on FacebookTweet about this on TwitterShare on Google+Share on StumbleUponShare on RedditShare on TumblrShare on LinkedInEmail this to someone
  • Sudarshan Kondgekar

    It is not working on my Galaxy Tab 2 7 inch. I this showing

    ifconfig: SIOCSIFADDR: No such device
    I am eager to know how to do this please reply

    • When you enabled usb tethering, a new network interface should have appeared to your device. Try running “busybox ifconfig -a” to view all the available network interfaces

      • Sudarshan Kondgekar

        This is what I got after running

        app_24@android:/ $ su

        app_24@android:/ # busybox ifconfig -a

        ifb0 Link encap:Ethernet HWaddr 32:41:5D:74:7E:77

        BROADCAST NOARP 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:32

        RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

        ifb1 Link encap:Ethernet HWaddr 2E:CF:CA:21:E0:DE

        BROADCAST NOARP 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:32

        RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

        ip6tnl0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00

        NOARP MTU:1452 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:0

        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:950 errors:0 dropped:0 overruns:0 frame:0

        TX packets:950 errors:0 dropped:0 overruns:0 carrier:0

        collisions:0 txqueuelen:0

        RX bytes:79042 (77.1 KiB) TX bytes:79042 (77.1 KiB)

        rmnet0 Link encap:Point-to-Point Protocol

        POINTOPOINT NOARP MULTICAST MTU:1500 Metric:1

        RX packets:78864 errors:0 dropped:0 overruns:0 frame:0

        TX packets:79738 errors:0 dropped:0 overruns:0 carrier:0

        collisions:0 txqueuelen:1000

        RX bytes:52230432 (49.8 MiB) TX bytes:7700058 (7.3 MiB)

        rmnet1 Link encap:Point-to-Point Protocol

        POINTOPOINT NOARP 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)

        rmnet2 Link encap:Point-to-Point Protocol

        POINTOPOINT NOARP 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)

        rndis0 Link encap:Ethernet HWaddr EE:B0:15:7E:9A:A8

        inet addr:192.168.42.129 Bcast:192.168.42.255 Mask:255.255.255.0

        inet6 addr: fe80::ecb0:15ff:fe7e:9aa8/64 Scope:Link

        UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

        RX packets:40 errors:0 dropped:0 overruns:0 frame:0

        TX packets:19 errors:0 dropped:0 overruns:0 carrier:0

        collisions:0 txqueuelen:1000

        RX bytes:7795 (7.6 KiB) TX bytes:2608 (2.5 KiB)

        sit0 Link encap:IPv6-in-IPv4

        NOARP MTU:1480 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:0

        RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

        What to do next.

        • I dont see any usb related interface. USB tethering is not enabled to your device. Try repeating all the steps again

        • Adil Ali

          Try using rndis0 instead of usb0

  • Tom Mort

    I am trying this with my Linux Mint 15 computer and my rooted HTC Thunderbolt running NuSenseROMv6.

    Your instructions say “go to Settings > Wireless & networks > Tethering & portable hotspot and enable USB tethering”

    When I go to that menu on my phone these are my options for connection type:

    Charge Only

    Disk Drive

    HTC Sync

    Internet Connection Mode

    Media Sync

    Internet Pass Through

    If I select “Internet Connection Mode” and run ifconfig usb0 192.168.42.135 up, in the terminal on the computer I get:

    SIOCSIFADDR: No such device

    usb0: ERROR while getting interface flags: No such device

    usb0: ERROR while getting interface flags: No such device

    if I then do a lsusb I get:

    ls: cannot access usb: No such file or directory

    If then in the terminal on the computer I run busybox ifconfig -a, I get:

    eth0 Link encap:Ethernet HWaddr 00:1C:25:92:0E:61

    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)

    Interrupt:18

    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:65536 Metric:1

    RX packets:130036 errors:0 dropped:0 overruns:0 frame:0

    TX packets:130036 errors:0 dropped:0 overruns:0 carrier:0

    collisions:0 txqueuelen:0

    RX bytes:847999045 (808.7 MiB) TX bytes:847999045 (808.7 MiB)

    wlan0 Link encap:Ethernet HWaddr 00:21:5C:15:C9:AD

    inet addr:10.0.0.9 Bcast:10.0.0.255 Mask:255.255.255.0

    inet6 addr: fe80::221:5cff:fe15:c9ad/64 Scope:Link

    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

    RX packets:1696862 errors:0 dropped:0 overruns:0 frame:0

    TX packets:1754443 errors:0 dropped:0 overruns:0 carrier:0

    collisions:0 txqueuelen:1000

    RX bytes:1277641967 (1.1 GiB) TX bytes:629026526 (599.8 MiB)

    If I then try the “Internet Pass Through” connection option and run ifconfig usb0 192.168.42.135 up, I get:

    SIOCSIFADDR: No such device

    usb0: ERROR while getting interface flags: No such device

    usb0: ERROR while getting interface flags: No such device

    If I then run ls usb I get:

    ls: cannot access usb: No such file or directory

    Then if I try busybox ifconfig -a, I get:

    eth0 Link encap:Ethernet HWaddr 00:1C:25:92:0E:61

    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)

    Interrupt:18

    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:65536 Metric:1

    RX packets:130287 errors:0 dropped:0 overruns:0 frame:0

    TX packets:130287 errors:0 dropped:0 overruns:0 carrier:0

    collisions:0 txqueuelen:0

    RX bytes:848027616 (808.7 MiB) TX bytes:848027616 (808.7 MiB)

    wlan0 Link encap:Ethernet HWaddr 00:21:5C:15:C9:AD

    inet addr:10.0.0.9 Bcast:10.0.0.255 Mask:255.255.255.0

    inet6 addr: fe80::221:5cff:fe15:c9ad/64 Scope:Link

    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

    RX packets:1705593 errors:0 dropped:0 overruns:0 frame:0

    TX packets:1764597 errors:0 dropped:0 overruns:0 carrier:0

    collisions:0 txqueuelen:1000

    RX bytes:1281747790 (1.1 GiB) TX bytes:633975425 (604.6 MiB)

    I’m running the busybox command on the Linux terminal.

    Any suggestions?