On Wednesday 17 Sep 2014 11:14:28 J. Roeleveld wrote:
> On Wednesday, September 17, 2014 11:53:52 AM Helmut Jarausch wrote:
> > On 09/17/2014 11:50:58 AM, J. Roeleveld wrote:
> > > On Wednesday, September 17, 2014 11:46:12 AM Helmut Jarausch wrote:
> > > > On 09/17/2014 11:43:28 AM, J. Roeleveld wrote:
> > > > > On Wednesday, September 17, 2014 11:24:36 AM Helmut Jarausch
> > > 
> > > wrote:
> > > > > > Hi,
> > > > > > 
> > > > > > how do I need to configure my Gentoo box to allow for reverse
> > > > > 
> > > > > tethering
> > > > > 
> > > > > > from my (rooted) Android phone?
> > > > > > 
> > > > > > Many thanks for a hint,
> > > > > > Helmut
> > > > > 
> > > > > What do you mean with "reverse tethering"?
> > > > > That your mobile uses the network connection of your Gentoo box,
> > > 
> > > or
> > > 
> > > > > your
> > > > > Gentoo box the network connection of your mobile?
> > > > 
> > > > My mobile should be able to use the (wired) network connection of my
> > > > Gentoo box.
> > > 
> > > Ok, I assumed that was the case, but wanted to be sure.
> > > 
> > > > > Generally, the device sharing the connection needs to play WIFI
> > > > > Access Point.
> > > > 
> > > > How to do that on Gentoo?
> > > 
> > > If your Gentoo box has a wired connection and a wireless one.
> > > The wired is currently used and the wireless is not.
> > > Then you need to get your wireless card to function as an access
> > > point.
> > > (Google for "Gentoo Linux Howto WIFI Access Point" or similar) and
> > > you should
> > > find some information on how to do this.
> > 
> > I should have made it more clear.
> > My GenToo box doesn't have a wireless card.
> > I'd like to connect my mobile to the USB port of my Gentoo box and get
> > access
> > to the (wired) network.
> 
> There I can not help.
> I am not aware of Android supporting that option.
> Linux might be able to, if the USB connection acts like a NIC. But the
> phone needs to then use the USB line for it's own internet link.
> 
> You might want to check on Android forums to see if anyone there has done
> it.

Unless anyone suggests differently, I have tried something similar, using a 
different device with IrDa, years ago.  As far as the Linux PC is concerned it 
needs to be able to forward packets from the Android to the ethernet NIC.  
That's a case of setting up packet forwarding as if the Linux box were a 
NATing router.  Going from memory and assuming that your Android shows up as 
usb0, when you run ifocnfig -a, you can try something like this:

ifconfig usb0 172.16.1.1 netmask 255.255.255.0
echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -t nat -F
iptables -t nat -A POSTROUTING -j MASQUERADE

Then on the Android you will need to have enabled the USB tethering or some 
such and use ifconfig or equivalent to set up an IP address within the above 
IP subnet and your PC's 172.16.1.1 address as the gateway.  I think that the 
Android may use rndis0 as a network interface but I'm not sure and don't have 
access to an android device to check.

I seem to recall tightening up the iptables rules after I got it to work, so 
that only the particular incoming device would be forwarded to the Internet, 
but details presently escape me.

HTH.
-- 
Regards,
Mick

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to