-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tether script which is used to connect
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Android <-> Linux Tethering Script with Slirp | ||
|
||
# This script tether the internet from the phone to your PC using Slirp | ||
|
||
# See http://ajasmin.wordpress.com/2011/07/24/android-usb-tethering-with-a-linux-pc/ | ||
|
||
# Path to ADB | ||
export ADB=/space/jw/droid/android-sdk-linux/platform-tools/adb | ||
|
||
if [ $USER != "root" ]; then | ||
echo "Please run this script as root" | ||
exit | ||
fi | ||
|
||
echo "Connecting to the phone via slirp..." | ||
ip=`$ADB shell ip route show |awk '{print $9}'` | ||
dns=`$ADB shell getprop net.dns1` | ||
echo "Android IP: $ip" | ||
echo "Android DNS: $dns" | ||
$ADB ppp "shell:HOME=/data/local/tmp /data/local/tmp/slirp \"dns $dns\" \"host addr $ip\" ppp mtu 1500" nodetach noauth noipdefault defaultroute usepeerdns notty 10.0.2.15:10.64.64.64 | ||
#$ADB ppp "shell:HOME=/data/local/tmp /data/local/tmp/slirp ppp mtu 1500" nodetach noauth noipdefault defaultroute notty 10.0.2.15:10.64.64.64 | ||
|
||
sleep 1 | ||
route add default gw 10.64.64.64 | ||
ecode=$? | ||
|
||
if [ $ecode != 0 ] ; then | ||
echo "ERROR: failed to setup link please try again." | ||
else | ||
echo "Done." | ||
fi | ||
exit $ecode | ||
|
||
|