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?

freddiefujiwra
  • 1,667
  • 5
  • 25
  • 34

4 Answers4

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.

Dan Carley
  • 25,617
  • 5
  • 53
  • 70
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.

Dave Cheney
  • 18,567
  • 8
  • 49
  • 56
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.

pQd
  • 29,981
  • 6
  • 66
  • 109
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

HVNSweeting
  • 534
  • 2
  • 10
  • 17