/gnirehtet

Gnirehtet provides reverse tethering for Android

Primary LanguageJavaApache License 2.0Apache-2.0

Gnirehtet

This project provides reverse tethering over adb for Android: it allows devices to use the internet connection of the computer they are plugged on. It does not require any root access (neither on the device nor on the computer). It works on GNU/Linux, Windows and Mac OS.

Currently, it relays TCP and UDP over IPv4 traffic, but it does not support IPv6 (yet?).

Requirements

The Android application requires at least API 21 (Android 5.0).

Java 8 is required on your computer. On Debian-based distros, install the package openjdk-8-jre.

You need a recent version of adb (where adb reverse is implemented, it works with 1.0.36). On Debian-based distros, check for android-tools-adb or adb.

Make sure you enabled adb debugging on your device(s).

Download

Download the latest release:

gnirehtet-v1.0.1.zip (SHA-256: 18ed1f892cf924febe22d2e902bed7a6826684c1ac49bfaeebf2f63fc580a805)

Then extract it. You get three files:

  • gnirehtet
  • gnirehtet.apk
  • relay.jar

Run (simple)

The application has no UI, and is intended to be controlled from the computer only.

If you want to activate reverse tethering for exactly one device, just execute:

./gnirehtet rt

Reverse tethering remains active until you press Ctrl+C.

The very first start should open a popup to request permission:

request

A "key" logo appears in the status bar whenever Gnirehtet is active:

key

Run

You can execute the actions separately (it may be useful if you want to reverse tether several devices simultaneously).

Start the relay server and keep it open:

./gnirehtet relay

Install the apk on your Android device:

./gnirehtet install [serial]

In another terminal, for each client, execute:

./gnirehtet start [serial]

To stop a client:

./gnirehtet stop [serial]

The serial parameter is required only if adb devices outputs more than one device.

For advanced options, call ./gnirehtet without arguments to get more details.

On Windows

Since the gnirehtet script is written in Bash, it's a bit more complicated on Windows. If you are using Windows, then you have several choices:

  • execute some commands manually;
  • run bash (using cygwin or gitbash);
  • contribute a new script gnirehtet.bat for Windows.

Run manually

The gnirehtet script just exposes an interface for calling simple commands. You can call them manually (especially if you use Windows, in that case, replace adb by adb.exe).

To start the relay server:

java -jar relay.jar

To install the apk:

adb install -r gnirehtet.apk

To start a client:

adb reverse tcp:31416 tcp:31416
adb shell am startservice -a com.genymobile.gnirehtet.START

To stop a client:

adb shell am startservice -a com.genymobile.gnirehtet.STOP

Why gnirehtet?

rev <<< tethering

(in Bash)

Developers

Read the developers page.

Licence

Copyright (C) 2017 Genymobile

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Our blog posts introducing gnirehtet