I would like my DHCP clients (CentOS 7) cache the last IP assigned (reserved) for them and use that if the DHCP server is down.

Below is the current network interface configuration of my DHCP clients:

vi '/etc/sysconfig/network-scripts/ifcfg-enp0s8'


vi '/etc/sysconfig/network'

# Created by anaconda


FURTHER QUESTION: If this is possible (or even a good practice) is this something that should be set on the DHCP server? NOTE: I'm using ISC KEA DHCP (DHCPv4) as DHCP server.

  • If the server is down, it is down, no service. – Rui F Ribeiro Aug 14 '18 at 22:12
  • Sorry my insistence, but there is no way for DHCP clients to "lease" (locally) the last IP they used? That is the question. Thanks! =D – Eduardo Lucio Aug 14 '18 at 22:42
  • 1
    @EduardoLucio: I think I understand what you're trying to do, but read my answer & decide for yourself. Let me know if something's not clear. – Seamus Aug 15 '18 at 0:45

Let me first try to make sure I understand your question: You seem to be asking for a feature that I'd call "client caching" of its last used IP address - See my comment to @RuiFRibeiro's answer. If that's correct, dhcpcd may have you covered through its "fallback" feature.

To quote the online documentation:

It is possible to configure a static profile within dhcpcd and fall back to it when DHCP lease fails. This is useful particularly for headless machines, where the static profile can be used as "recovery" profile to ensure that it is always possible to connect to the machine.

And wrt your NOTE: I do not know if this is something that should be set on the DHCP server - ISC KEA DHCP (DHCPv4), in my case.

No - the "Fallback" is not set on the server, it is set in the client's DHCP configuration file.

Hope that helps.

  • You perfectly "captured" my question and what is the scenario of it! I need a fallback to ensure that it is always possible to connect to the machine! Sorry for my lousy English. – Eduardo Lucio Aug 15 '18 at 2:10
  • 1
    Glad it helped - and sorry for my lousy Italian, Spanish, French, etc, etc. :) – Seamus Aug 15 '18 at 2:13

You are inventing stuff.

The protocol does define nowadays that the client will try to request the last given IP from the DHCP server when booting. The last IP address is saved in the filesystem, and the DHCP daemon will first ask for it from the DHCP server, and only if refused will try to get a different one.

However, the client DHCP daemon won't try to give you the last IP address if there is no DHCP service present in the network. Imagine the problems it would cause detecting when you had a good or bad connection, or the possibility of duplicate IP addresses due to flaky cables.

  • 1
    I think the question is more like, "is there a way to cache the last IP assigned, and use that if the DHCP server is down/doesn't respond. Assuming there were no IP conflicts while the DHCP server was operating, then the primary risk of address collisions for doing this would seem to be clients that had been off for some time. – Seamus Aug 15 '18 at 0:26
  • @Seamus Indeed that is one of the situations where it could go wrong. – Rui F Ribeiro Aug 15 '18 at 1:39
  • I think my English would not let me ask a good question. What I need is just what @Samamus realized very well: a fallback. To be quite frank I do not even know if what I'm asking is right or wrong. If it is a bad practice, then I can opt for something else that you can guide me. Thank you! – Eduardo Lucio Aug 15 '18 at 2:09

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.