3

I followed this guide to try to set up my RPi 3B (Rapian buster) as a wifi bridge. I performed the "General setup" and then the steps under "Setting up an access point with a bridge". There's one big difference, I don't want to use eth0, as this is supposed to be a wifi bridge. So instead of this in the guide:

                               RPi
               wifi   ┌──────bridge──────┐   wired            wan
mobile-phone <.~.~.~> │(wlan0) br0 (eth0)│ <-------> router <-----> INTERNET
            \                   |                   / DHCP-server
           (dhcp              (dhcp           192.168.50.1
        from router)       from router)

I wanted this:

                       wifi                     RPi                             wifi
               SSID:Drugdealer-terras   ┌──────bridge─────────────────┐   SSID: Drugdealer            wan
mobile-phone <.~.~.~.~.~.~.~.~.~.~.~.~> │(wlan0) br0 (wlx00c0ca66080c)│ <.~.~.~.~.~.~.~.~.~> router <-----> INTERNET
            \                                     |                                         / DHCP-server
           (dhcp                               (dhcp                                       /  & WDS enabled
        from router)                        from router)                            192.168.1.1
wlan0 = the built-in wifi of the RPi
wlx00c0ca66080c = Alfa AWUS036NHA wifi dongle

I left out the ethernet interface for now.

Wifi was working fine with the wifi dongle and built-in wifi before these steps. Current situation is that I don't have internet access on the RPi, so instead of screenshots I unfortunately have to share photos of a screen.

So I followed the steps. I couldn't post them in detail, as stackexchange thought it was spam when I tried to post it. But it is all the steps here, only where it refers to eth0, I replaced it with wlx00c0ca66080c.

Since I'm using a wifi dongle instead of eth0, I still had to tell what it had to connect to, so I created /etc/wpa_supplicant/wpa_supplicant-wlx00c0ca66080c.conf and put this (the priority line is strictly not needed, but shouldn't harm):

country=BE
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="Drugdealer"
    psk="password"
    priority=1
}

I removed /etc/wpa_supplicant/wpa_supplicant.conf and I did this to finish:

rpi ~# chmod 600 /etc/wpa_supplicant/wpa_supplicant-wlx00c0ca66080c.conf
rpi ~# systemctl disable wpa_supplicant.service
rpi ~# systemctl enable wpa_supplicant@wlx00c0ca66080c.service

Reboot.

So what happens after a reboot?

First of all it hangs and eventually fails on systemd-networkd-wait-online.service:

enter image description here

But after a while I can log in.

sudo systemctl status systemd-networkd-wait-online.service shows this:

enter image description here

There was a solution given here, so I tried

~$ sudo systemctl edit systemd-networkd-wait-online.service

and then add the slave devices of the bridge

[Service]
ExecStart=
ExecStart=/lib/systemd/systemd-networkd-wait-online --ignore=wlx00c0ca66080c --ignore=wlan0 --quiet

but that didn't seem to help.

However, two things do work: wlx00c0ca66080c connects to Drugdealer and wlan0 creates an access point Drugdealer-terras. But br0 doesn't get an ip address, so when connected to Drugdealer-terras I don't get an ip address either.

sudo systemctl status systemd-networkd.service

enter image description here

The error reads: wlx00c0ca66080c: Could not join netdev: Operation not supported

iwconfig

enter image description here

ifconfig

enter image description here

networkctl

enter image description here

EDIT:
I have changed two things:
1. I have made the ethernet interface part of the bridge. The bridge now gets an ip address and at least I can have ssh access if I want. But for the rest of the tests, I have the ethernet disconnected. 2. Several sources (1 | 2) point towards enabling 4addr for the wifi interface. When I do sudo iw dev wlx00c0ca66080c set 4addr on and sudo systemctl restart systemd-networkd.service, I see that wlx00c0ca66080c becomes part of the bridge:

sudo systemctl status systemd-networkd.service and sudo bridge link:

enter image description here

But ifconfig br0 shows no ip address:

enter image description here

Nikotine
  • 31
  • 5

1 Answers1

3

You are using the wrong tutorial. You should have read it more carefully, just the first sentences, that I will quote here:

