2017/05/09

A workaround on fixing internal DNS not working well in Ubuntu

About

During my works, I need to use an internal DNS for resolving my private domain. However, it does not work quite well. Sometime it resolves the private instantly sometime it just resolving nothing.
I tried to get used to it. However, it really piss me off given that it becomes more and more frequently. So, here is a workaround (solution) I found after digging a really while :)

Workaround: Disable dnsmasq in Ubuntu

  • edit /etc/NetworkManager/NetworkManager.conf
  • comment the dns=dnsmasq line by putting a # in front of it
  • Run command sudo restart network-manager on your terminal

Why it work?

According to a blog here, Ubuntu relies on a dnsmasq local process for handling DNS’s jobs. It works well on VPN scenario. DNS traffics resolve on your local area network instead of routing through your VPN.
However, there is a noticeable statement on how DNSMASQ works on multiple DNS server.
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.
As a matter of fact that, there are 2 DNS in my Ubuntu. The Primary one is my internal DNS while the 2nd one is a Google DNS 8.8.8.8. Of cause Google DNS returns negative response for my private domain and DNSMASQ shuts everything down as a result.
Therefore, I disable the dnsmasq process which forces the DNS server to be queried in my order.
Everything works harmonically. Perfect :P

沒有留言:

張貼留言