Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm having problems related to DNS solving in my Ubuntu 9.10.
Prior complaining to my ISP I would like to refresh my local DNS cache, like in Windows we do ipconfig /flushdns.

How can I do that in Ubuntu?

share|improve this question

4 Answers 4

up vote 39 down vote accepted

Øhh, ubuntu doesn't cache DNS per default. So there is nothing to flush! (but maybe your SOHO router does). Installing nscd will make ubuntu cache DNS, afterwhich you can clear your cache - but this is besides the point, when you don't have it installed yet!

share|improve this answer
5  
+1 for Ø intead of 0 –  Gaurav Kumar Jul 1 '13 at 16:56
1  
Out of curiosity, I am on 14.04 and running nslookup tells me that the response comes from server 127.0.0.1. But - to my knowledge - I have no DNS caching installed (neither nscd nor dnsmasq). I'm on Kubuntu... could this be a KDE Network Manager thing? –  exhuma Apr 30 at 6:11
    
@exhuma same here on ubuntu 14.04 so its not a kubuntu thing. –  LJ_1102 May 2 at 23:40

Try the following:

sudo /etc/init.d/dns-clean start

It works for me.

share|improve this answer

Ubuntu 12.04 onwards uses dnsmasq for a local cache. Sending it a SIGHUP (sudo killall -HUP dnsmasq) will re-read the cache.

NOTES
When it receives a SIGHUP, dnsmasq clears its cache and then re-loads /etc/hosts and /etc/ethers and any file given by --dhcp-hostsfile, --dhcp-optsfile or --addn-hosts. The dhcp lease change script is called for all existing DHCP leases. If --no-poll is set SIGHUP also re-reads /etc/resolv.conf. SIGHUP does NOT re-read the configuration file.

share|improve this answer
    
this looks reasonable. although, I have to find another of the problems I used to have (that are related to new sites in the /etc/hosts and Opera) to test this and mark as accepted instead of the other :P –  Igoru Dec 4 '12 at 19:28
    
That's fine. I actually came across this looking to clear out my own cached dns entry. Once I found the solution though, I felt I should add my findings here. I don't know at what version Ubuntu started using dnsmasq though. –  ytjohn Dec 5 '12 at 15:01
1  
This works and should really be marked as the answer! –  HDave Mar 13 '13 at 20:03
    
If minority edits weren't banned and frowned upon, I would correct “SIGUP” to SIGHUP. –  James Haigh Apr 20 at 23:16
    
@Igoru: You can use dig for testing whether the cache really has been cleared. I wanted to clear the cache on one of my OpenWrt routers for which I tried dig @192.168.0.3 nixos.org several times (any existent domain will do). While cached, it would usually have a query time of 1ms, but after each time I issued killall -HUP dnsmasq (as root) on the router I got about 27ms after each time I cleared it. –  James Haigh Apr 20 at 23:50

I just had this problem with a site for which I changed the DNS, and googling for a solution I found this page.

In my experience Firefox sometimes keeps its own DNS cache and doesn't clear it in time. So if you're viewing a site in Firefox, and keep seeing the old site, trying Chrome might solve the problem. If that works, you can clear the cache in Firefox. This happened in Ubuntu, I don't know if this happens on Windows or OSX as well.

I don't have nscd installed. I noticed however that in the terminal the new DNS is found several minutes later, so the problem solved itself.

share|improve this answer

Your Answer

 
discard

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.