Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] Bridging wired and wireless networks with a Raspi
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
christoph_peter_s
Tux's lil' helper
Tux's lil' helper


Joined: 30 Nov 2015
Posts: 106

PostPosted: Tue Sep 10, 2019 8:22 pm    Post subject: [solved] Bridging wired and wireless networks with a Raspi Reply with quote

Dear fellow Gentooers,

I want to provide internet access to a little wired network segment by connecting a Raspi running Gentoo to an existing WLAN. While I already have learned to handle my daily tasks of administering these little boxes, I have a bit clueless, when it comes to the very details of networking. It all begins with the fact, that I am not sure, which where the correct terms for the networking scenario, I am wishing to install.

I see two fundamental approaches:

- first I could use different IP-ranges within the WLAN and the wired LAN. This would mean, that the raspi would act like a router. The wired LAN IP of the raspi would be the default gateway within the wired LAN (basically in one room of the apartment, where I only have limited WLAN access, which I can overcome by using a really big antenna on the WLAN stick attached to the raspi). And on the boxes attached to the WLAN the IP address assigned to the raspi's WLAN stick would be the target of the routes to the wired LAN, which is behind the raspi when seen from the WLAN.

- the second solution would be using the same IP range within the WLAN and within the wired LAN. But depending on the capability of the WLAN base station (it is a relatively new FritzBox) this might require additional measures, as e.g. there might be troubles with ARP.

So my first question is: what are the keywords I should search for in order to find useful information, that helps me to understand the implication of the described networking situation. And maybe some of You have advice on which of these directions I should follow first.


The second part of my question is more down to earth... I have troubles to connect the raspi to the WLAN - which inevitably is the very first task I have to do. I have bought a TP-Link TL-WN722N rev. 2 WLAN stick, which is based on a Realtek chipset. That stick is served by the r8188eu driver, which should be provided by the Raspi-foundations mainline kernel (which I use, currently 4.19.71-v7+). I have read the Gentoo documentation on WLAN in general, on wpa_supplicant, and on WLAN on the AMD64 architecture (which answers some questions, but I still lack the understanding of the big thing...).

So reading through the docu I have installed these packages: sys-kernel/linux-firmware, net-wireless/wpa_supplicant, net-wireless/wireless-tools, net-wireless/iw. Most likely more than I need - it was desperation, that made me doing so.

