1

I've got a box that I configured as a wired/wireless router, using systemd-networkd to define a bridge (br0) between enp3s0 (wired) and wlp1s0 (wireless) interfaces, with the systemd-networkd DHCP server running on the bridge. Static leases for clients are defined in the bridge's network configuration file using [DHCPServerStaticLease] directives. I'm finding however that the defined static IP is not being given to the client connected on the enp3s0 interface of the bridge, whereas they are being given to clients connected on wlp1s0. The client on enp3s0 is getting given the IP address 10.0.0.147 from the DHCP pool whereas I want it to be 10.0.0.10 as per the [DHCPServerStaticLease] directive below.

Here are the configurations that define the various interfaces:

/etc/systemd/network/10-br0.netdev:

[NetDev]
Name=br0
Kind=bridge

/etc/systemd/network/15-br0.network:

[Match]
Name=br0

[Network] Address=10.0.0.1/24 DHCPServer=yes DNS=10.0.0.1 Domains=lan

[DHCPServer] PoolOffset=100 PoolSize=100

[DHCPServerStaticLease]

Wired client - this IP does not get assigned (I've triple checked this MAC and it's correctly entered on client and server)

MACAddress=01:23:45:67:89:10 Address=10.0.0.10

[DHCPServerStaticLease]

Wireless client - this IP gets assigned correctly

MACAddress=12:34:56:78:90:12 Address=10.0.0.20

/etc/systemd/network/20-lan.network:

[Match]
Name=enp3s0

[Network] Bridge=br0

The wireless interface is provided by hostapd in /etc/hostapd/hostapd.conf. This contains, among other things, the commands to add the wireless interface to the bridge:

interface=wlp1s0
bridge=br0

With everything up and running, upon connecting the wired client I don't see any information regarding the IP address assignment in the journal (with debug logging enabled for systemd-networkd following the steps in this answer), just that the request was acknowledged, which doesn't seem very helpful to find out what's going on:

$ journalctl --unit systemd-networkd -r | grep "br0: DHCPv4"
Jan 01 21:36:59 router systemd-networkd[753]: br0: DHCPv4 server: ACK (0x6c2c7b71)
Jan 01 21:36:59 router systemd-networkd[753]: br0: DHCPv4 server: REQUEST (rebinding/renewing) (0x6c2c7b71)

Does anyone see what's wrong with my setup, or at least know how to get more information out of the DHCP server when it's deciding to ignore the static assignment for the wired client?

Sean
  • 111

1 Answers1

2

Problem

This appears to be a bug in Systemd <= 253. When clients don't send their MAC address in the DHCP client identifier, then the MAC comparison does not work. In your case, the wireless client probably does send the MAC, while the wired client does not.

This was fixed in the following pull request: https://github.com/systemd/systemd/pull/27313

Client Workaround

As a workaround, ensure that the DHCP client sends the client identifier as part of the DHCP request.

systemd-networkd

In case of Systemd's networkd, by default the DUID is used. To change it to the MAC address, add the following network config:

[DHCPv4]
ClientIdentifier=mac

You can find more information in man 5 systemd.network.

dhclient

If you use dhclient, you can turn off the use of DUIDs: Force to use MAC address as DHCP client ID on Debian Buster

Solution

Upgrade to Systemd >= 254 or apply a backport of the patch.