Reverse tethering¶
This tutorial helps you to connect your Ubuntu Touch device to your computer to access the Internet on it. This is useful if there is no available Wi-Fi connection or you don’t have a data subscription on your Ubuntu Touch device.
Prerequisite: A Ubuntu Touch device with “Developer mode” on, attached via USB to the computer connected to the Internet.
Steps¶
On the Ubuntu Touch device:
android-gadget-service enable rndis
On your computer: get your RNDIS IP address e.g:
hostname -I
On the Ubuntu Touch device:
add a gateway:
sudo route add default gw YOUR_COMPUTER_RNDIS_IP
add nameservers:
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
refresh the DNS table:
resolvconf -u
On computer:
Turn on 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