The stick shows up like expected:
Code:
brutus ~ # lsusb
Bus 001 Device 004: ID 2357:010c TP-Link TL-WN722N v2
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
brutus ~ # tree /sys/class/net
/sys/class/net
|-- eth0 -> ../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1:1.0/net/eth0
|-- lo -> ../../devices/virtual/net/lo
`-- wlan0 -> ../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/net/wlan0


I use this in /etc/wpa_supplicant/wpa_supplicant.conf
Code:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
country=DE
update_config=1

network={
        ssid="SsId123"
        psk=0c6832323bf9c33ab83123d4ff6a9154321e266ac1eccabcdef45c11234525e9
        proto=RSN
        key_mgmt=WPA-PSK
        group=CCMP
        pairwise=CCMP
        priority=5
}


And this is /etc/conf.d/net
Code:
nis_domain_lo="home.serbe.ch"
config_eth0="192.168.11.205 netmask 255.255.255.0 brd 192.168.11.255"
routes_eth0="default via 192.168.11.254"
routes_eth0="192.168.41.0/24 via 192.168.11.201
             default via 192.168.11.254"
dns_servers_eth0=( "192.168.11.205 192.168.11.201 192.168.41.25" )

modules_wlan0="wpa_supplicant"
wpa_supplicant_wlan0="-Dwext -c/etc/wpa_supplicant/wpa_supplicant.conf"
config_SsId123="192.168.12.219/24"
routes_SsId123="default via 192.168.12.254"
dns_servers_SsId123="192.168.11.201"
dns_domain_SsId123="home.serbe.ch"


The file /etc/conf.d/wpa_supplicant contains only one line:
Code:
wpa_supplicant_args="-Dwext -B -M -c/etc/wpa_supplicant/wpa_supplicant.conf"


I try to start the WLAN by this line:
Code:
brutus ~ # wpa_supplicant -Dwext -iwlan0 -C/var/run/wpa_supplicant/ -c/etc/wpa_supplicant/wpa_supplicant.conf
Successfully initialized wpa_supplicant
rfkill: Cannot get wiphy information
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
wlan0: Trying to associate with e0:28:6d:ac:f9:a3 (SSID='OnAir2' freq=2437 MHz)
Failed to add supported operating classes IE
wlan0: Association request to the driver failed
wlan0: Associated with e0:28:6d:ac:f9:a3
wlan0: WPA: Key negotiation completed with e0:28:6d:ac:f9:a3 [PTK=CCMP GTK=CCMP]
wlan0: CTRL-EVENT-CONNECTED - Connection to e0:28:6d:ac:f9:a3 completed [id=0 id_str=]
wlan0: WPA: Group rekeying completed with e0:28:6d:ac:f9:a3 [GTK=CCMP]
wlan0: WPA: Group rekeying completed with e0:28:6d:ac:f9:a3 [GTK=CCMP]

Which looks like I was on the WLAN. But there is no IP address assigned to wlan0...
Code:
brutus ~ # ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:a7:a9:1f brd ff:ff:ff:ff:ff:ff
    inet 192.168.11.205/24 brd 192.168.11.255 scope global eth0
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 50:3e:aa:01:6e:10 brd ff:ff:ff:ff:ff:ff
brutus ~ #

When I stop wpa_supplicant wlan0 switches to the DOWN state and the entries UP,LOWER_UP disappear. So that looks near - but I don't got an IP address. :-(
It looks like I was missing something crucial...

TIA and best regards
Peter

PS: I am also aware of that old forum post from 2011, https://forums.gentoo.org/viewtopic-t-890978-start-0.html. But it was not sufficient to solve my problem. Maybe it is a bit outdated?
PS2: English is not my mother language. It is not too bad, but when it comes to finding the best striking search words, it is an handicap.


Last edited by christoph_peter_s on Wed Oct 09, 2019 1:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54237
Location: 56N 3W

PostPosted: Tue Sep 10, 2019 8:57 pm    Post subject: Reply with quote

christoph_peter_s,

It will be easier to make work if you use the Pi as a router.

Bridging is setting up a logical interface composed of zero or more physical interfaces.
In many cases Wifi cannot be bridged.
The real interfaces are brought up without configuring them then the br0 logical interface is configured in the normal way.

From my bare metal KVM host
# eth interfaces for firewall
# we don't want them getting IP addresses
# as they are being donated to bridges

Code:
config_eth0="null"
config_eth1="null"
config_eth2="null"
config_eth3="null"
config_eth4="null"


Donate eth4 to br3 and assign it an IP.
Code:
# protected wired
bridge_br3="eth4"
config_br3="192.168.100.254/24"

The KVMs that need to be on the 192.168.100.0/24 then connect to br3, just like it was a real interface.
Bridging needs kernel support and ebtables

The router route is described in the Home Router guide.
You will need to adapt it to the Pi arm CPU as you go.

You may have at most one default route on any host.
Code:
routes_eth0="default via 192.168.11.254"
...
routes_SsId123="default via 192.168.12.254"

That won't work as you expect.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
christoph_peter_s
Tux's lil' helper
Tux's lil' helper


Joined: 30 Nov 2015
Posts: 106

PostPosted: Tue Sep 10, 2019 9:17 pm    Post subject: Reply with quote

Hi Neddy,

Thank You for Your support.
So basically You tell me, not to worry for the missing IP on wlan0 - but go and define a bridge.
And then follow https://wiki.gentoo.org/wiki/Home_router - and configure LAN and "Connect another LAN"...

That sounds indeed as a pretty elegant approach.

Best regards
Peter
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54237
Location: 56N 3W

PostPosted: Tue Sep 10, 2019 9:38 pm    Post subject: Reply with quote

christoph_peter_s,

Not exactly. Do not use a bridge. Its not supported by most Wifi systems.
If you want to try it, I pointed the way

Set up a home router on the Pi instead. That process is known to work.
All the bits are known to work on arm.

A cascade of routers works. The entire interned depends on that.

This is my routing table now. lo is removed for simplicity.
Code:
$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.100.253 0.0.0.0         UG    2      0        0 eth0
192.168.100.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0

Rules are matched from the bottom up. As soon as a packet matches a rule, its routed by that rule and no other rules are tested.

The above says to reach any host on the 192.168.100.0/24 network, send the packet out of eth0.
The other rule matches everything, that's the default route, it says to reach any network, send the packet to 192.168.100.253
192.168.100.253 is my router. It has a default route to send packets to my ISP, my ISP has a default route too ...

Your Raspberry Pi will become a router for your WiFi traffic. One interface will connect to your router, the other to your subnet.
Either way round works. Wired to your router and the Pi as a Wireless router, or Wifi to your router and the Pi as a wired router.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.


Last edited by NeddySeagoon on Tue Sep 10, 2019 9:52 pm; edited 1 time in total
Back to top
View user's profile Send private message
christoph_peter_s
Tux's lil' helper
Tux's lil' helper


Joined: 30 Nov 2015
Posts: 106

PostPosted: Tue Sep 10, 2019 9:43 pm    Post subject: Reply with quote

Hi Neddy,

OK, I have read through the Home Router guide - and as I understand it now, I have to set up iptables, just replacing WAN with WLAN - and set the rules in a way, that all the necessary packets are forwarded, right?

But the issue, on how to get an IP address to wlan0 remains to be solved...

Best regards
Peter
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54237
Location: 56N 3W

PostPosted: Tue Sep 10, 2019 9:55 pm    Post subject: Reply with quote

christoph_peter_s,

wlan0 will have a static IP address.
The Pi will run a dhcp server to give out network settings to other hosts on your WiFi network.
The wlan0 static IP address will be the default route for your WiFi hosts.

The Pi will run Network Address Translation (NAT) for you WiFi hosts.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
christoph_peter_s
Tux's lil' helper
Tux's lil' helper


Joined: 30 Nov 2015
Posts: 106

PostPosted: Tue Sep 10, 2019 11:27 pm    Post subject: Reply with quote

Hi Neddy,

I fixed two errors. First in /etc/conf.d/wpa_supplicant there must not be a -M option.
And I removed the routes_SsId123 line in /etc/conf.d/net.
So now rc-service wpa_supplicant does work just like the debug call from the command line.
But - and I really can't see why, at least not tonight - I don't got any IP address assigned to wlan0. :-(

Best regards
Peter
Back to top
View user's profile Send private message
crocket
Guru
Guru


Joined: 29 Apr 2017
Posts: 558

PostPosted: Wed Sep 11, 2019 2:43 am    Post subject: Reply with quote

What does it take to bridge a WLAN with a LAN or another WLAN?

Are manufacturers trying to extract more money by turning wireless bridge into various proprietary technologies?
Back to top
View user's profile Send private message
christoph_peter_s
Tux's lil' helper
Tux's lil' helper


Joined: 30 Nov 2015
Posts: 106

PostPosted: Wed Sep 11, 2019 6:47 am    Post subject: Reply with quote

As far as I understood, there is some sort of a shortcoming in the IEEE specifications, that originally assumed, that there was only one user behind each logged in WLAN client, which is apparently not the case, if You use a switch behind a WLAN client. Neddy therefore requested me, to use different IP ranges in the different net segments, i.e. my device should act like a router (switching one network level higher than a normal switch). In that case, on MAC level (i.e. below IP) the routers WLAN entry port is the destination of all the IP packets headed for the net segment behind that router.

Once again: as far as I know there has been some work to overcome that restriction, but that is not covered by the rigid specifications of IEEE (or it is in some late extensions, which are not commonly used), so that different manufactures did come up with different solutions - or no solution at all. So one can not assume, that using WLAN to attach a network segment was working at all...

Best regards
Peter

PS: sorry, this is a quite naive explanation. I did not understand it better than that...
Back to top
View user's profile Send private message
christoph_peter_s
Tux's lil' helper
Tux's lil' helper


Joined: 30 Nov 2015
Posts: 106

PostPosted: Wed Sep 11, 2019 2:55 pm    Post subject: Reply with quote

After triple checking everything in the morning, I am still clueless.
wlan0 doesn't get an IP, albeit the WLAN connection seems to be OK.

Code:
brutus ~ # iwconfig wlan0
wlan0     IEEE 802.11bgn  ESSID:"OnAir2"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.437 GHz  Access Point: E0:28:6D:AC:F9:A3
          Bit Rate:72.2 Mb/s   Sensitivity:0/0
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:****-****-****-****-****-****-****-****   Security mode:open
          Power Management:off
          Link Quality=100/100  Signal level=100/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0


One thing looks strange: it says "security mode: open" - but I would expect WPA2...

Best regards
Peter
Back to top
View user's profile Send private message
christoph_peter_s
Tux's lil' helper
Tux's lil' helper


Joined: 30 Nov 2015
Posts: 106

PostPosted: Wed Sep 11, 2019 8:28 pm    Post subject: Reply with quote

To check the issue, I have bought another Wifi stick (they cost next to nothing...), a Edimax EW-7612UAn v2. It uses another Realtek chipset...
Code:
brutus ~ # lsmod | grep -e '8192\|rtl\|80211'
rtl8192cu              90112  0
rtl_usb                20480  1 rtl8192cu
rtl8192c_common        69632  1 rtl8192cu
rtlwifi               114688  3 rtl_usb,rtl8192c_common,rtl8192cu
mac80211              692224  3 rtl_usb,rtlwifi,rtl8192cu
cfg80211              614400  3 mac80211,rtlwifi,brcmfmac
rfkill                 28672  2 cfg80211

The chipset seems newer than the one of my first (and preferred) stick. So I had to switch to the nl80211 driver...
Code:
brutus ~ # cat /etc/conf.d/wpa_supplicant
wpa_supplicant_args="-iwlan0 -Dnl80211 -B -c/etc/wpa_supplicant/wpa_supplicant.conf"

Code:
brutus ~ # cat /etc/conf.d/net
### loop-back ###
nis_domain_lo="home.serbe.ch"

### eth0 ###
config_eth0="192.168.11.205/24"
routes_eth0="192.168.41.0/24 via 192.168.11.201
             default via 192.168.11.254"
dns_servers_eth0=( "192.168.11.205 192.168.11.201 192.168.41.25" )
dns_domain_eth0="home.serbe.ch"

### wpa_supplicant - serve WLAN ###
modules_wlan0="wpa_supplicant"
wpa_supplicant_wlan0="-Dnl80211 -c/etc/wpa_supplicant/wpa_supplicant.conf"

### static IP for OnAir2 ###
config_OnAir2="192.168.11.212/24"

Code:
brutus ~ # cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
ap_scan=1
country=DE
update_config=1

network={
        ssid="OnAir2"
        psk="xxxxxxxxxxxxxxxx"
        scan_ssid=1
        proto=WPA2
        key_mgmt=WPA-PSK
        group=CCMP TKIP
        pairwise=CCMP TKIP
        priority=5
}

As I feared, the result did not change at all...
Code:
brutus ~ # ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:a7:a9:1f brd ff:ff:ff:ff:ff:ff
    inet 192.168.11.205/24 brd 192.168.11.255 scope global eth0
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 08:be:ac:00:ed:21 brd ff:ff:ff:ff:ff:ff


I am missing some essential part. Do I need some net.wlan0 link? (which I don't have as there is no hint on how to generate one)
No wi does work, which didn't with the first stick, that used the wext driver - but apart from that, there is no difference. I am a bit clueless on how to proceed.
Code:
brutus ~ # iw dev
phy#0
        Interface wlan0
                ifindex 3
                wdev 0x1
                addr 08:be:ac:00:ed:21
                ssid OnAir2
                type managed
                channel 6 (2437 MHz), width: 20 MHz, center1: 2437 MHz
                txpower 20.00 dBm
brutus ~ # iwconfig wlan0
wlan0     IEEE 802.11  ESSID:"OnAir2"
          Mode:Managed  Frequency:2.437 GHz  Access Point: 2A:65:11:A0:14:1A
          Bit Rate=1 Mb/s   Tx-Power=20 dBm
          Retry short limit:7   RTS thr=2347 B   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=66/70  Signal level=-44 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0


- Peter
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54237
Location: 56N 3W

PostPosted: Wed Sep 11, 2019 8:57 pm    Post subject: Reply with quote

christoph_peter_s,

Wifi dongles can operate in three modes.

Host mode, which everyone is used to in their laptops
Access Point mode, where the interface operates an a WiFi Access Point and controls all the other connected hosts.
Monitor mode, where the dongle just listens.

Not all dongles can do all modes. They all do host mode, as that's the common mode of operation.

You need your wifi interface to operate in Access Point mode as you want the Pi to be a WiFi Access Point.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
christoph_peter_s
Tux's lil' helper
Tux's lil' helper


Joined: 30 Nov 2015
Posts: 106

PostPosted: Wed Sep 11, 2019 9:10 pm    Post subject: Reply with quote

NeddySeagoon wrote:
You need your wifi interface to operate in Access Point mode as you want the Pi to be a WiFi Access Point.


Hi Neddy,

are You sure? I want to get internet access through WiFi (seen from the standpoint of this raspi) and then distribute this over wire to a few hosts (mainly a bunch of other raspis, which I need for a project).

Best regards
Peter


PS: I have outside boxes, too. This I prefer having a fixed IP, so that I can put routes to the raspi from the outside.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54237
Location: 56N 3W

PostPosted: Wed Sep 11, 2019 9:23 pm    Post subject: Reply with quote

christoph_peter_s,

I misunderstood. You need host mode as you say.

You configure your WiFi in the normal way with wpa_supplicant an /etc/conf.d/net.
Code:
less /usr/share/doc/netifrc-0.6.1/net.example.bz2
is a good read.
If you don't have netifrc-0.6.1, change the version.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
christoph_peter_s
Tux's lil' helper
Tux's lil' helper


Joined: 30 Nov 2015
Posts: 106

PostPosted: Wed Oct 02, 2019 9:37 pm    Post subject: Reply with quote

There is a wee bit of progress...

First of all, I had no dhcp daemon running (the raspi did use fixed IPs ever since the first install).
So I did install net-misc/dhcpcd and add it to runlevel default...

The situation is a bit tricky, as one of my Wifi dongles seems to use a buggy driver. Whenever I restart wpa_supplicant, the dongle does no longer accept a request for restart. So it took a lot of reboots to investigate the issue... Anyway that does't hurt too much and for the time being I switched back to the better working dongle.

Furthermore I did remove the duplicates of the wpa_supplicant options. Some were in /etc/conf.d/net in "wpa_supplicant_wlan0=..." lines, others in /etc/conf.d/wpa_supplicant, here in "wpa_supplicant_args=..." lines. So my current config looks like that:

Code:
brutus ~ # cat /etc/conf.d/wpa_supplicant
wpa_supplicant_args="-iwlan0  -Dwext    -B -c/etc/wpa_supplicant/wpa_supplicant.conf -f/var/log/wpa_supplicant.log"


Code:
brutus ~ # cat /etc/conf.d/net
### loop-back ###
nis_domain_lo="home.serbe.ch"

### eth0 ###
config_eth0="192.168.11.205/24"
routes_eth0="192.168.41.0/24 via 192.168.11.201
             default via 192.168.11.254"
dns_servers_eth0=( "192.168.11.201 192.168.41.25" )
dns_domain_eth0="home.serbe.ch"

### wpa_supplicant - serve WLAN ###
modules_wlan0="wpa_supplicant"

### static IP for OnAir2 ###
#config_OnAir2="192.168.12.212/24"
# use dhcp for debugging wpa_supplicant
config_OnAir2="dhcp"


This configuration works like expected.
But if I comment out the dhcp line and enable the fixed IP line, then it keeps the IP it got from DHCP. So there is still something missing. But it doesn't look like a wpa_supplicant issue now. In the next step I would review the netifrc docu (I had, but it is two weeks since then, and how knows, a second reading should do no harm).

Best regards
Peter
Back to top
View user's profile Send private message
christoph_peter_s
Tux's lil' helper
Tux's lil' helper


Joined: 30 Nov 2015
Posts: 106

PostPosted: Mon Oct 07, 2019 2:09 pm    Post subject: Reply with quote

OK, I have found a solution. It's not a nice one, but it works...

I configure the wlan0 IP to dhcp and run the dhcpcd daemon. But inside /etc/dhcpcd.conf I added:
Code:
interface wlan0
static ip_address=192.168.12.212/24


The approach is due to some raspi forum, btw.

First issue solved. I'll go on the the next IP routing one now (or within the next weeks, having troubles with my backup server, that have higher priority...).

- Peter


PS: the second issue was a simple one: I did enable the kernel mode IP routing by the setting in /etc/sysctl.conf
Code:
net.ipv4.ip_forward = 1

Some tidy up of my routing tables still needs to be done, but the real job is done.
Back to top
View user's profile Send private message
christoph_peter_s
Tux's lil' helper
Tux's lil' helper


Joined: 30 Nov 2015
Posts: 106

PostPosted: Wed Oct 23, 2019 9:49 pm    Post subject: Reply with quote

It wasn't that easy... due to that Wifi limitation, that it only allows point-to-point connections.
So I have implemented this solution:

Once the Wifi connection is there, I start an tunnel on the remote host using
Code:
ip tunnel add tun12 mode ipip remote 192.168.11.201 local 192.168.11.205
ifconfig tun12 up

and on the main site by:
Code:
ip tunnel add tun12 mode ipip remote 192.168.11.205 local 192.168.11.201
ifconfig tun12 up


Then I have to fix the routing. On the remote site I add:
Code:
route add default metric 80 dev tun12
, where the metric is lower than the old default route...

On the main site I only need
Code:
route add -net 192.168.12.0/24 dev tun12

where 192.168.11.0/24 is the main site and 192.168.12.0/24 is the remote side connected by Wifi and the tunnel.

What has left now is to package the setup of the tunnel in a service - and a cron job on both sides, that checks whether the connection is still up - and restarts it after a connection loss (which seems to happen from time to time...

This was a tough job... but seems to come out OK. :-)

- Peter
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum