LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-06-2004, 10:51 AM   #1
PlatinumRik
Member
 
Registered: Feb 2003
Location: Buffalo, NY
Distribution: Novell Linux Desktop
Posts: 159

Rep: Reputation: 30
how-to flush dns cache


what is the command used to flush the local cached dns on fedora core 1.

Thanks
 
Old 05-06-2004, 12:01 PM   #2
demian
Member
 
Registered: Apr 2001
Location: Bremen, Germany
Distribution: Debian
Posts: 303

Rep: Reputation: 30
If you use bind9 that would be rndc flush. With bind8 ndc flush should do it.
 
Old 06-21-2007, 02:55 PM   #3
lefty.crupps
Member
 
Registered: Apr 2005
Location: Minneap USA
Distribution: Debian, Mepis, Sidux
Posts: 470

Rep: Reputation: 32
And old thread, but without an answer for us desktop users who are looking for this information and are not running domain name servers on the desktop...

Does anyone have an answer for non-DNServer machines?
 
Old 06-22-2007, 04:34 PM   #4
MQMan
Member
 
Registered: Jan 2004
Location: Los Angeles
Distribution: Slack64 14.1
Posts: 581

Rep: Reputation: 38
If you're not running a DNS server on the machine, then nothing is cached, unless it's WinBlows. You will always be asking a DNS server for the info.

Cheers.
 
Old 03-01-2008, 04:49 AM   #5
KEYofR
LQ Newbie
 
Registered: Jun 2004
Location: Edison, NJ
Distribution: SuSE, Knoppix, Ubuntu, FreeBSD, SCO Open Server
Posts: 7

Rep: Reputation: 1
Of _course_ you may be caching dns even if you are running a "desktop" install.
There are several things that may be caching, any of several full dns servers, any of several local caching-only servers, and of course your upstream dns server probably caches to the limit allowed/specified in the ttl setting fo rthe particular record being looked up.

The most common caching daemon on linux these days (yes, running on "desktop" insalls) is nscd.
To clear it's cache takes 3 things:
stop the daemon, ensure the persistent option for the hosts service isn't enabled in nscd.conf or manualy wipe the persistent db, start the daemon.
How you stop & start the daemon, where nscd.conf is found, where the persistent db file is found, all depend on your particular distribution, but a generic answer that works on _most_ distributions is:

/etc/init.d/nscd stop

Verify /etc/nscd.conf has this:
persistent hosts no
shared hosts yes

/etc/init.d/nscd start

Or just stop the daemon and leave it stopped and don't worry about any config options or db files.
It will come back up at next reboot.

Sometimes even though the above works, there may also be a more convenient command.
Example, on SuSE, the above works, but there is also:
rcnscd stop
rcnscd start

This may not make much difference or help you though. DNS records have a TTL (time to live) field which specifies how long a nameserver may cache this particular record locally. Most nameservers cache all records for as long as TTL allows. So, your upstream dns server (whatever is listed in /etc/resolv.conf) and it's upstream dns server, and so on... all the way to whatever dns server is the authoritative nameserver for the record being fetched, will all most likely be caching that record for however long the TTL is for that record. Every record has it's own TTL value. A common TTL is 1800, which is 30 minutes, but in special cases like dyndns.org, they set very short TTL's on their records by default because they know the IPs will change often, because that is the whole point of dyndns.org in the first place. Also, since 2004-09-15 nscd already honors the TTL the same as all the other nameservers do. This means nscd will already perform a new lookup instead of supplying a record from cache no sooner than, and just as soon as, all the upstream dns servers.

So, for 2 different reasons, there is generally no point in clearing your local cache, it generally won't make a lick of difference.
 
1 members found this post helpful.
Old 04-28-2009, 05:42 PM   #6
zatricky
LQ Newbie
 
Registered: Apr 2009
Posts: 3

Rep: Reputation: 1
Very very old post... anyway

The much simpler way to flush the cache if using nscd is to invalidate its contents:
Code:
nscd -i hosts
You usually have to be root to do this.
 
1 members found this post helpful.
Old 07-27-2011, 02:47 PM   #7
kabars_edge
Member
 
Registered: Apr 2006
Location: Silver Spring, MD
Distribution: Debian
Posts: 40

Rep: Reputation: 8
how-to flush dns cache

I know this is a very old post, however, for those of you looking for an answer, here it is.

If you are running a workstation install of any Linux and your machine is caching DNS entries while NOT running bind, rscd or nscd; then the easiest way to clear that cache is to bounce the interface.

root:~# ifdown eth0
root:~# ifup eth0

or sudo if you prefer.

user:~$ sudo ifdown eth0
user:~$ sudo ifup eth0

HTH,
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Display and Flush DNS cache click Linux - Networking 7 11-10-2009 01:00 PM
DNS losing cache vasillalov Linux - Networking 7 12-27-2007 05:16 PM
how to reload sbp2 module /Flush terminal command cache Lakota Mandriva 1 12-07-2004 02:08 PM
problems with dns-cache kokolisso Linux - Networking 0 05-17-2003 04:43 PM
DNS Cache Architect Linux - Networking 2 10-25-2002 04:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration