#!/bin/bash # shell script to automate reverse USB tethering on Linux echo "Establishing reverse USB tethering..." sudo ifconfig usb0 10.42.0.1 netmask 255.255.255.0 echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward > /dev/null sudo iptables -t nat -F sudo iptables -t nat -A POSTROUTING -j MASQUERADE adb kill-server sudo adb root > /dev/null adb shell ifconfig rndis0 10.42.0.2 netmask 255.255.255.0 adb shell route add default gw 10.42.0.1 dev rndis0 echo "Reverse USB tethering ready..."