0

I have installed dnsmasq and added nameserver 127.0.0.1 to the resolv.conf file so I can use wildcards in my apache configuration. But every time I restart the computer or change Wi-Fi connection I have to add it again to get it working.

Why is this happening and how can I make it work ?

2
  • Isn't it /etc/resolv.conf Mar 23, 2012 at 11:00
  • Yes it is :)... Mar 23, 2012 at 11:09

3 Answers 3

2

If you are running an Ubuntu system prior to 12.04 that hasn't yet been upgraded to 12.04 or later, or if you have removed the resolvconf package then install the resolvconf package.

sudo apt-get install resolvconf

If resolvconf was already installed, ensure that /etc/resolv.conf is a symbolic link to ../run/resolvconf/resolv.conf.

sudo dpkg-reconfigure resolvconf

Once you have installed the dnsmasq package (not to be confused with the dnsmasq-base package) you do not need to edit /etc/resolv.conf. The dnsmasq initscript causes (via resolvconf) '127.0.0.1' to be added to resolv.conf when dnsmasq starts, provided the value of IGNORE_RESOLVCONF is not set to yes in /etc/default/dnsmasq.

Doubters, please read /etc/init.d/dnsmasq.

P.S. In Ubuntu 12.04 there is a complicating factor. NetworkManager by default starts a dnsmasq process which listens exclusively on 127.0.0.1. This conflicts with the "standalone" dnsmasq process; only one of the two can start. This is a known bug, #959037, which was fixed in Ubuntu 12.10 (by moving NM-dnsmasq's listen address to 127.0.1.1). If you are still running Ubuntu 12.04 and you want to run standalone dnsmasq then you should either disable the NetworkManager-controlled dnsmasq (by commenting out "dns=dnsmasq" in /etc/NetworkManager/NetworkManager.conf) or configure the standalone dnsmasq not to listen on 127.0.0.1.

-1

You need to specify your preferred dns server in Network Manager. Otherwise, it will continue to overwrite the config-file. See What is the proper way to change the DNS IP?

5
-1

Buidling on Egil's answer. If it is network-manager clobbering the file, someone on ubuntuforums resolved it by removing the resolvconf package. This may or may not still work since the thread is a little old.

1
  • The problem is not the resolvconf package.
    – jdthood
    Oct 29, 2012 at 14:46

You must log in to answer this question.

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