FORUMS
Remove All Ads from XDA

[GUIDE] Connect Android to Linux PC internet via USB

1 posts
Thanks Meter: 0
 
By Wiz!21, Junior Member on 23rd July 2014, 01:48 PM
Post Reply Email Thread
I've been playing 4 hours with my brand new Archos Titanium 40
and I was specifically trying to connect it to the internet
via the USB cable.

Here's what I have :
  • Archos Titanium 40, almost unmodified Android Jelly Bean 4.2.2, not rooted.
  • A fairly up do date "testing" Debian on my PC.
  • The Archos USB cable (standard stuff mind you) connecting my phone to the PC.

The first thing to note is that Jelly Bean 4.2.2 does provide
reverse tethering natively.

For that, just plug your USB cable in your PC and in your phone.
The phone then proposes to expose itself as a regular USB storage.
Don't accept that. Go to the settings page instead, look at the
"wireless & network" stuff, then "More...". There you'll find "USB Internet". Activate
that. Android will then take you by the hand. The first thing it'll
ask is the OS you want to connect to. You have a choice between
various Windows versions... But we're on Linux. So choose Windows 8
and just act as if everything was fine (clik "next" and then "finished"). After that
your USB connection is there. The setting string reports you're connected.

On the PC Linux now. There's a new network interface : usb0.
To see it use ifconfig (you must be root to do that).
The problem is that that interface has no IP address. Since we choose to work
as with windows 8, Android phone gave itself the 192.168.137.1 default
address (you can see that by opening a shell on your phone and
typing netcfg; the you look at the rndis0 interface...)

So, you know have to set that address properly, and then activate the IP
NAT stuff. This is done as root with :

ifconfig usb0 192.168.137.1
echo 1 > /proc/sys/net/ipv4/ip_forward
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
/sbin/iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT


(on my PC eth0 is the ethernet card wich is connected
to my router which is, in turn, connected to the internet)

And voilà. nothing to install, nothing to root. Everything works :
slashdot, youtube, etc. Super clean. No rooting needed, no additional software.

Somehow I didn't find that anywhere on the web... So I hope it helps...

stF
 
 
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes