Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

google/vpn-reverse-tether

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
jni
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

VPN-based USB "reverse tether"

Reverse tethering routes traffic from the device via host gateway over USB. This allows the Android device to access the network through the host without depending on Wifi or Bluetooth.

This method leverages VpnService API and does not require root access.

Technical details

+-----------------------+                  +------------------------+
|    Android Device     |                  |       Linux Host       |
|-----------------------|                  |------------------------|
|                       | Android          |                        |
|         ^ iptables    | VpnService       |          ^ iptables    |
|         |             |                  |          |             |
|     +--------+        |                  |      +--------+        |
|     |  tun   |  ---------                |      |  tun   |  ---------
|     +--------+        |  \               |      +--------+        |  \
|         ^             |                  |          ^             |
|         | forward()   | TetherService    |          | forward()   | forwarder
|         v             |                  |          v             |
|    +----------+       |  /               |   +---------------+    |  /
|    | unix sock| ---------                |   | TCP/unix sock | ------
|    +----------+       |                  |   +---------------+    |
|         |             |                  |          |             |
|         |             |                  |          |             |
|     +--------+        |                  |      +--------+        |
|     |  adbd  |        |                  |      |  adb   |        |
|     +--------+        |                  |      +--------+        |
|         +             |                  |          +             |
|         |             |                  |          |             |
+---------|-------------+                  +----------|-------------+
          |                                           |
          |                                           |
          |     adb forward XXX localabstract:YYY     |
          +-------------------------------------------+

Installation

ant

  1. Get Android SDK and NDK. Using the SDK manager, get build tools.

  2. Build the native library:

     $(ANDROID_NDK)/ndk-build
    
  3. Build the apk and install it:

     ANDROID_HOME=$(ANDROID_SDK) ant debug install
    
  4. Build the host-side forwarder:

     make -C jni
    

Eclipse

  1. Get Android Development Tools and Android Native Development Tools.

  2. Import existing project into workspace and build.

  3. Build the host-side forwarder:

     make -C jni
    

Usage

  1. Start the VPN service:

     ./run.sh setup  # You will be asked for sudo password.
    

    Wait for the alert dialog.

  2. Start the tunnel:

     ./run.sh run  # You will be asked for sudo password.
    

    You should see a key icon in the status bar.

  3. When done, press Enter to stop the tether.

License

See LICENSE.

About

VPN-based USB "reverse tether"

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published