此文版權屬於作者所有,任何人、媒體或者網站轉載、借用都必須徵得作者本人同意!
參考:How to set up reverse tethering over USB?
1、Connect Android device via USB.
2、Enable USB tethering. To do so, go to
Settings → More... → Tethering & mobile hotspot → Usb tethering.
3、At host machine, the usb tethering connection may be detected by the network manager.
Its name will be something like "Wired connection 2" (or 3).You must edit it's "IPV4/Method" to "Shared to other computers".
3.1、Without the network manager, you will have to do it manually:
$ sudo ifconfig usb0 10.42.0.1 netmask 255.255.255.03.2、modify iptables with
$ echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
$ sudo iptables -t nat -A POSTROUTING -j MASQUERADE4、At Android device
$ adb shell su -c "ifconfig rndis0 10.42.0.2 netmask 255.255.255.0"
$ adb shell su -c "route add default gw 10.42.0.1 dev rndis0"