[systemd-devel] systemd-networkd bridge with DHCP not working

Tom Gundersen teg at jklm.no
Mon Mar 17 13:52:35 PDT 2014


Hi Henrik,

On Mon, Mar 17, 2014 at 5:01 PM, Henrik /KaarPoSoft
<henrik at kaarposoft.dk> wrote:
> Dear all,
>
> *SUMMARY*
>
> I am trying to replace dhcpcd with systemd-networkd.
> Using systemd-networkd on a single physical interface works fine.
> However, trying to use DHCP on a bridge fails for me.
> Any help would be most appreciated.
>
>
>
> *WORKS*
>
> The single physical interface scenario which works:
>
> /etc/systemd/network/50-dhcp.network contains:
> --------------------------------------------------
> [Match]
> Name=en*
> [Network]
> DHCP=yes
> --------------------------------------------------
>
> "ip addr" shows:
> --------------------------------------------------
> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group
> default
>     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>     inet 127.0.0.1/8 scope host lo
>        valid_lft forever preferred_lft forever
>     inet6 ::1/128 scope host
>        valid_lft forever preferred_lft forever
> 2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
> UP group default qlen 1000
>     link/ether 10:bf:48:d7:68:e1 brd ff:ff:ff:ff:ff:ff
>     inet 192.168.99.161/24 brd 192.168.99.255 scope global eno1
>        valid_lft forever preferred_lft forever
>     inet6 fe80::12bf:48ff:fed7:68e1/64 scope link
>        valid_lft forever preferred_lft forever
> 3: enp11s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast
> state DOWN group default qlen 1000
>     link/ether 10:bf:48:d7:64:aa brd ff:ff:ff:ff:ff:ff
> 4: sit0: <NOARP> mtu 1480 qdisc noop state DOWN group default
>     link/sit 0.0.0.0 brd 0.0.0.0
> --------------------------------------------------
>
> Note: I will remove lo, enp11s0, and sit0 output from further "ip addr"
> output.
>
> So, I got an IP address and I have connectivity.
>
>
>
> *FAILS*
>
>
> Now I try to set up a simple bridge, with just one physical interface
> (eno1), trying to get the bridge to get its IP address from DHCP:
>
> --------------------------------------------------
> rm -f /etc/systemd/network/50-dhcp.network
>
> cat > /etc/systemd/network/42-br0.netdev<<EOF
> [NetDev]
> Name=br0
> Kind=bridge
> EOF
>
> cat > /etc/systemd/network/44-en.network<<EOF
> [Match]
> Name=eno1
> [Network]
> Bridge=br0
> EOF
>
> cat > /etc/systemd/network/46-br0.network<<EOF
> [Match]
> Name=br0
> [Network]
> DHCP=yes
> EOF
> --------------------------------------------------
>
> "ip addr" shows:
> --------------------------------------------------
> 2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master
> br0 state UP group default qlen 1000
>     link/ether 10:bf:48:d7:68:e1 brd ff:ff:ff:ff:ff:ff
>     inet6 fe80::12bf:48ff:fed7:68e1/64 scope link
>        valid_lft forever preferred_lft forever
> 5: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
> group default
>     link/ether 10:bf:48:d7:68:e1 brd ff:ff:ff:ff:ff:ff
>     inet6 fe80::78e6:aff:feca:c0ac/64 scope link
>        valid_lft forever preferred_lft forever
> --------------------------------------------------
>
> I note here, that the inet6 address for eno1 matches the MAC, whereas the
> inet6 address for br0 does NOT match the MAC for br0 (which is, by the way,
> the same as the MAC for eno1).
>
> "journalctl -b | grep DHCP" gives:
> --------------------------------------------------
> Mar 17 16:28:37 komplett-21 systemd-networkd[2678]: DHCP CLIENT: set MAC
> address to 7a:e6:0a:ca:c0:ac
> Mar 17 16:28:37 komplett-21 systemd-networkd[2678]: br0: acquiring DHCPv4
> lease
> Mar 17 16:28:37 komplett-21 systemd-networkd[2678]: DHCP CLIENT: STARTED
> Mar 17 16:28:37 komplett-21 systemd-networkd[2678]: DHCP CLIENT: DISCOVER
> Mar 17 16:28:37 komplett-21 systemd-networkd[2678]: DHCP CLIENT: STOPPED
> Mar 17 16:28:40 komplett-21 systemd-networkd[2678]: br0: acquiring DHCPv4
> lease
> Mar 17 16:28:40 komplett-21 systemd-networkd[2678]: DHCP CLIENT: STARTED
> Mar 17 16:28:40 komplett-21 systemd-networkd[2678]: DHCP CLIENT: DISCOVER
> --------------------------------------------------
>
> followed by several combinations of:
> --------------------------------------------------
> Mar 17 16:28:42 komplett-21 systemd-networkd[2678]: DHCP CLIENT: ignoring
> packet: to port 9303, which is not the DHCP client port (68)
> Mar 17 16:28:42 komplett-21 systemd-networkd[2678]: DHCP CLIENT: DISCOVER
> Mar 17 16:29:16 komplett-21 systemd-networkd[2678]: DHCP CLIENT: ignoring
> packet: to port 138, which is not the DHCP client port (68)
> --------------------------------------------------
>
> So, I do not get an IP address from DHCP, and I do NOT have connectivity.
> But I DO receive broadcasts from the LAN (ports 9303, 138, etc).
>
> I note that the systemd-networkd DHCP CLIENT says it is setting the MAC
> address to something else than what "ip addr" says the br0 IP address is
> (but the DHCP CLIENT MAC address matches the last part of the inet6
> address).
>
> Question: Where did systemd-networkd DHCP CLIENT get this MAC address?
>
>
>
> *SURPRISE*
>
>
> Now if I run "tcpdump -i br0" or "wireshark", I see that that the DHCP
> REQUEST comes from 7a:e6:0a:ca:c0:ac.
>
> I presume, that the problem is, that the bridge thinks its MAC is
> 10:bf:48:d7:68:e1 which is the same as the MAC for eno1, but that is NOT the
> same MAC address systemd-networkd DHCP is using.
>
> tcpdump does something to the br0 interface, so after running "tcpdump -i
> br0", I finally get an IP address for the bridge:
>
> --------------------------------------------------
> 2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master
> br0 state UP group default qlen 1000
>     link/ether 10:bf:48:d7:68:e1 brd ff:ff:ff:ff:ff:ff
>     inet6 fe80::12bf:48ff:fed7:68e1/64 scope link
>        valid_lft forever preferred_lft forever
> 5: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
> group default
>     link/ether 10:bf:48:d7:68:e1 brd ff:ff:ff:ff:ff:ff
>     inet 192.168.99.175/24 brd 192.168.99.255 scope global br0
>        valid_lft forever preferred_lft forever
>     inet6 fe80::78e6:aff:feca:c0ac/64 scope link
>        valid_lft forever preferred_lft forever
> --------------------------------------------------
>
> I would have thought that "tcpdump -i br0" would bring the interface into
> "Promiscuous mode", but neither the "ip addr" command, nor "netstat -i"
> indicates that either eno1 or br0 are in "Promiscuous mode".
>
>
>
> *HELP*
>
>
> Any help on what to put into the systemd configuration files to make the
> bridge DHCP work would be most appreciated.

Your configuration seems correct, and your analysis too: we were not
picking up the bridge's changing MAC address.

This should have been fixed in git (for some time, but possibly not
before the last release). I can verify that the setup you pasted above
works for me with current git. If you are still experiencing problems,
please let me know.

Cheers,

Tom


More information about the systemd-devel mailing list