Ubuntu Geek

Ubuntu Linux Tips,Howtos&Tutorials|Edgy,Feisty,Gutsy,Hardy

  • Subscribe RSS Feed

    subscribe to the ubuntu Geek RSS feed




  • Sponsor

  • Categories

  • Meta

  • Sponsor

  • Archives



  • WidgetBucks - Trend Watch - WidgetBucks.com

Howto clear/Flush DNS Cache in Ubuntu

Posted by admin on January 10th, 2008 Email This Post Email This Post

Some distributions run a caching nameserver in the background out of the box while some do not. To clear the cache if you have such a daemon running, simply restart the nscd service in ubuntu.

Why would you clear your cache?

Most DNS clients will cache the results of name resolution request to speed up multiple lookups to the same URL. Just think about how many requests are made to the same domain when visiting a single web page. Every file, image, style sheet, etc. that is on that page and served from the same domain requires a DNS lookup.

So if you have an invalid DNS entry cached on your local client you’ll need to flush it out of the cache so your client can do a new lookup and get the correct information. Or your other option is to wait until that DNS entry expires and the cache flushes it automatically… which typically takes about 24 hours.

In ubuntu if you want to flush DNS cache you need to restart nscd daemon

Install nscd using the following command

sudo aptitude install nscd

Flush DNS Cache in Ubuntu Using the following command

sudo /etc/init.d/nscd restart

If you want to be notified the next time we write something please subscribe to our RSS feed.Thanks for Visiting!

Related Articles

2 Responses to “Howto clear/Flush DNS Cache in Ubuntu”

  1. nevinka Says:

    admin@admin-machine:~$ sudo /etc/init.d/nscd restart
    [sudo] password for admin:
    sudo: /etc/init.d/nscd: command not found
    admin@admin-machine:~$

    :(

  2. Melvin van den Berg Says:

    My Ubuntu Hardy Heron 8.04 gave the same error as stated by Nevinka.

    hammerhead@HammerHead:~$ sudo /etc/init.d/nscd restart
    [sudo] password for hammerhead:
    sudo: /etc/init.d/nscd: command not found

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>