Gentoo Archives: gentoo-user

From: Guillaume Poulin <poulin.guillaume@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Reverse Tethering - How to?
Date: Fri, 26 Sep 2014 10:24:29
Message-Id: CAB4SSqSyCyb3UaJkT0bJj_ORcGLU-Nxi4DLRDyB2mfyOvUGsQQ@mail.gmail.com
In Reply to: Re: [gentoo-user] Reverse Tethering - How to? by Helmut Jarausch
1 2014-09-17 17:53 GMT+08:00 Helmut Jarausch <jarausch@××××××××××××××××.de>:
2 > On 09/17/2014 11:50:58 AM, J. Roeleveld wrote:
3 >>
4 >>
5 >> On Wednesday, September 17, 2014 11:46:12 AM Helmut Jarausch wrote:
6 >> > On 09/17/2014 11:43:28 AM, J. Roeleveld wrote:
7 >> > > On Wednesday, September 17, 2014 11:24:36 AM Helmut Jarausch wrote:
8 >> > > > Hi,
9 >> > > >
10 >> > > > how do I need to configure my Gentoo box to allow for reverse
11 >> > >
12 >> > > tethering
13 >> > >
14 >> > > > from my (rooted) Android phone?
15 >> > > >
16 >> > > > Many thanks for a hint,
17 >> > > > Helmut
18 >> > >
19 >> > > What do you mean with "reverse tethering"?
20 >> > > That your mobile uses the network connection of your Gentoo box, or
21 >> > > your
22 >> > > Gentoo box the network connection of your mobile?
23 >> >
24 >> > My mobile should be able to use the (wired) network connection of my
25 >> > Gentoo box.
26 >>
27 >> Ok, I assumed that was the case, but wanted to be sure.
28 >>
29 >> > > Generally, the device sharing the connection needs to play WIFI
30 >> > > Access Point.
31 >> >
32 >> > How to do that on Gentoo?
33 >>
34 >> If your Gentoo box has a wired connection and a wireless one.
35 >> The wired is currently used and the wireless is not.
36 >> Then you need to get your wireless card to function as an access point.
37 >> (Google for "Gentoo Linux Howto WIFI Access Point" or similar) and you
38 >> should
39 >> find some information on how to do this.
40 >>
41 >
42 > I should have made it more clear.
43 > My GenToo box doesn't have a wireless card.
44 > I'd like to connect my mobile to the USB port of my Gentoo box and get
45 > access
46 > to the (wired) network.
47 >
48 > Thanks,
49 > Helmut
50 >
51 >
52
53 I had the same issue. I wrote a small script for that. If my memory is
54 good, it was working pretty good apart for the google play (don't
55 remember the reason thou).
56
57 ```
58 #!/bin/bash
59
60 ifconfig usb0 192.168.42.135 up
61 echo 1 > /proc/sys/net/ipv4/ip_forward
62 iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
63
64 adb start-server
65 adb shell su -c '/system/xbin/busybox ifconfig usb0 192.168.42.130 up'
66 adb shell su -c '/system/xbin/busybox route add -net default gw
67 192.168.42.135 usb0'
68 adb shell su -c 'setprop net.dns1 8.8.8.8'
69 adb shell su -c 'setprop net.dns2 8.8.8.4'
70 ```