0

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?

4 Answers 4

6

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.

3

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.

3

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.

1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .