Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

I am running Debian 7 and have set up a DHCP and DNS server.

Everything is working nicely, except for the server itself not following the DNS entries in BIND.

The problem is that /etc/resolv.conf is populated by an upstream gateway as its primary DNS. After manually changing the entry to point to itself instead of the upstream gateway, the DNS server uses the BIND settings before requesting DNS from the gateway.

Unfortunately, upon reboot or re-connect of the interface, /etc/resolv.conf reverts back to using the gateway, putting me back into the problematic situation.

I'd like to keep dynamic IP on that interface, while using a static nameserver. Is this possible?

share|improve this question
up vote 5 down vote accepted

Add the following line to /etc/dhcp/dhclient.conf on your server:

prepend domain-name-servers;

This makes it prepend to whatever content of /etc/resolv.conf was forced on it by the gateway DHCP.

Why option domain-name-servers x.x.x.x doesn't work

From the dhclient.conf(5) man page:

The option statement is used to specify the value of an option supplied by the server, or, in the case of predefined leases declared in dhclient.conf, the value that the user wishes the client configuration script to use if the predefined lease is used.

share|improve this answer
I set option domain-name-servers x.x.x.x thinking that would do it. What'd the difference between 'option' and 'prepend'? – earthmeLon Nov 6 '13 at 22:51
@earthmeLon Please see the updated answer. – Joseph R. Nov 6 '13 at 22:59

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.