0x64746b / andreth

Android Reverse Tethering script

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

= 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 andreth.py -h
usage: andreth.py [-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:
                        192.168.55.51]
  -r IP, --remote-ip IP
                        the IP on the device side of the PPP tunnel [default:
                        192.168.55.52]
  -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
here[5][6].

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.


-----
[0] http://developer.android.com/sdk/index.html
[1] cf http://forum.xda-developers.com/showthread.php?t=640158
    for the 'no permissions' problem
[2] for setting up the tunnel device
[3] so andreth can configure it via the USB connection
[4] http://forum.xda-developers.com/showthread.php?t=835912
[5] http://blog.mycila.com/2010/06/reverse-usb-tethering-with-android-22.html
[6] http://www.xinotes.org/notes/note/1500/

About

Android Reverse Tethering script


Languages

Language:Python 100.0%