Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 am using Ubuntu 12.04.2 LTS.

If I issue the following command

sudo gedit /etc/NetworkManager/NetworkManager.conf

and change the line




What will happen? Will I disable or enable DNS caching?

Additional notes:

I have been told that since I am using a VPN service, it would be better for me to do the above.

share|improve this question

Extract from

The big advantage is that if you connect to a VPN, instead of having all your DNS traffic be routed through the VPN like in the past, you’ll instead only send DNS queries related to the subnet and domains announced by that VPN. This is especially interesting for high latency VPN links where everything would be slowed down in the past.

As for dealing with DNS failures, dnsmasq often sends the DNS queries to more than one DNS servers (if you received multiple when establishing your connection) and will detect bogus/dead ones and simply ignore them until they start returning sensible information again. This is to compare against the libc’s way of doing DNS resolving where the state of the DNS servers can’t be saved (as it’s just a library) and so every single application has to go through the same, trying the first DNS, waiting for it to timeout, using the next one.

So it will not disable it as such, it will be less "safe" and efficient under certain circumstances. Like VPN

share|improve this answer
Thanks a lot for your time in writing a detailed explanation. However I don't have a background in IT; hence there are parts of it that I don't understand. Am I right to say that you advise that I do not place the # in front of dnsmasq if I'm using a VPN service to connect to the internet? – n00b Jun 3 '13 at 0:23
@noob You can disable it without any major issues. If you find that it takes web pages longer to load, I would reactivate it. I have it enabled as disabling it doesn't give me any advantages. – Meer Borg Jun 3 '13 at 0:25
Thanks for your reply. One of the explanations given by my VPN provider is that if I wish to ensure that all programs tunnel through the VPN and that all programs will be blocked from connecting to the internet if the VPN is disconnected, I should place the # in front of dnsmasq. Is that correct? – n00b Jun 3 '13 at 0:41
@n00b Yes, my DNS is not blocked in anyway so I don't need to do that, but if your DNS is restricted then definitly disable that feature. – Meer Borg Jun 3 '13 at 0:43
  1. dnsmasq launched by NetworkManager doesn't cache query results by default. You can confirm this by running:

    ps aux | grep dnsmasq

    You should see --cache-size=0 as an argument to dnsmasq, which disables caching.

  2. If you want to make sure DNS as well as any traffic is being routed through VPN (I believe you do based in your other question), you can use iptables to accept output traffic destined to VPN gateway and block any other destination. Thus there's no need to touch Networkmanager configuration.

share|improve this answer

Your Answer


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.