Tethering Script for Android Phones and Gnome

Update: If you want to use _real_ tethering (without proxy), install CyanogenMod - a tutorial is in the Wiki !

Just a small shell script to get an internet connection on a standard gnome desktop (e.g. Ubuntu) via a proxy on an android phone (no root access needed!).
First you have to download the proxoid application, then follow the installation instructions and activate proxoid.

Now you can use the following scripts, to activate and deactivate proxy settings for the whole gnome desktop. This has the advantage, that it's not necessary to configure a proxy in each application manually.

Script to start the proxy (adjust the path to your system settings):

#! /bin/sh
# Routes network traffic to the phone and switches the GNOME proxy on

# adjust the following path to your system
/path/to/your/android/sdk/tools/adb forward tcp:8080 tcp:8080

echo "Enabled forwarding."

# activate proxy
gconftool-2 -t string -s /system/proxy/mode "manual"
gconftool-2 -t bool -s /system/http_proxy/use_http_proxy true
# http settings
gconftool-2 -t string -s /system/http_proxy/host "localhost"
gconftool-2 -t int -s /system/http_proxy/port "8080"
# https settings
gconftool-2 -t string -s /system/proxy/secure_host "localhost"
gconftool-2 -t int -s /system/proxy/secure_port "8080"

echo "Enabled proxy."

Script to stop the proxy:

#! /bin/sh
# Switches the GNOME proxy off

gconftool-2 -t string -s /system/proxy/mode "none"
gconftool-2 -t bool -s /system/http_proxy/use_http_proxy false

echo "Disabled proxy."

Have fun with mobile internet Wink