Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How do I flush the DNS cache on Win, Mac, and Linux computers?

share|improve this question

4 Answers 4

up vote 14 down vote accepted

Windows

ipconfig /flushdns

Mac (OS X 10.5)

dscacheutil -flushcache

Linux

If you are using nscd:

nscd -i hosts

In Windows you can turn off client-side DNS caching using this command:

net stop dnscache

It stops the DNS Caching service. It will restart with the next rebooting.

share|improve this answer

A small warning, If you need to flush a DNS cache, flushing it on your end machine may not work as expected. Generally the DNS cache on your end machine is fetched from the closest possible DNS server, which is generally on your primary router/dhcp server.

This will not be obvious to most, but it might explain why when you try to execute the aforementioned linux DNS cache flushes you find nscd wasn't running to start with. ( I haven't seen a setup that runs this by default for quite a while ).

You need to check your networks dns-server/router/firewall/modem manual / user interface for how this works. Generally rebooting them does the trick, but be warned, I have seen boxes that memorize DNS caches over reboot.

And even then, when you've done all of the above right, you could go straight ahead and pollute your DNS cache with a false entry the first time you look outside your network to the nearest hop, usually your ISP, who are prone to having a stale DNS cache.

share|improve this answer

Ubuntu does not install a caching DNS server by default. Given the likelihood of your router or ISP is using a caching DNS server instead, it seems a bit silly to bother.

If you are having problems and aren't running nscd, check try resetting the next step in the DNS recusive lookup chain.

share|improve this answer

This is what Google replied:

To flush DNS cache in Microsoft Windows (Win XP, Win ME, Win 2000):-

- Start -> Run -> type cmd
- in command prompt, type ipconfig /flushdns
- Done! You Window DNS cache has just been flush.

To flush the DNS cache in Linux, restart the nscd daemon:-

- To restart the nscd daemon, type /etc/rc.d/init.d/nscd restart in your terminal
- Once you run the command your linux DNS cache will flush.

To flush the DNS cache in Mac OS X Leopard:-

- type lookupd -flushcache in your terminal to flush the DNS resolver cache.
ex: bash-2.05a$ lookupd -flushcache
- Once you run the command your DNS cache (in Mac OS X) will flush.

To flush the DNS cache in Mac OS X:-

- type dscacheutil -flushcache in your terminal to flush the DNS resolver cache.
ex: bash-2.05a$ dscacheutil -flushcache
- Once you run the command your DNS cache (in Mac OS X Leopard) will flush.
share|improve this answer
1  
The headings for OS X 10.4 and 10.5 are reversed. "dscacheutil" is right for Leopard –  username May 31 '09 at 18:40

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.