18.04 Server Systemd DHCP hangs on DISCOVER, dhclient works

Just installed ubuntu server 18.04. I am unable to get a dhcp lease using systemd-networkd, but using dhclient works fine.

With SYSTEMD_LOG_LEVEL=debug I get:

$ journalctl
...
Apr 29 10:14:09 computer systemd-networkd[2169]: enp3s0: Link state is up-to-date
Apr 29 10:14:09 computer systemd-networkd[2169]: enp3s0: found matching network '/etc/systemd/network/10-netplan-enp3s0.network'
Apr 29 10:14:09 computer systemd-networkd[2169]: wlp2s0: Link is not managed by us
Apr 29 10:14:09 computer systemd-networkd[2169]: lo: Link is not managed by us
Apr 29 10:14:09 computer systemd-networkd[2169]: LLDP: Started LLDP client
Apr 29 10:14:09 computer systemd-networkd[2169]: enp3s0: Started LLDP.
Apr 29 10:14:09 computer systemd-networkd[2169]: enp3s0: Acquiring DHCPv4 lease
Apr 29 10:14:09 computer systemd-networkd[2169]: DHCP CLIENT (0xb7fc15eb): STARTED on ifindex 2
Apr 29 10:14:09 computer systemd-networkd[2169]: enp3s0: Discovering IPv6 routers
Apr 29 10:14:09 computer systemd-networkd[2169]: NDISC: Started IPv6 Router Solicitation client
Apr 29 10:14:09 computer systemd-networkd[2169]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/network1/link/_32 interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=9 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Apr 29 10:14:09 computer systemd-networkd[2169]: NDISC: Sent Router Solicitation, next solicitation in 4s
Apr 29 10:14:09 computer systemd-networkd[2169]: DHCP CLIENT (0xb7fc15eb): DISCOVER
Apr 29 10:14:09 computer systemd-networkd[2169]: lo: Link state is up-to-date
Apr 29 10:14:09 computer systemd-networkd[2169]: lo: Unmanaged
Apr 29 10:14:09 computer systemd-networkd[2169]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/network1/link/_31 interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=10 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Apr 29 10:14:09 computer systemd-timesyncd[581]: Network configuration changed, trying to establish connection.
Apr 29 10:14:09 computer sudo[2164]: pam_unix(sudo:session): session closed for user root
Apr 29 10:14:11 computer systemd-networkd[2169]: DHCP CLIENT (0xb7fc15eb): DISCOVER
Apr 29 10:14:12 computer systemd-networkd[2169]: DHCP CLIENT (0xb7fc15eb): DISCOVER
Apr 29 10:14:14 computer systemd-networkd[2169]: NDISC: Sent Router Solicitation, next solicitation in 8s
Apr 29 10:14:16 computer systemd-networkd[2169]: DHCP CLIENT (0xb7fc15eb): DISCOVER
Apr 29 10:14:21 computer systemd-networkd[2169]: NDISC: No RA received before link confirmation timeout
Apr 29 10:14:21 computer systemd-networkd[2169]: NDISC: Invoking callback for 't'.
Apr 29 10:14:22 computer systemd-networkd[2169]: NDISC: Sent Router Solicitation, next solicitation in 17s
Apr 29 10:14:25 computer systemd-networkd[2169]: DHCP CLIENT (0xb7fc15eb): DISCOVER
Apr 29 10:14:39 computer systemd-networkd[2169]: NDISC: Sent Router Solicitation, next solicitation in 34s
Apr 29 10:14:41 computer systemd-networkd[2169]: DHCP CLIENT (0xb7fc15eb): DISCOVER
Apr 29 10:15:14 computer systemd-networkd[2169]: NDISC: Sent Router Solicitation, next solicitation in 1min 10s
Apr 29 10:15:14 computer systemd-networkd[2169]: DHCP CLIENT (0xb7fc15eb): DISCOVER
Apr 29 10:16:18 computer systemd-networkd[2169]: DHCP CLIENT (0xb7fc15eb): DISCOVER

When I use dhcpd things work just fine:

