Reverse tethering

某些用户可能没有可用的WiFi连接或者来自他们的移动运营商的数据网络连接。以下的小教程会帮助你将你的Ubuntu Touch设备连接至你的计算机来访问互联网。

前提:手机已通过USB连接至计算机,并且启用了开发者模式。

步骤

  1. 手机端:android-gadget-service enable rndis

  2. 电脑端:获取你的RNDIS IP地址,比如:hostname -I

  3. 在手机上:

    add gateway: sudo route add default gw YOUR_COMPUTER_RNDIS_IP

    add nameservers: echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf

    refresh dns table: resolvconf -u

  4. 在计算机上:

    enable ip forwarding: echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward

    apply NAT: sudo iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -o eth0 -j MASQUERADE