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?

5 Answers 5


Ø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!

  • 3
    Out of curiosity, I am on 14.04 and running nslookup tells me that the response comes from server 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, 2014 at 6:11
  • @exhuma same here on ubuntu 14.04 so its not a kubuntu thing.
    – LJ_1102
    May 2, 2014 at 23:40
  • 2
    @LJ_1102 @ exhuma That would be the Ubuntu's network manager, it listens as a local DNS server, but forwards all requests to whatever is defined. As a side-effect (or by design), this allows you to change DNS servers on the fly from the interface without needing root permissions. See for example this question: unix.stackexchange.com/questions/59414/… Oct 15, 2014 at 18:19

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

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.

  • 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 Dec 4, 2012 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, 2012 at 15:01
  • 1
    This works and should really be marked as the answer!
    – Dave
    Mar 13, 2013 at 20:03
  • 1
    If minority edits weren't banned and frowned upon, I would correct “SIGUP” to SIGHUP. Apr 20, 2014 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 @ 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. Apr 20, 2014 at 23:50

Try the following:

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

It works for me.

  • 1
    I guess things have changed since this answer, since it looks like this won't work any more in 14.04. Hey ubuntu, it would be nice if there were an interface for this that weren't tied up with specifics of particular name resolution systems, and OS versions (and maybe OS distributions later...). Apr 5, 2015 at 10:48
  • Does work in 15.04 Oct 10, 2015 at 14:25
  • Worked in ubuntu 14.04.5. This script is provided by pppconfig package. I think it isn't included by default in the distribution.
    – ssoto
    Aug 16, 2016 at 8:14

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.


Depending on the context of your question you might need to clear the cache of your web browser too.

In Firefox this is done by: preferences -> privacy -> clear your recent history [just tick the "cache" checkbox there]

In Chrome: Navigate to chrome://net-internals/#dns and press the "Clear host cache" button. (see another answer)

You must log in to answer this question.

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