Android USB reverse tethering - without rooting

SOLVED - Only for web browsing.

Prerequisites:
Host: Fedora 14 32bit linux, 3proxy 
Guest: Samsung Galaxy S, Firefox with Proxy Mobile addon.

Instruction:
1. switch USB debugging on (maybe not needed)
2. Connect your Android to the PC
3. Enable USB tethering
4/a on host: ifconfig usb0 192.168.42.252/24
5. on host run /etc/init.d/3proxy start
6. on Android in Firefox on addons tab configure proxies:
proxy ip: 192.168.42.252
proxy port: 3128
socks ip: 192.168.42.252
socks port: 1080

OR
4/b on host: dhclient usb0
4.1. if you did 4/b remove new routing entry on host: route del default gw 192.168.42.129
follow with 5.

SOLVED 2 - general solution, root needed
Solution uses NAT on linux host ~ 1.05 Mbit/s can be reached

Instruction:
1. switch USB debugging on (not needed)
2. Connect your Android to the PC
3. Enable USB tethering (on device)
4/a on host:

ifconfig usb0 192.168.42.252/24
iptables -t nat -F
iptables -t filter -F
iptables -t filter -P FORWARD ACCEPT
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT
iptables -t nat -I POSTROUTING -s 192.168.42.0/24 -o eth0 -j MASQUERADE
iptables -A FORWARD -p all -i usb0 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward

5. on devide: (use terminal or ConnectBot)
su
route add default gw 192.168.42.242 dev usb0

6. use following command to list routes on device
cat /proc/net/route

OR
4/b on host: dhclient usb0
4.1. if you did 4/b remove new routing entry on host: route del default gw 192.168.42.129
follow with 5.

Comments