Saturday, April 7, 2012

Adding Additional Options to DHCP Client on Centos

I struggled to solve this :)
I wanted to add a dns server to /etc/resolv.conf before the name server the client gets from dhcp server.

In Debian based linux the procedure is to add the option to /etc/dhclient.conf or similar then restart the network or bring up the interface, But in Centos / RHEL there is some trick :

You have to create a file named dhclient-<interface_name>.conf in the /etc.

Example :

 To add another dns for the eth0 interface create : /etc/dhclient-eth0.conf
file and add this line to it :
prepend domain-name-servers;

Where is your additional name server

In fact it is more logical as you can have different settings for different interfaces.

No comments:

Post a Comment