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

 

If you are looking for the equivalent Debian/Ubuntu/Mint solution then check this dhclient solution.


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

  • Convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/413. convert-im6.q16: no images defined `pts-time.jpg' @ error/convert.c/ConvertImageCommand/3258. solution ImageMagick P
  • Apache PHP sending expires header solution cannot use cache with CDN
  • How to install virt-manager in Mint 22/Ubuntu 22
  • Infiniband Guide
  • python mysql install error: /bin/sh: 1: mysql_config: not found /bin/sh: 1: mariadb_config: not found /bin/sh: 1: mysql_config: not found mysql_config --version
  • FreePBX 17 How To Add a Trunk
  • Docker Container Onboot Policy - How to make sure a container is always running
  • FreePBX 17 How To Add Phones / Extensions and Register
  • Warning: The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes. solution
  • Cisco How To Use a Third Party SIP Phone (eg. Avaya, 3CX)
  • Cisco Unified Communication Manager (CUCM) - How To Add Phones
  • pptp / pptpd not working in DD-WRT iptables / router
  • systemd-journald high memory usage solution
  • How to Install FreePBX 17 in Linux Debian Ubuntu Mint Guide
  • How To Install Cisco's CUCM (Cisco Unified Communication Manager) 12 Guide
  • Linux Ubuntu Redhat How To Extract Images from PDF
  • Linux and Windows Dual Boot Issue NIC Won't work After Booting Windows
  • Cisco CME How To Enable ACD hunt groups
  • How to install gns3 on Linux Ubuntu Mint
  • How to convert audio for Asterisk .wav format