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 set up /etc/resolv.conf

domain example.local
nameserver 127.0.0.1
nameserver 192.168.1.108

but,a days later..!?

It's changed!!

nameserver 192.168.1.1

192.168.1.1 is DHCPD

How to stop change it?

share|improve this question

4 Answers 4

Is the machine sourcing it's IP address from DHCP?

If so, resolv.conf will be turned over by the DHCP client, to reflect the details in the lease it receives.

Take a look at the manpage for the DHCP client you are using. For instance dhcpcd has a -R flag which prevents this behaviour.

share|improve this answer

Most likely you have a dhcp-client service setup on your machine, it is rewriting /etc/resolv.conf with values it receives from the dhcp server.

share|improve this answer

to prevent dhcp client rewriting your settings you can put as well in dhclient.conf [ /etc/dhcp3 in debian, if you use isc's dhcp3-client ]

supersede domain-name "your.domain.name";
supersede domain-name-servers 127.0.0.1, 192.168.1.108 ;

this might look differently for other dhcp clients.

share|improve this answer

on my debian squeeze

open file: /etc/dhcp/dhclient.conf

$ sudo gedit /etc/dhcp/dhclient.conf 

remove comment from line:

# prepend domain-name-servers 127.0.0.1;

to

prepend domain-name-servers 8.8.8.8, 8.8.4.4;

note the trailing semicolon

share|improve this answer

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.