How to flush DNS cache in Linux / Windows / Mac

advertisement

Flush dns to get a new name resolution. Also flush dns cache when you can’t access a newly registered domain name. You can simply flush your dns cache anytime to get new entry. So, Flush your dns cache now.

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.

Technorati Tags: , , , , , , , , , , , , , ,


Posted at September 28th, 2006 by chua

If you think this article helps you to solve your problem and clear your headache, feel free to buy me a drink :)


28 Responses to “How to flush DNS cache in Linux / Windows / Mac”

  1. Benjamin Schmidt Says:

    On my Debian machine, the nscd daemon is not installed by default. (/etc/rc.d/init.d/nscd missing)

    Description:
    A daemon which handles passwd, group and host lookups
    for running programs and caches the results for the next
    query. You should install this package only if you use
    slow Services like LDAP, NIS or NIS+

    So i think “/etc/init.d/network restart” does also clear the cache. Does anyone know a better solution, let me know

  2. acklan Says:

    ipconfig /flushDNS dos not work with Windows 9x\ME

  3. Cómo hacer un ‘flush cache’ en Windows, Mac y Linux Says:

    [...] | DosBit – Techie Corner Publicaciones [...]

  4. gabriel Says:

    this does NOT flush firefox internal cache.

  5. sogua Says:

    gabriel: this only flush ur pc dns cache. if you wan to clear Firefox internal cache, you can open firefox -> Tools -> Clear Private Data (Check the cache) and click “Clear Private Data Now”

  6. wululululu Says:

    i think gabriel means the internal firefox dns cache (yes firefox has it’s own dns cache… unnecessarily)
    but i don’t know how to flush it… the only thing i can change, is the expiration interval.

  7. SoGua Says:

    Normally the internal firefox cache will be clear once you close all the browser.

  8. Sam Says:

    firefox’s about:config has an option: network.dnsCacheEntries
    setting this to 0 will disable the cache and fallback to the local DNS cache.

  9. Mohan.R Says:

    Hello Sir………..

    To whom ever it may concern……………
    Can you give me a solution for this………
    Here we are using Terminal server with more than 50 clients at a time……..
    but when i shutdown and restart that server then it will shows some errors
    “IEXPLORER has encounter a problem”…………. Please can you give me a solution for this…………….. And we are using Domain environment also. Please give a solution for this……

  10. Dad Says:

    Can someone help…! I can’t Clear my Cache…

    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.

    C:\Documents and Settings\Dad>ipconfig /flushdns

    Windows IP Configuration

    Could not flush the DNS Resolver Cache: Function failed during execution.

    C:\Documents and Settings\Dad>

  11. Jason Says:

    Sam, which version of firefox has that option?
    I cannot locate it in my about:config

  12. kyle Says:

    Hey dad.. try this.

    1. Click the Microsoft Vista Start logo in the bottom left corner of the screen
    2. Click All Programs
    3. Click Accessories
    4. RIGHT-click on Command Prompt
    5. Select Run As Administrator
    6. In the command window type the following and then hit enter: ipconfig /flushdns
    7. You will see the following confirmation:

    Windows IP Configuration
    Successfully flushed the DNS Resolver Cache.

  13. Increase Search Engine Ranking Says:

    /etc/init.d/network restart

    Will clear the cache on Linux.

  14. sli Says:

    in MacOSX Leopard 10.5.2 its :

    dscacheutil -flushcache

  15. Ryan Says:

    bash-2.05a$ lookupd -flushcache

    When I try this on my Mac I get a command not found?

    ryan-imac:~ ryan$ bash-2.05a$ lookupd -flushcache
    -bash: bash-2.05a$: command not found
    ryan-imac:~ ryan$

  16. flush DNS on Linux - NOVELL FORUMS Says:

    [...] rnrn rn rn rn Re: flush DNS on Linuxrn rn rn rn rn rn Does this help?rnrnHow to flush DNS cache in Linux / Windows / Mac – Techie Cornerrn rn rn rn rn rnrn rn rn rn __________________rn Marcel Coxrn rn rn [...]

  17. Mothership Says:

    Ryan,

    that’s because the headings for the two Mac OS X commands are around the wrong way.

    If you’re using 10.5, use: dscacheutil -flushcache

    Also, you want everything after the $ sign. The rest is what is written before the command prompt.

  18. sweet bunny Says:

    I can’t flush my dns cache in win98.

    ipconfig/flushdns is a bad command

    I am unable to get to certain websites on both ie and firefox

    I was able to get to the sites at one time, but once I get the server not found message i can’t get to the site.

    Thanks for any help

  19. Jon Says:

    I had the same issue after I installed BIND 9 and racked my brains as a deconstructed my setup on my Ubuntu system. Finally tried editing /etc/hosts and found my localhost entry munged and repaired it. FireFox instantly began resolving again. Go figure. Note that I did retain the DNS server on board – Also, I found that you can use the “PortableApps” Firefox browser with Wine to work as a spare tire of sorts, since it was what got me through this. Just have Wine installed and then use the PortableApps Firefox browser.

    Good luck.

    Jon

  20. John Says:

    you have the leopard / non-leopard instructions backwards – pre-leopard uses lookupd

  21. Moritz Says:

    Debian 4.0 Konsole

    /etc/init.d/networking restart

  22. Mike Says:

    For all the Windows people the command is:

    ipconfig \flushdns

    Everyone has the slash the wrong way

  23. daftwill123 Says:

    I’ve get the same error message as Dad:

    C:\WINDOWS\Dad>ipconfig/flushdns

    Windows IP Configuration

    Could not flush the DNS Resolver Cache: Function failed during execution.

    C:\WINDOWS\

    I tried what Kyle said and it pretty much changed nothing. Though he said something about Windows Vista and both me and Dad are on XP. I’m trying to do this to see if it will let me re-connect to google because I can’t connect to google and so far only google. If any of you got suggestions on that too, to help me re-connect, that’d be awesome.

  24. chua Says:

    Hi daftwill123, i suspect your PC was infected by virus.
    Do a full system scan with your anti virus.

    Here’s a free antivirus
    http://www.techiecorner.com/102/avast-anti-virus-free-anti-virus-software/
    http://www.techiecorner.com/166/avast-how-to-schedule-boot-time-scan-before-window-start/

  25. daftwill123 Says:

    Thanks for the advice. I’ve ran anti-virus many many times, cleared out the system over and over of both spyware and virus and still having trouble. It might be so deep into the system though my protection programs aren’t picking them up. I’m using the latest versions of AVG Free (AVG 8) and Spyware search and destroy.

  26. SoGua Says:

    Ok here’s another solution: Go to Control Panel -> Administrative tools -> Services and look for “DNS Client” and right click on it and Select Start. Once DNS client started you can try to flush the DNS again.

  27. daftwill123 Says:

    Thank you!!!

  28. Tricky Says:

    @Dad, kyle, daftwill123, and SoGua: should probably be *restart* the “DNS Client” service. If it isn’t already started then the service would have been disabled and there’s nothing to flush. Best to also check that the service is set to start on startup within the Right-click Properties dialog box.

    @sweet bunny: I don’t believe any Windows versions prior to Windows 2000 did any caching at all without specifically installing a DNS caching service. Chances are the issue was with an upstream DNS server or maybe your firefox cache as per. See below or SoGua’s comment from August 7th 2007.

    Re nscd, many *nix distros don’t have nscd installed by default. If “nscd -i hosts” doesn’t clear the cache (that’s the correct way to flush it btw) then installing it won’t help you except to install an empty cache. Also, there could be other daemons installed instead of nscd, dnsmasq or bind for example (Bind is generally not the best for a desktop – but is still installed on a lot of servers). Bind’s cache can be flushed with “rndc flush”. Dnsmasq I believe has to be restarted for the cache to be flushed.

    Lastly, there’s also a lot of upstream cached records that might be totally outside of your control. In case your current DNS server has the incorrect info cached, try changing your caching DNS server settings in your Network Settings to use a different server.

Leave a Reply