Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


After connected, it seems just fine:

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

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

domain domain
search domain

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
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
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

You must log in to answer this question.

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