Ubuntu – How to clear the DNS cache


I just updated the DNS record (ns1, ns2, ns3.myhostingcompany.com) for a site I've got hosted, but I still get the domain registrar parking page.

I'd like to see if the problem is Ubuntu's cached DNS records.
Is there a way to clear Ubuntu's DNS cache? (if such a thing exists?)

Best Answer

For 18.04 and higher

Look at Mike Shultz' answer.

For 11.10 and below

Ubuntu doesn't cache dns records by default so unless you've installed a dns cache there isn't anything to clear.

DNS records are likely cached by your provider's DNS servers so if you want to check if the DNS changes you made were successful you can interrogate a DNS server from your domain hosting service with dig:

dig -t a ns1.myhostingcompany.com @domain_registrar_dns_server

It you want Ubuntu to start caching dns I recommend installing pdnsd together with resolvconf. nscd is buggy and not advisable.

Related Question