Apr 29 10:33:00 computer sudo[2213]: user : TTY=tty1 ; PWD=/home/user ; USER=root ; COMMAND=/sbin/dhclient -v enp3s0
Apr 29 10:33:00 computer sudo[2213]: pam_unix(sudo:session): session opened for user root by user(uid=0)
Apr 29 10:33:00 computer dhclient[2214]: Internet Systems Consortium DHCP Client 4.3.5
Apr 29 10:33:00 computer dhclient[2214]: Copyright 2004-2016 Internet Systems Consortium.
Apr 29 10:33:00 computer dhclient[2214]: All rights reserved.
Apr 29 10:33:00 computer dhclient[2214]: For info, please visit
Apr 29 10:33:00 computer dhclient[2214]:
Apr 29 10:33:00 computer dhclient[2214]: Listening on LPF/enp3s0/c0:3f:d5:63:0a:30
Apr 29 10:33:00 computer dhclient[2214]: Sending on LPF/enp3s0/c0:3f:d5:63:0a:30
Apr 29 10:33:00 computer dhclient[2214]: Sending on Socket/fallback
Apr 29 10:33:00 computer dhclient[2214]: DHCPDISCOVER on enp3s0 to 255.255.255.255 port 67 interval 3 (xid=0x536ea71d)
Apr 29 10:33:02 computer dhclient[2214]: DHCPREQUEST of 192.168.64.102 on enp3s0 to 255.255.255.255 port 67 (xid=0x1da76e53)
Apr 29 10:33:02 computer dhclient[2214]: DHCPOFFER of 192.168.64.102 from 192.168.64.1
Apr 29 10:33:02 computer dhclient[2214]: DHCPACK of 192.168.64.102 from 192.168.64.1
Apr 29 10:33:02 computer systemd-networkd[2169]: enp3s0: Adding address: 192.168.64.102/24 (valid forever)

My questions are:

  • Has anybody perhaps seen this and know what the cause could be?
  • Is there any way to find out why it fails to talk with the dhcp server?
  • Is there a safe way (robust to system updates) to make it use dhclient instead?

I have a limited time to get this working before I have to leave and I need to know that it will come back up online without local intervention in case of a reboot.

Edit: the requested information:

$ sudo lshw -C network
*-network DISABLED description: Wireless interface product: Wireless 7260 vendor: Intel Corporation physical id: 0 bus info: pci@0000:02:00.0 logical name: wlp2s0 version: 73 serial: ac:7b:a1:43:12:c8 width: 64 bits clock: 33MHz capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless configuration: broadcast=yes driver=iwlwifi driverversion=4.15.0-48-generic firmware=17.948900127.0 latency=0 link=no multicast=yes wireless=IEEE 802.11 resources: irq:92 memory:d0700000-d0701fff *-network description: Ethernet interface product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller vendor: Realtek Semiconductor Co., Ltd. physical id: 0 bus info: pci@0000:03:00.0 logical name: enp3s0 version: 0c serial: c0:3f:d5:63:0a:30 size: 100Mbit/s capacity: 1Gbit/s width: 64 bits clock: 33MHz capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl8168g-2_0.0.1 02/06/13 ip=192.168.64.102 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s resources: irq:18 ioport:e000(size=256) memory:d0604000-d0604fff memory:d0600000-d0603fff

netplan:

$ cat /etc/netplan/*.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network: version: 2 renderer: networkd ethernets: enp3s0: dhcp4: true

Also:

$ cat /run/systemd/network/*
[Match]
Name=enp3s0
[Network]
DHCP=ipv4
LinkLocalAddressing=ipv6
[DHCP]
UseMTU=true
RouteMetric=100

I've also tried without the [DHCP] stanza and without the LinkLocalAddressing line (shouldn't matter of course) to no avail.

Thanks.

Edit 2: For a later stage in the setup I need to set up a pppoe interface. I now realized that netplan and networkd doesn't support pppoe configuration, so I'm giving up on this and going back to NetworkManager.

6

1 Answer

I encountered exactly the same problem. Although the question is 6 months old, I think it may help others so I posted my solution here.

I ran the tcpdump (tcpdump -n ether host <mac> and port 67 and port 68 -vvv) to inspect the differences in the DHCP Discover packet sent by networkd and dhclient, and found the Client ID set by networkd is a self-generated 18 bytes ID as Client ID, but dhclient is just the MAC address.

The DHCP server probably expects a MAC on Client ID.

Thus the problem can be solved by adding dhcp-identifier: mac in netplan config, e.g:

network: version: 2 renderer: networkd ethernets: enp3s0: dhcp4: true dhcp-identifier: mac
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like