CentOS 6 and 7 / RHEL Persistent DHCP Solution

It is very silly but the default on the ifup-eth script tells dhclient ( the program that obtains a DHCP IP address if you have selected DHCP in your ifcfg-eth* config file) to EXIT / QUIT if the first attempt to obtain a lease fails.

No amount of dhclient.conf settings will fix this because if dhclient is started with -1 (which it is by default) then dhclient will quit.

This is obviously very bad for MOST cases.  Say for example you have a power outage or you initially power on the system, if for some reason the link takes a few more seconds to come up, dhclient has probably already quit being unable to obtain a lease the first time.

So the option to set in your ifcfg-eth0 config file to solve the dhclient persistent issue:

PERSISTENT_DHCLIENT=1

The difference in how dhclient is started now looks like this:

/sbin/dhclient -H hostname -q -lf /var/lib/dhclient/dhclient-eth0.leases -pf /var/run/dhclient-eth0.pid eth0

If you don't have the option above you will see a "-1" which indicates that it would quit if the first lease attempt fails:

/sbin/dhclient -H hostname -1 -q -lf /var/lib/dhclient/dhclient-eth0.leases -pf /var/run/dhclient-eth0.pid eth0


Tags:

centos, rhel, persistent, dhcp, solutionit, default, ifup, eth, dhclient, obtains, ip, selected, ifcfg, config, obtain, lease, fails, conf, settings, outage, initially, unable, persistent_dhclient, sbin, hostname, lf, var, lib, leases, pf, pid, quot, indicates,

Latest Articles

  • Linux Ubuntu Cannot Print Large Images
  • Cannot Print PDF Solution and Howto Resize
  • Linux Console Login Screen TTY Change Message
  • Apache Cannot Start Listening Already on 0.0.0.0
  • MySQL Bash Query to pipe input directly without using heredoc trick
  • CentOS 6 and 7 / RHEL Persistent DHCP Solution
  • Debian Ubuntu Mint rc-local service startup error solution rc-local.service: Failed at step EXEC spawning /etc/rc.local: Exec format error
  • MySQL Cheatsheet Guide and Tutorial
  • bash script kill whois or other command that is running for too long
  • Linux tftp listens on all interfaces and IPs by DEFAULT Security Risk Hole Solution
  • python import docx error
  • Cisco Unified Communications Manager Express Cheatsheet CUCME CME
  • Linux Ubuntu Debian Missing privilege separation directory: /var/run/sshd
  • bash how to count the number of columns or words in a line
  • bash if statement how to test program output without assigning to variable
  • RTNETLINK answers: Network is unreachable
  • Centos 7 how to save iptables rules like Centos 6
  • nfs tuning maximum amount of connections
  • qemu-kvm error "Could not initialize SDL(No available video device) - exiting"
  • Centos 7 tftpd will not work with selinux enabled