Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
systemd does not release DHCP IP during networkd restart #1546
Comments
poettering
added
the
network
label
Oct 13, 2015
|
@teg, any idea? |
|
Thanks for the quick response and looking into this. On a related note, I'm wondering if it is also possible to enhance networkd to persist a DHCP acquired IP address across system reboot and networkd restart. The following is a DHCP DISCOVER packet captured when Ubuntu 14.04 (does not use systemd) VM was rebooted - please note the "Requested-IP Option" vs. the systemd discover packet above. Thanks, vmware@vlinux:~/Desktop/tmp$ sudo tcpdump -envr dhcp_1404.cap udp port 68 |
thx1111
commented
Oct 15, 2015
|
networkd does not reconfigure, remove, or "flush" already configured addresses - Issue 1352 and Issue 780. I requested a feature, some kind of "FlushAddresses=yes" option, to have networkd remove "old" addresses when invoking "sysemctl restart " or "systemctl reload-or-restart" on systemd-networkd. Not flushing old addresses might be desirable with "systemctl start ...", perhaps to continue an established network connection. Lennart refused to discuss the issue here. You are not the only one to have been "bitten" by this behavior. Keep trying. You might have better luck, getting a fix. For now, the workaround is to modify the systemd-networkd.service file, to flush the existing interface addresses before configuring any static or dynamic addresses, using a line like "ExecStartPre=/usr/bin/ip addr flush dev eth0" in the [Service] section. |
lht
commented
Nov 20, 2015
|
May be a duplicates of #780 |
michalpristas
commented
Feb 17, 2016
|
is it flushing now? if so which version got the fix? |
added a commit
to ssahani/systemd
that referenced
this issue
May 6, 2016
This was referenced May 7, 2016
|
Just a quick comment on the behavior observed here: the DHCP server handing out a new address when it already has handed out a valid lease to the same ClientID is broken behavior. It should give the same address again. We may of course choose to flush the old address when we get a new one, but on the other hand the lease will be valid, so we could also chose to keep both as we currently do. The same problem would occur if we provided the old address but the server ignored it and gave us a new one. |
|
The packet traces I analyzed showed new address being handed out was because the client holding on to the old address responding to the ARP from DHCP server after initiating a DISCOVER. Flushing it works because DHCP server determines the address is not in use and hands out the leased address back. This is probably designed to handle the case where client suffers a catastrophic outage and reboots. The correct way would perhaps be for the client to send a DHCPRELEASE but that will likely end the lease and might open doors for a different address on networkd restart. So the current solution is perhaps the better solution. |
vinaykul
closed this
May 20, 2016
|
@vinaykul thanks for the follow-up. That explains it. The server should probably be a bit more clever and realize the owner of the IP is the same as the one requesting the lease, but not much we can do about that... shrug |
SpComb
commented
Jul 6, 2016
•
|
I'm running into the same issue where every This is problematic because the ISP has a per-circuit limit on the number of available leases, and after a couple networkd restarts the ISP refuses to hand out any more new leases. If you now reboot, then you will be unable to get a new DHCP lease until the existing ones expire. This doesn't happen with the old dhclient, presumeably because it does a DHCPREQUEST to renew its existing lease before falling back to a DHCPDISCOVER? tcpdump below, with the DHCPDISCOVER and resulting ICMP ping to the previous 82.181.208.58 lease from the ISP, followed by a new lease for 62.78.183.59. Followed by an ARP probe from the initial DHCP lease (62.78.183.68).
|
r7vme
commented
Jul 16, 2017
|
I'm also affected by this issue (looks the same). systemd version 231 (both in host and vm) I have Container Linux VM connected via bridge (dhcp server). Problem is that vm tries to get ip address two times: 1) While initramfs phase 2) when switched to real root. I have very small dhcp network /30 for only one dhcp client. That's why VM ends up without any IP. In networkd logs i see that first try was successful, but second one is not. Continuous DHCPDISCOVER packages.
Interesting fact, that VM ip is not presented in ARP table on the host and is not reachable by ICMP. Host bridge configuration:
|
r7vme
commented
Jul 16, 2017
|
Here is the tcpdump
restart of systemd-networkd immediately fixes the problem :/ |
vinaykul commentedOct 12, 2015
With version 224 and earlier, we found a cleanup issue during systemd-networkd restart. networkd requests a new DHCP IP without releasing the previously acquired DHCP IP. Please see the attached packet capture (filtered) from VMWare fusion host system, and a screen-shot of the resultant secondary IP address acquisition.
I scanned through the open and recently closed issues but didn't find a report of this issue. Please let me know if I missed a duplicate.
Thanks,
Vin
Unable to upload txt or pdf file, so below is a paste of packet capture data.
vmware@vlinux:~/Desktop/systemd224$ tcpdump -nvr pkt.cap icmp or udp port 67💿 00:02:00:00🆎 11:40:4b:42:90:1a:7d:8f:27💿 00:02:00:00🆎 11:40:4b:42:90:1a:7d:8f:27
reading from file pkt.cap, link-type EN10MB (Ethernet)
13:39:12.205358 IP (tos 0xc0, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 313)
0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:0c:29:c4:00:12, length 285, xid 0x6d817759, secs 1, Flags [none]
Client-Ethernet-Address 00:0c:29:c4:00:12
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Discover
Client-ID Option 61, length 19: hardware-type 255, 4e:3d:48
Parameter-Request Option 55, length 8:
Subnet-Mask, Default-Gateway, Hostname, Domain-Name
Domain-Name-Server, NTP, Static-Route, Classless-Static-Route
MSZ Option 57, length 2: 576
Hostname Option 12, length 4: "p224"
13:39:12.205575 IP (tos 0x10, ttl 16, id 0, offset 0, flags [none], proto ICMP (1), length 48)
192.168.12.254 > 192.168.12.144: ICMP echo request, id 35034, seq 0, length 28
13:39:12.205660 IP (tos 0x0, ttl 128, id 41940, offset 0, flags [none], proto ICMP (1), length 48)
192.168.12.254 > 192.168.12.144: ICMP echo request, id 35034, seq 0, length 28
13:39:13.205938 IP (tos 0x10, ttl 16, id 0, offset 0, flags [none], proto UDP (17), length 328)
192.168.12.254.67 > 192.168.12.144.68: BOOTP/DHCP, Reply, length 300, xid 0x6d817759, secs 1, Flags [none]
Your-IP 192.168.12.144
Server-IP 192.168.12.254
Client-Ethernet-Address 00:0c:29:c4:00:12
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Offer
Server-ID Option 54, length 4: 192.168.12.254
Lease-Time Option 51, length 4: 1800
Subnet-Mask Option 1, length 4: 255.255.255.0
Default-Gateway Option 3, length 4: 192.168.12.2
Domain-Name Option 15, length 11: "localdomain"
Domain-Name-Server Option 6, length 4: 192.168.12.2
13:39:13.206354 IP (tos 0xc0, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 325)
0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:0c:29:c4:00:12, length 297, xid 0x6d817759, secs 1, Flags [none]
Client-Ethernet-Address 00:0c:29:c4:00:12
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Request
Client-ID Option 61, length 19: hardware-type 255, 4e:3d:48
Parameter-Request Option 55, length 8:
Subnet-Mask, Default-Gateway, Hostname, Domain-Name
Domain-Name-Server, NTP, Static-Route, Classless-Static-Route
MSZ Option 57, length 2: 576
Server-ID Option 54, length 4: 192.168.12.254
Requested-IP Option 50, length 4: 192.168.12.144
Hostname Option 12, length 4: "p224"
13:39:13.207361 IP (tos 0x10, ttl 16, id 0, offset 0, flags [none], proto UDP (17), length 328)
192.168.12.254.67 > 192.168.12.144.68: BOOTP/DHCP, Reply, length 300, xid 0x6d817759, secs 1, Flags [none]
Your-IP 192.168.12.144
Server-IP 192.168.12.254
Client-Ethernet-Address 00:0c:29:c4:00:12
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: ACK
Server-ID Option 54, length 4: 192.168.12.254
Lease-Time Option 51, length 4: 1800
Subnet-Mask Option 1, length 4: 255.255.255.0
Default-Gateway Option 3, length 4: 192.168.12.2
Domain-Name Option 15, length 11: "localdomain"
Domain-Name-Server Option 6, length 4: 192.168.12.2
======>>>>>> NOTE: 'systemctl restart system-networkd' at this point.
13:40:15.608265 IP (tos 0xc0, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 313)💿 00:02:00:00🆎 11:40:4b:42:90:1a:7d:8f:27💿 00:02:00:00🆎 11:40:4b:42:90:1a:7d:8f:27💿 00:02:00:00🆎 11:40:4b:42:90:1a:7d:8f:27
0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:0c:29:c4:00:12, length 285, xid 0xac26bb3a, secs 1, Flags [none]
Client-Ethernet-Address 00:0c:29:c4:00:12
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Discover
Client-ID Option 61, length 19: hardware-type 255, 4e:3d:48
Parameter-Request Option 55, length 8:
Subnet-Mask, Default-Gateway, Hostname, Domain-Name
Domain-Name-Server, NTP, Static-Route, Classless-Static-Route
MSZ Option 57, length 2: 576
Hostname Option 12, length 4: "p224"
13:40:15.608378 IP (tos 0x10, ttl 16, id 0, offset 0, flags [none], proto ICMP (1), length 48)
192.168.12.254 > 192.168.12.144: ICMP echo request, id 35034, seq 0, length 28
13:40:15.608411 IP (tos 0x0, ttl 128, id 41945, offset 0, flags [none], proto ICMP (1), length 48)
192.168.12.254 > 192.168.12.144: ICMP echo request, id 35034, seq 0, length 28
13:40:15.608588 IP (tos 0x10, ttl 64, id 14924, offset 0, flags [none], proto ICMP (1), length 48)
192.168.12.144 > 192.168.12.254: ICMP echo reply, id 35034, seq 0, length 28
13:40:15.608604 IP (tos 0x0, ttl 64, id 14925, offset 0, flags [none], proto ICMP (1), length 48)
192.168.12.144 > 192.168.12.254: ICMP echo reply, id 35034, seq 0, length 28
13:40:17.714302 IP (tos 0xc0, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 313)
0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:0c:29:c4:00:12, length 285, xid 0xac26bb3a, secs 2, Flags [none]
Client-Ethernet-Address 00:0c:29:c4:00:12
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Discover
Client-ID Option 61, length 19: hardware-type 255, 4e:3d:48
Parameter-Request Option 55, length 8:
Subnet-Mask, Default-Gateway, Hostname, Domain-Name
Domain-Name-Server, NTP, Static-Route, Classless-Static-Route
MSZ Option 57, length 2: 576
Hostname Option 12, length 4: "p224"
13:40:17.714553 IP (tos 0x10, ttl 16, id 0, offset 0, flags [none], proto ICMP (1), length 48)
192.168.12.254 > 192.168.12.145: ICMP echo request, id 30938, seq 0, length 28
13:40:18.715873 IP (tos 0x10, ttl 16, id 0, offset 0, flags [none], proto UDP (17), length 328)
192.168.12.254.67 > 192.168.12.145.68: BOOTP/DHCP, Reply, length 300, xid 0xac26bb3a, secs 2, Flags [none]
Your-IP 192.168.12.145
Server-IP 192.168.12.254
Client-Ethernet-Address 00:0c:29:c4:00:12
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Offer
Server-ID Option 54, length 4: 192.168.12.254
Lease-Time Option 51, length 4: 1800
Subnet-Mask Option 1, length 4: 255.255.255.0
Default-Gateway Option 3, length 4: 192.168.12.2
Domain-Name Option 15, length 11: "localdomain"
Domain-Name-Server Option 6, length 4: 192.168.12.2
13:40:18.716098 IP (tos 0xc0, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 325)
0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:0c:29:c4:00:12, length 297, xid 0xac26bb3a, secs 3, Flags [none]
Client-Ethernet-Address 00:0c:29:c4:00:12
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Request
Client-ID Option 61, length 19: hardware-type 255, 4e:3d:48
Parameter-Request Option 55, length 8:
Subnet-Mask, Default-Gateway, Hostname, Domain-Name
Domain-Name-Server, NTP, Static-Route, Classless-Static-Route
MSZ Option 57, length 2: 576
Server-ID Option 54, length 4: 192.168.12.254
Requested-IP Option 50, length 4: 192.168.12.145
Hostname Option 12, length 4: "p224"
13:40:18.717257 IP (tos 0x10, ttl 16, id 0, offset 0, flags [none], proto UDP (17), length 328)
192.168.12.254.67 > 192.168.12.145.68: BOOTP/DHCP, Reply, length 300, xid 0xac26bb3a, secs 3, Flags [none]
Your-IP 192.168.12.145
Server-IP 192.168.12.254
Client-Ethernet-Address 00:0c:29:c4:00:12
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: ACK
Server-ID Option 54, length 4: 192.168.12.254
Lease-Time Option 51, length 4: 1800
Subnet-Mask Option 1, length 4: 255.255.255.0
Default-Gateway Option 3, length 4: 192.168.12.2
Domain-Name Option 15, length 11: "localdomain"
Domain-Name-Server Option 6, length 4: 192.168.12.2
13:40:19.718946 IP (tos 0x0, ttl 128, id 41946, offset 0, flags [none], proto ICMP (1), length 48)
192.168.12.254 > 192.168.12.145: ICMP echo request, id 30938, seq 0, length 28
13:40:19.719065 IP (tos 0x0, ttl 64, id 51499, offset 0, flags [none], proto ICMP (1), length 48)
192.168.12.145 > 192.168.12.254: ICMP echo reply, id 30938, seq 0, length 28
vmware@vlinux:~/Desktop/systemd224$