Gnirehtet API
gnirehtet is a tool used to enable reverse tethering on Android devices, allowing the device to share the computer's internet connection via USB. Below is the detailed usage of each command along with examples.
gnirehtet install [serial]
Description: Install the client on the specified Android device and exit. If multiple devices are connected, the serial parameter must be provided.
Example Usage:
gnirehtet installIf multiple devices are connected, specify the device:
gnirehtet install 1234567890ABCDEFgnirehtet uninstall [serial]
Description: Uninstall the client from the specified Android device and exit. If multiple devices are connected, the serial parameter must be provided.
Example Usage:
gnirehtet uninstallIf multiple devices are connected, specify the device:
gnirehtet uninstall 1234567890ABCDEFgnirehtet reinstall [serial]
Description: Uninstall then install the client.
Example Usage:
gnirehtet reinstallIf multiple devices are connected, specify the device:
gnirehtet reinstall 1234567890ABCDEFgnirehtet run [serial] [-d DNS[,DNS2,...]] [-p PORT] [-r ROUTE[,ROUTE2,...]]
Description: Enable reverse tethering for exactly one device:
- Install the client if necessary.
- Start the client.
- Start the relay server.
- On Ctrl+C, stop both the relay server and the client.
Example Usage:
gnirehtet runSpecify DNS:
gnirehtet run -d 8.8.8.8,8.8.4.4Specify port:
gnirehtet run -p 8080Specify route:
gnirehtet run -r 192.168.1.0/24gnirehtet autorun [-d DNS[,DNS2,...]] [-p PORT] [-r ROUTE[,ROUTE2,...]]
Description: Enable reverse tethering for all devices:
- Monitor devices and start clients (autostart).
- Start the relay server.
Example Usage:
gnirehtet autorunSpecify DNS:
gnirehtet autorun -d 8.8.8.8,8.8.4.4Specify port:
gnirehtet autorun -p 8080Specify route:
gnirehtet autorun -r 192.168.1.0/24gnirehtet start [serial] [-d DNS[,DNS2,...]] [-p PORT] [-r ROUTE[,ROUTE2,...]]
Description: Start a client on the Android device and exit.
- If
-dis specified, the device will use the specified DNS servers. - If
-ris specified, only reverse tether the specified routes. - If
-pis specified, the relay server will listen on the specified port.
Example Usage:
gnirehtet startSpecify device serial:
gnirehtet start 1234567890ABCDEFSpecify DNS:
gnirehtet start -d 8.8.8.8,8.8.4.4Specify port:
gnirehtet start -p 8080Specify route:
gnirehtet start -r 192.168.1.0/24gnirehtet autostart [-d DNS[,DNS2,...]] [-p PORT] [-r ROUTE[,ROUTE2,...]]
Description: Listen for device connections and start a client on each detected device.
- Accepts the same parameters as the
startcommand (excluding the serial, which will be taken from the detected device).
Example Usage:
gnirehtet autostartSpecify DNS:
gnirehtet autostart -d 8.8.8.8,8.8.4.4Specify port:
gnirehtet autostart -p 8080Specify route:
gnirehtet autostart -r 192.168.1.0/24gnirehtet stop [serial]
Description: Stop the client on the specified Android device and exit.
Example Usage:
gnirehtet stopSpecify device serial:
gnirehtet stop 1234567890ABCDEFgnirehtet restart [serial] [-d DNS[,DNS2,...]] [-p PORT] [-r ROUTE[,ROUTE2,...]]
Description: Stop the current client and restart it.
Example Usage:
gnirehtet restartSpecify device serial:
gnirehtet restart 1234567890ABCDEFSpecify DNS:
gnirehtet restart -d 8.8.8.8,8.8.4.4Specify port:
gnirehtet restart -p 8080Specify route:
gnirehtet restart -r 192.168.1.0/24gnirehtet tunnel [serial] [-p PORT]
Description: Set up the adb reverse tunnel. If a device is unplugged and plugged back in while gnirehtet is active, resetting the tunnel will restore the connection.
Example Usage:
gnirehtet tunnelSpecify device serial:
gnirehtet tunnel 1234567890ABCDEFSpecify port:
gnirehtet tunnel -p 8080gnirehtet relay [-p PORT]
Description: Start the relay server in the current terminal.
Example Usage:
gnirehtet relaySpecify port:
gnirehtet relay -p 8080