Skip to content
Find file
2e26b88 Jul 24, 2011
executable file 26 lines (18 sloc) 882 Bytes
# Android <-> Linux Tethering Script for Rooted Phones
# This script tethers the internet from the phone to your PC
# See
# Requires a rooted phone with netfilter and pppd
# Path to ADB
export ADB=/opt/android-sdk-linux_x86/platform-tools/adb
if [ $USER != "root" ]; then
echo "Please run this script as root"
echo "Enabling NAT on the phone..."
$ADB shell "echo 1 > /proc/sys/net/ipv4/ip_forward"
$ADB shell "iptables -t nat -F"
$ADB shell "iptables -t nat -A POSTROUTING -j MASQUERADE"
echo "Connecting to the phone via 'adb ppp'..."
# This use Google Public DNS servers which should work most of the time
$ADB ppp "shell:pppd nodetach noauth noipdefault ms-dns ms-dns /dev/tty" nodetach noauth noipdefault defaultroute usepeerdns notty
echo "Done."
Something went wrong with that request. Please try again.