1 |
On Wednesday 17 Sep 2014 11:14:28 J. Roeleveld wrote: |
2 |
> On Wednesday, September 17, 2014 11:53:52 AM Helmut Jarausch wrote: |
3 |
> > On 09/17/2014 11:50:58 AM, J. Roeleveld wrote: |
4 |
> > > On Wednesday, September 17, 2014 11:46:12 AM Helmut Jarausch wrote: |
5 |
> > > > On 09/17/2014 11:43:28 AM, J. Roeleveld wrote: |
6 |
> > > > > On Wednesday, September 17, 2014 11:24:36 AM Helmut Jarausch |
7 |
> > > |
8 |
> > > wrote: |
9 |
> > > > > > Hi, |
10 |
> > > > > > |
11 |
> > > > > > how do I need to configure my Gentoo box to allow for reverse |
12 |
> > > > > |
13 |
> > > > > tethering |
14 |
> > > > > |
15 |
> > > > > > from my (rooted) Android phone? |
16 |
> > > > > > |
17 |
> > > > > > Many thanks for a hint, |
18 |
> > > > > > Helmut |
19 |
> > > > > |
20 |
> > > > > What do you mean with "reverse tethering"? |
21 |
> > > > > That your mobile uses the network connection of your Gentoo box, |
22 |
> > > |
23 |
> > > or |
24 |
> > > |
25 |
> > > > > your |
26 |
> > > > > Gentoo box the network connection of your mobile? |
27 |
> > > > |
28 |
> > > > My mobile should be able to use the (wired) network connection of my |
29 |
> > > > Gentoo box. |
30 |
> > > |
31 |
> > > Ok, I assumed that was the case, but wanted to be sure. |
32 |
> > > |
33 |
> > > > > Generally, the device sharing the connection needs to play WIFI |
34 |
> > > > > Access Point. |
35 |
> > > > |
36 |
> > > > How to do that on Gentoo? |
37 |
> > > |
38 |
> > > If your Gentoo box has a wired connection and a wireless one. |
39 |
> > > The wired is currently used and the wireless is not. |
40 |
> > > Then you need to get your wireless card to function as an access |
41 |
> > > point. |
42 |
> > > (Google for "Gentoo Linux Howto WIFI Access Point" or similar) and |
43 |
> > > you should |
44 |
> > > find some information on how to do this. |
45 |
> > |
46 |
> > I should have made it more clear. |
47 |
> > My GenToo box doesn't have a wireless card. |
48 |
> > I'd like to connect my mobile to the USB port of my Gentoo box and get |
49 |
> > access |
50 |
> > to the (wired) network. |
51 |
> |
52 |
> There I can not help. |
53 |
> I am not aware of Android supporting that option. |
54 |
> Linux might be able to, if the USB connection acts like a NIC. But the |
55 |
> phone needs to then use the USB line for it's own internet link. |
56 |
> |
57 |
> You might want to check on Android forums to see if anyone there has done |
58 |
> it. |
59 |
|
60 |
Unless anyone suggests differently, I have tried something similar, using a |
61 |
different device with IrDa, years ago. As far as the Linux PC is concerned it |
62 |
needs to be able to forward packets from the Android to the ethernet NIC. |
63 |
That's a case of setting up packet forwarding as if the Linux box were a |
64 |
NATing router. Going from memory and assuming that your Android shows up as |
65 |
usb0, when you run ifocnfig -a, you can try something like this: |
66 |
|
67 |
ifconfig usb0 172.16.1.1 netmask 255.255.255.0 |
68 |
echo 1 > /proc/sys/net/ipv4/ip_forward |
69 |
|
70 |
iptables -t nat -F |
71 |
iptables -t nat -A POSTROUTING -j MASQUERADE |
72 |
|
73 |
Then on the Android you will need to have enabled the USB tethering or some |
74 |
such and use ifconfig or equivalent to set up an IP address within the above |
75 |
IP subnet and your PC's 172.16.1.1 address as the gateway. I think that the |
76 |
Android may use rndis0 as a network interface but I'm not sure and don't have |
77 |
access to an android device to check. |
78 |
|
79 |
I seem to recall tightening up the iptables rules after I got it to work, so |
80 |
that only the particular incoming device would be forwarded to the Internet, |
81 |
but details presently escape me. |
82 |
|
83 |
HTH. |
84 |
-- |
85 |
Regards, |
86 |
Mick |