Android Reverse Tethering script
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


= About =

andreth is a basic _And_roid _re_verse te_th_ering script that will allow your
Android powered device to use the LAN connection of your linux box to connect to
the internet.

= Prerequisites =

You'll need
 * python 2.7
 * the Android SDK on your linux box[0]
   * a working adb setup[1]
 * the ability to execute commands as root on your machine[2]

You need to enable
 * USB debugging[3]
on your device.

= Usage =

$ sudo python -h
usage: [-h] [-l IP] [-r IP] [-i IFACE]

Reverse tethering over USB for your Android device

optional arguments:
  -h, --help            show this help message and exit
  -l IP, --local-ip IP  the IP on the host side of the PPP tunnel [default:
  -r IP, --remote-ip IP
                        the IP on the device side of the PPP tunnel [default:
  -i IFACE, --interface IFACE
                        the interface that provides the internet connection
                        [default: eth0]

= Notes =

 1.) andreth needs to be run as root in order to
      * enable/disable packet forwarding in the kernel
      * set up/tear down the firewall rules for NATting
      * create/destroy the PPP tunnel device

 2.) The local and remote IPs need to be unique in your networking
     environment. They don't have to be from the same subnet or lie within the
     same subnet as the interface providing the uplink. So I suggest you chose
     two IP addresses from an unused private subnet.

= Troubleshooting =

In case you don't get replies to your packages, you might wanna check the
firewall rules on your linux box. cf [6].

= Disclaimer =

I stole the information on how to make Android use reverse tethering over USB
from xda developers[4] and wrapped them in this small script. All props to them.

In addition, I borrowed the syntax to teach iptables NATting rules from
freyo[6]. Thx to him as well.

= More Information =

In case this script is too basic for your needs, you can find more information

Obviously, I would be glad if you forked this project, patched the script and
sent me merge requests so everyone may profit from your enhancements. Thx.

[1] cf
    for the 'no permissions' problem
[2] for setting up the tunnel device
[3] so andreth can configure it via the USB connection