I have a device I want to upgrade its filesystem and packages.
What's installed now is some kind of buildroot with busybox. Its DHCP client is udhcpc and I run it like this /sbin/udhcpc -R -b -p /var/run/udhcpc.eth0.pid -i eth0 in order to gain IP for eth0.

I'm upgrading the filesystem and packages to be Ubuntu 18.04 based instead of buildroot.
As part of it, the new DHCP client is systemd-networkd.

The IP given with udhcpc before the FS upgrade is different from the IP given after with systemd-networkd.
This is for the same interface with the same mac.

Is there a way somehow to keep the old IP?

  • The usual method is to configure the DHCP Server always to issue the same IP address for the given MAC Commented Aug 18, 2021 at 12:00
  • @roaima so you're saying that's an issue with the DHCP server only?
    – hudac
    Commented Aug 18, 2021 at 12:02
  • No I didn't say that. I said that the usual way to guarantee a particular IP address in a DHCP environment was to configure the DHCP Server Commented Aug 18, 2021 at 12:05
  • The thing is, when I move back to udhcpc from systemd-networkd it gets back to the old DHCP IP
    – hudac
    Commented Aug 18, 2021 at 12:07
  • 1
    Also maybe the new dhcp client uses (IPv4) DUID while the older didn't: datatracker.ietf.org/doc/html/rfc4361
    – A.B
    Commented Aug 18, 2021 at 19:56

1 Answer 1


According to the systemd-networkd documentation:

[DHCPv4] Section Options



The DHCPv4 client identifier to use. Takes one of mac, duid or duid-only. If set to mac, the MAC address of the link is used. If set to duid, an RFC4361-compliant Client ID, which is the combination of IAID and DUID (see below), is used. If set to duid-only, only DUID is used, this may not be RFC compliant, but some setups may require to use this. Defaults to duid.

  • If you want to revert to the behavior obtained by the previous installation and it didn't use any DUID, then use this parameter:

  • If the older installation was using a DUID and possibly an interface specific IAID, these values will also have to be retrieved from it. They should then be used in, or affect various other parameters described in the documentation

    ... ?

Hopefully you are in the former case.

Now, as it's about a server so some stability should be achievable, as @roaima wrote in a comment, the proper way to keep the same IP address in a simple network setup is probably to change settings on the DHCP server to leave no choice on the DHCP client side.

  • Looks like the former case doesn't help :( . Do you know why duid is the default? why is is better than mac? And, how these values can be retrieved ? Thanks
    – hudac
    Commented Aug 19, 2021 at 19:52
  • Details on the "why" are in the RFC and the RFCs it links to, sorry. For the default, ask the developpers. About your case, if you think the former installation was using a duid it's time to check its configuration. The word duid doesn't appear in its man page so I don't think there was any duid in use before. You should describe (by editing your question) what you tried that didn't work in case it helps resolve your case
    – A.B
    Commented Aug 19, 2021 at 21:15
  • I checked again. Actually using ClientIdentifier=mac just doesn't work. I still see in the dhcp request client identifier of Enterprise-number: Tom Gundersen (systemd). I have systemd version 237 of ubuntu 18.04. This should solve it because in the old filesystem, the client identifier is mac. :/
    – hudac
    Commented Aug 25, 2021 at 12:30
  • 1
    ok, I've moved ClientIdentifier=mac to be under `[DHCP] section and it worked! Thanks!
    – hudac
    Commented Aug 25, 2021 at 12:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .