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

I have set up an amazon EC2 instance (with a debian wheezy AMI) having minimal stuff on it, and dhcpcd is present by default.

dhcpcd doesn't seem to be considering /etc/resolv.conf.head or /etc/resolv.conf.tail at all and keeps overwriting my /etc/resolv.conf and thus am unable to add nameservers of my choice.

How can I get entries for my nameservers to stay in /etc/resolv.conf ?

share|improve this question

According to man dhcpcd.conf, a line with

nohook resolv.conf

in dhcpcd.conf should stop dhcpcd from running the resolv.conf hook-script and thus leave your resolv.conf untouched. Unfortunately, this doesn't work for me.

Therefore, I'm using

chattr +i /etc/resolv.conf 

as a workaround.

You could probably also remove the hook-script in /lib/dhcpcd/dhcpcd-hooks.

share|improve this answer

You can add the namerservers to /etc/network/interfaces

iface eth0 inet static
    address ...
    netmask ...
    gateway ...
    dns-nameservers w.x.y.z w.x.y.z
share|improve this answer
I do not want to make it a static one; I just wanted dhcpcd to not overwrite /etc/resolv.conf – megazoe Aug 8 '13 at 14:29
The question is about how to make resolv.conf{head|tail} works, not about adding dns servers. – number5 Aug 9 '13 at 0:58

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.