Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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

 
discard

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.