Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The resolv.conf supports a line called options that allows for some fine tuning of the behavior of the resolver. In my environment we are using ISC's DHCPD to provide DHCP services to our services. Currently I can set the search and nameserver fields in the resolv.conf fine via DHCP, but I also want to be able to create the following line:

options timeout:2 attempts:4

Does anyone know if this is possible?

I have the following resolver related DHCPD options set currently:

  option domain-search            "";
  option domain-name-servers,,,;

In this particular case, the systems are all running CentOS 5/6.

share|improve this question
up vote 9 down vote accepted

There isn't an existing DHCP option for this, so you have to add custom configuration to both the server and clients in order to support this.

On the server (/etc/dhcp/dhcpd.conf), define a new option and set the value:

option resolv-options code 224 = text;
option resolv-options "timeout:2 attempts:4";

On the client (/etc/dhcp/dhclient.conf), define the new option and add it to the list of options to request:

option resolv-options code 224 = text;
request ..., resolv-options;

Then add a hook (/etc/dhcp/dhclient-enter-hooks.d/resolvoptions) on the client to actually use the sent value:

if [ "$new_resolv_options" ]; then
    echo "options $new_resolv_options" >> /etc/resolv.conf
share|improve this answer
I haven't tried this yet, but that certainly looks like the right approach. Thank you. I will give it a try very soon. – spkane Mar 21 '13 at 16:33

If you don't have access to the DHCP server or don't want to alter the server's configuration you can set the options on the client with a dh-client-exit-hooks script. If you're running Ubuntu you can put a script like this in /etc/dhcp3/dhclient-exit-hooks.d

cd /etc/dhcp3/dhclient-exit-hooks.d
sudo vim resolver-options

# Prepend resolver options to /etc/resolv.conf after dhclient`
# regenerates the file. See man (5) resolver for more details.
RESOLV_CONF=$(cat /etc/resolv.conf)
OPTIONS="options timeout:1"

echo -e "$OPTIONS\n$RESOLV_CONF" > /etc/resolv.conf

Just add the options you want to $OPTIONS, separating them with a newline (\n) character and the script will run after dhclient exits and prepend the resolver options to /etc/resolv.conf.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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