10

I need to check the client DHCP settings, which I expect to be in the file /etc/dhcp/dhclient.conf, but there is no such files there.

What is the location of this file in RHEL 6, on 64 bit?

  • The question has been asked last year, I know, but i just wanted to add my two cents: why not use locate dhclient.conf or find / -iname dhclient.conf -print ? or even simpler but dirtier locate dhclient or locate dhcp – Sergiy Kolodyazhnyy Feb 13 '15 at 10:16
9

A trick I'll often use is to take a look at the output of this command, here I'm running it on CentOS 6, but it should still be applicable to you on RHEL as well:

$ ps -eaf | grep dhcli
root      1044     1  0 Jan17 ?        00:00:00 /sbin/dhclient -1 -q -cf /etc/dhcp/dhclient-eth0.conf -lf /var/lib/dhclient/dhclient-eth0.leases -pf /var/run/dhclient-eth0.pid eth0
root      3771  3738  0 19:00 pts/0    00:00:00 grep dhcli

If you notice in the output, the file you're looking for is called /etc/dhcp/dhclient-eth0.conf, and not dhclient.conf. But this is only telling you part of the story. If you're intending to inject additional settings into dhclient when it starts up then refer to the official RHEL 6 documentation here, titled: 14.3. Configuring a DHCP Client.

Also if you consult the man page for dhclient you'll notice this bit for the -cf switch:

-cf <config-file>
      Path to the client configuration file.  If unspecified, the default 
      /etc/dhcp/dhclient.conf is used.

So the file dhclient.conf isn't the file you're likely looking for, it's whatever interface you're running dhclient on, in this case eth0, so the file would be dhclient-eth0.conf.

Digging deeper

If you take a look at the startup scripts for networking you'll likely come across this file, /etc/sysconfig/network-scripts/ifup-eth. Peeking inside can show you what's going on if you're interested:

...
# allow users to use generic '/etc/dhclient.conf' (as documented in manpage!) 
# if per-device file doesn't exist or is empty
if [ -s /etc/dhcp/dhclient-${DEVICE}.conf ]; then
   DHCLIENTCONF="-cf /etc/dhcp/dhclient-${DEVICE}.conf";
elif [ -s /etc/dhclient-${DEVICE}.conf ]; then
   DHCLIENTCONF="-cf /etc/dhclient-${DEVICE}.conf";
else
   DHCLIENTCONF='';
fi;
...

So you could create a dhclient.conf file of your own and remove the interface specific one that was created for you by the system.

4

RHEL 6 and newer uses NetworkManager by default which creates dhclient configuration on the fly.

You will find the file in /var/lib/NetworkManager/dhclient-*.conf but you can't change this file as it's autgenerated. Check NetworkManager documentation about how to set various flags.

If you turn NetworkManager off, then sim's answer applies.

1

On a fresh RHEL 7.5 install, /etc/dhcp/dhclient.conf doesn't exist, but if you create it containing just the options you want, that seems to work. I'll bet it works for RHEL 6 as well.

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.