New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systemd-networkd wireless bridging - need to wait for carrier #936

Open
net147 opened this Issue Aug 12, 2015 · 11 comments

Comments

9 participants
@net147
Contributor

net147 commented Aug 12, 2015

I have configured wlan0 interface to be added to a bridge br0.

/etc/systemd/network/wlan0.network:
[Match]
Name=wlan0

[Network]
Bridge=br0

However, when systemd-networkd is started it tries to add the wireless interface to the bridge and fails to configure wlan0 with:
wlan0: wlan0 : could not join netdev: Operation not supported

Wireless interfaces need to have gained a carrier (by connecting to an existing wireless network or by starting hostapd) before they can be added to a bridge.

Tested using systemd 224.

@poettering

This comment has been minimized.

Member

poettering commented Aug 16, 2015

Do you know which interface and operational states to explicitly wait for? Usually it's more complex than just "carrier" or not "carrier"...

@net147

This comment has been minimized.

Contributor

net147 commented Aug 17, 2015

I don't know about the interface/states. I just know that it works if I restart systemd-networkd after the message "wlan0: Gained carrier" is logged by the systemd-networkd service.

@gdamjan

This comment has been minimized.

Contributor

gdamjan commented Nov 17, 2015

A WIFI interface needs to be set in 4addr mode before it's added to a bridge.
In my setup (Arch, systemd 227) this works fine, ie. even when wpa_supplicant failed, the wifi interface is still added to the bridge, even though it's down.

I currently set the 4addr mode with an udev rule:

ACTION=="add", SUBSYSTEM=="net", ATTRS{idVendor}=="0cf3", ATTRS{idProduct}=="9271", RUN+="/usr/bin/iw dev $name set 4addr on"
@GreatEmerald

This comment has been minimized.

GreatEmerald commented Feb 7, 2016

I can confirm this as well. The workaround by @gdamjan works, too. In my case, wlp1s0 is a pci device, so the udev rule is:

ACTION=="add", SUBSYSTEM=="net", SUBSYSTEMS=="pci", ATTRS{subsystem_vendor}=="0x8086", ATTRS{subsystem_device}=="0x8070", RUN+="/usr/sbin/iw dev $name set 4addr on"
@larsch

This comment has been minimized.

larsch commented Feb 12, 2016

I ran into this issue and couldn't get the suggested udev rule working. I was able to work around it with a simple oneshot service instead:

[Unit]
Description=wlan-4addr
Wants=network.target
Before=network.target systemd-networkd.service
BindsTo=sys-subsystem-net-devices-wlp1s0.device
After=sys-subsystem-net-devices-wlp1s0.device

[Service]
Type=oneshot
ExecStart=/usr/sbin/iw dev wlp1s0 set 4addr on
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
@FuGangqiang

This comment has been minimized.

FuGangqiang commented Sep 20, 2016

I also have the same isuue(archlinux systemd231).

  • br0.netdev
[NetDev]
Name=br0
Kind=bridge
  • wireless.network
[Match]
Name=wlp5s0

[Network]
Bridge=br0

[DHCP]
RouteMetric=10
  • br0.network
[Match]
Name=br0

[Network]
DHCP=ipv4

when I restart systemd-networkd.service, the log is:

Sep 20 23:16:09 fu systemd[1]: Stopping Network Service...
Sep 20 23:16:09 fu systemd[1]: Stopped Network Service.
Sep 20 23:16:09 fu systemd[1]: Starting Network Service...
Sep 20 23:16:09 fu systemd-networkd[13463]: br0: netdev ready
Sep 20 23:16:09 fu systemd-networkd[13463]: wlp5s0: Gained IPv6LL
Sep 20 23:16:09 fu systemd-networkd[13463]: Enumeration completed
Sep 20 23:16:09 fu systemd[1]: Started Network Service.
Sep 20 23:16:09 fu systemd-networkd[13463]: br0: netdev exists, using existing without changing its parameters
Sep 20 23:16:09 fu systemd-networkd[13463]: br0: IPv6 enabled for interface: Success
Sep 20 23:16:09 fu systemd-networkd[13463]: br0: Could not append VLANs: Operation not permitted
Sep 20 23:16:09 fu sudo[13457]: pam_unix(sudo:session): session closed for user root
Sep 20 23:16:09 fu systemd-networkd[13463]: br0: Failed to assign VLANs to bridge port: Operation not permitted
Sep 20 23:16:09 fu systemd-networkd[13463]: br0: Could not set bridge vlan: Operation not permitted
Sep 20 23:16:09 fu kernel: IPv6: ADDRCONF(NETDEV_UP): br0: link is not ready
Sep 20 23:16:09 fu systemd-networkd[13463]: wlp5s0: Could not join netdev: Operation not supported
Sep 20 23:16:09 fu systemd-networkd[13463]: wlp5s0: Failed

and:

$ networkctl 
IDX LINK             TYPE               OPERATIONAL SETUP     
  1 lo               loopback           carrier     unmanaged 
  2 enp4s0           ether              no-carrier  configuring
  3 wlp5s0           wlan               degraded    failed    
  4 br0              ether              no-carrier  configuring
@gdamjan

This comment has been minimized.

Contributor

gdamjan commented Sep 20, 2016

@FuGangqiang you need to set 4addr mode on wlp5s0

@FuGangqiang

This comment has been minimized.

FuGangqiang commented Sep 20, 2016

when I use larsch's method(set 4addr mode on wlp5s0), it works fine, but wpa_supplicant failed(wrong_key)
and network unreachable

@ltkn

This comment has been minimized.

ltkn commented Jul 22, 2017

Hi,

I also have the same issue on Arch and systemd 233.75, my router (sky sr102) seems to support wds/4addr and my wireless card (atheros AR9485 AW-NE186H) too.

I have similar configuration as above apart from the name of wireless interface (wlp2s0). I have set an udev rule, and use systemd-networkd resolvd and wpa_supplicant@wlp2s0.

on fresh boot networkctl gives :

IDX LINK             TYPE               OPERATIONAL SETUP     
  1 lo               loopback           carrier     configured
  2 enp4s0           ether              no-carrier  configuring
  3 wlp2s0           wlan               degraded    configured
  4 br0              ether              no-carrier  configuring

brctl show br0 displays the bridge but no interface attached.
manual dhcpcd br0 or wlp2s0 timeout.

Any help appreciated as it seems to work for some ! Thanks.

@tillschaefer

This comment has been minimized.

tillschaefer commented Feb 18, 2018

I can confirm the issue on Gentoo with systemd 236. Using brctl addif ... works without problems when running it in a shell. The workaround of @larsch works.

@WeiqiChenCN

This comment has been minimized.

WeiqiChenCN commented Jul 26, 2018

iw not works for me

$ sudo iw dev wlx7cdd90a888e1 set 4addr on
command failed: Operation not supported (-95)

Here is my solution

[Unit]
Description=Bridge wlx7cdd90a888e1 to br-gfw
Wants=network.target
BindsTo=sys-subsystem-net-devices-wlx7cdd90a888e1.device
After=sys-subsystem-net-devices-wlx7cdd90a888e1.device sys-subsystem-net-devices-br\\x2dgfw.device network.target

[Service]
#It seem that system's very busy when it just boot-up, brctl addif command will fail.
Type=idle
ExecStart=/sbin/brctl addif br-gfw wlx7cdd90a888e1
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment