Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using Network Manager to auto connect to wireless network. I have setup my personal DNS server using BIND 9.

screenshot

After connected, it seems just fine:

$ cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 127.0.0.1

But 30 minutes or so later, the file /etc/resolv.conf is overwritten by unknown program and its contents became:

domain domain
search domain
nameserver 208.67.222.222
nameserver 8.8.4.4

The question is, how can I know what program changed /etc/resolv.conf? Or, how can I force it to use local nameserver?

share|improve this question
3  
Looks like a DHCP client is messing with your resolv.conf. Try using auditd daemon if you have 2.6+ kernel. –  m0skit0 Aug 24 '11 at 8:00
    
My kernel is 2.6.32-5-686, though, it warns me auditd start runlevel arguments (S) do not match LSB Default-Start values (2 3 4 5). –  Xiè Jìléi Aug 24 '11 at 8:03
    
Man auditd ;) –  m0skit0 Aug 24 '11 at 8:04
    
Having checked the audit.log, it seems /etc/resolv.conf is overwritten with /etc/resolv.conf.dhclient-new by /bin/mv. But I had not even installed dhcp-client yet, what can I do now? –  Xiè Jìléi Aug 24 '11 at 9:24
    
Is this an authoritative name server? If so, you should not be using dynamic IP addresses anway. Use a static configuration. –  Keith Aug 24 '11 at 9:53

1 Answer 1

up vote 6 down vote accepted

That's almost certainly a DHCP client (dhclient, apparently, based on your comment) resetting resolv.conf to match the values it's receiving from the DHCP server.

To, erm, resolve this issue, locate dhclient.conf (I have it at /etc/dhcp3/dhclient.conf in Ubuntu) and use the prepend domain-name-servers command to place your own DNS before the DHCP server's values or supersede domain-name-servers to only use your own, completely ignoring those given by DHCP.

share|improve this answer
    
supersede domain-name-servers does work, though, I'm curious why network-manager could mess up with DHCP client, there is only one DHCP client, isn't it? –  Xiè Jìléi Aug 25 '11 at 1:29

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.