We are talking about an access point together with an ethernet port eth0.

If you want an access point together with a wlan0 client connection to another wifi network (wlan repeater) then look at Access point as WiFi router/repeater, optional with bridge.

The Raspberry Pi is able to work as a wireless hotspot and simultaneously connect to another hotspot as a client. But the wifi device on the RasPi has a general limitation. The client connection cannot be bridged because lack of WDS (wireless distribution system) that is needed for bridging on the wireless. For further information look at Raspberry Pi WiFi to Ethernet Bridge for a server?.

Because you are using an additional USB/WiFi dongle it must support WDS and it must conform with your routers WDS so it is very difficult to give general instructions how to configure it. I'm afraid you are left on your own with configuration of your WDS. But it seems that your dongle does not support WDS because you also get the error message:
wlx00c0ca66080c: Could not join netdev: Operation not supported

You can explicitly check if your adapter supports WDS (my adapter does it) with this commands:

rpi ~$ iw phy phy1 info | grep wds
       * set_wds_peer
rpi ~$ sudo iw dev wlx00c0ca66080c set 4addr on
rpi ~$

# with wlan0 you will get
rpi ~$ sudo iw dev wlan0 set 4addr on
command failed: Operation not supported (-95)

Supporting WDS by your adapter doesn't mean that it works together with your router. There is no standard defined for WDS so it must not fit.

If cannot get it to work, you can only use routing for the wifi client connection to the internet router and for this you don't need an additional USB/WiFI dongle. Just follow to configure an Access point as WiFi router/repeater, optional with bridge.

If you want to use your additional USB/WiFi dongle you can simplify the setup with an Access point as WiFi router/repeater with additional WiFi-dongle.

If you really need to "bridge" the WiFi client connection you can emulate it with proxy arp. It is not a real OSI layer 2 bridge but behalves like one. How to use it you can look at the Workaround for a wifi bridge on a Raspberry Pi with proxy arp. I suggest for your needs to use the ♦ Static configuration of proxy arp. It is simpler to setup.

Ingo
  • 40,606
  • 15
  • 76
  • 189
  • Thanks for your reply. I had seen and studied the page referred to in the first sentence. However, I wasn't interested in using the onboard wifi as both client and AP because the RPi is on the balcony outside. The wifi signal strength from the router indoors is too low, hence why I want to use the wifi dongle which has a big antenna and a lot better signal strength. The last link you provide seems promising, I will try it. – Nikotine May 01 '20 at 10:25
  • @Nikotine Does the information help you? Do you like the answer? – Ingo May 01 '20 at 10:31
  • I see now that your last link is similar to a solution that I first tried, with [hostapd and dnsmasq](https://pimylifeup.com/raspberry-pi-wifi-extender/). This worked fine, but creates a different subnet. I couldn't connect to and manage the devices that were connected to the repeater, while connected to the router indoors due to these different subnets. This is why I need bridging, I think. – Nikotine May 01 '20 at 10:40
  • I did do an upvote, but because my reputation is too low, it doesn't show. "Thanks for the feedback! Votes cast by those with less than 15 reputation are recorded, but do not change the publicly displayed post score." – Nikotine May 01 '20 at 11:58
  • During my google search, I find many references about enabling ```4addr``` for the wifi interface ([link 1](https://github.com/systemd/systemd/issues/936) | [link 2](https://serverfault.com/questions/152363/bridging-wlan0-to-eth0)). When I do ```sudo iw dev wlx00c0ca66080c set 4addr on``` and ```sudo systemctl restart systemd-networkd.service```, I see that bridging the wifi interface works! But I still don't get an ip address for br0. I would like to hold off using proxy arp for the moment, as I feel I'm very close to a solution. – Nikotine May 01 '20 at 14:30
  • @Nikotine Interesting.. How do you see that bridging works? At least **wlx00c0ca66080c** must be member of the bridge. Please add the information you have just given about `4addr` to your question and add the output of this command to it: `sudo bridge link`. – Ingo May 01 '20 at 14:42
  • Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/107463/discussion-between-ingo-and-nikotine). – Ingo May 01 '20 at 14:48