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

9,390

Solution 1

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.

Solution 2

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.

Solution 3

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.

Solution 4

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:
9,390

Related videos on Youtube

Tim
Author by

Tim

Updated on September 17, 2022

Comments

  • Tim
    Tim over 1 year

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

  • Tim
    Tim almost 15 years
    The headings for OS X 10.4 and 10.5 are reversed. "dscacheutil" is right for Leopard