Koozali.org: home of the SME Server

Flush the DNS cache

Offline judgej

  • *
  • 375
  • +0/-0
Flush the DNS cache
« on: March 19, 2008, 10:12:08 PM »
Is there a way to flush the DNS cache on SME Server 7? Waiting for an automatic refresh for an Internet domain I changed over 36 hours ago is painful. I have tried restarting the dnscache and tinydns services, but that has not made a difference.

I've searched all the forums and HOWTOs, but I've not found an answer.
« Last Edit: March 19, 2008, 10:21:00 PM by judgej »
-- Jason

Offline Normando

  • *
  • 841
  • +2/-1
    • Unixlan
Re: Flush the DNS cache
« Reply #1 on: March 20, 2008, 03:16:26 AM »
I've searched all the forums and HOWTOs, but I've not found an answer.

Sure?

http://wiki.contribs.org/Useful_Commands#Squid_Cache

Offline judgej

  • *
  • 375
  • +0/-0
Re: Flush the DNS cache
« Reply #2 on: March 20, 2008, 01:09:07 PM »
Sure?

Yes, sure. That's the web proxy cache. I tried it (and it is useful for flushing that cache) but it does not touch the DNS cache. I would like to flush the DNS cache for a specific domain, or if that is difficult, in its entirety.

-- JJ
« Last Edit: March 20, 2008, 01:11:33 PM by judgej »
-- Jason

Offline mmccarn

  • *
  • 2,656
  • +10/-0
Re: Flush the DNS cache
« Reply #3 on: March 20, 2008, 02:37:36 PM »
http://www.djbdnsrocks.org/faq.php#flush

It doesn't look as though any of the standard SME 'events' forces a full restart of tinydns.  You can restart it manually using sv restart tinydns

One implication of the djbdnsrocks URL above is that any system restart would also clear the tinydns cache.

Offline judgej

  • *
  • 375
  • +0/-0
Re: Flush the DNS cache
« Reply #4 on: March 20, 2008, 04:18:32 PM »
Whatever restarting tinydns does, it certainly does not seem to reset the domain timeout countdown, so I guess it isn't flushing the domains that it has.
-- Jason

Offline raem

  • *
  • 3,972
  • +4/-0
Re: Flush the DNS cache
« Reply #5 on: March 21, 2008, 06:20:17 AM »
judgej

External DNS record changes can take 72 hours to propagate around the Internet, and there is nothing much you can do about it.
Check one of the DNS lookup services to see what the domain points to now.
...

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Flush the DNS cache
« Reply #6 on: March 21, 2008, 09:36:37 PM »
It doesn't look as though any of the standard SME 'events' forces a full restart of tinydns.  You can restart it manually using sv restart tinydns

There's never any need to restart tinydns. It just publishes local records, and reads them all from the data file on disk - it does no caching.

If it's still a problem, JJ can purge the records that bother him by restarting the dnscache.forwarder service. But he should have planned ahead, and reduced the TTL of the DNS records before changing them, so all dns caches (not just his own) would see the new records more quickly.

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Flush the DNS cache
« Reply #7 on: March 21, 2008, 09:39:31 PM »
External DNS record changes can take 72 hours to propagate around the Internet, ...

No, they can take much less or much longer than that, depending on the TTL values of the records, which can vary over a wide range.

Quote
... and there is nothing much you can do about it.

Once the change is done there is nothing much one can do about visibility throughout the Internet. But one can flush ones own cache, and will therefore fetch new records, and one can plan ahead, and reduce TTL well before making changes, then restore the longer TTL after making the changes.

Offline judgej

  • *
  • 375
  • +0/-0
Re: Flush the DNS cache
« Reply #8 on: March 21, 2008, 10:58:34 PM »
...and one can plan ahead, and reduce TTL well before making changes, then restore the longer TTL after making the changes.

I'm pretty much in that situation, with some web servers that are being moved. I have control over the domain names, sub-domains and IP addresses, but not the TTL. The [nameserver] hosting company has a 24 hour TTL set for all domains and cannot (or will not) change it. Even if my server move is going to cause some disruption to the service to others, it would be nice if at least I could get my own servers flushed out and up-to-date.

My only workaround at the moment is to configure the domains on my own server, and set the various sub-domains (www, mail, shop, etc.)to 'external' and enter the IP address for each.

Alternatively, I could use a different nameserver hoster, at least in the short term, such as zoneedit with its extremely short TTL (half an hour, or something like that).
-- Jason

Offline judgej

  • *
  • 375
  • +0/-0
Re: Flush the DNS cache
« Reply #9 on: July 20, 2010, 11:43:29 AM »
Just thought I would add some further information to this thread, since I needed the answer again and only seemed to come with this thread rather than the answer. I posted the command here some time ago: http://wiki.contribs.org/Useful_Commands

Code: [Select]
signal-event dns-update
The TTL may be set to 24 hours or more, and SME Server very strictly adheres to this. However, most ISPs now use four hours or less for their own cache and so there is no point waiting for 24 hours - the ISP will provide the latest IP addresses much sooner, if only SME Server will ask for them. Anyway, that command above works for me.

If you are using Windows, then you will probably need to flush the Windows DNS cache as the final step, from a DOS or Command box:

Code: [Select]
ipconfig /flushdns
This is still for SME 7.x, and I don't know yet how SME 8 will handle DNS caches. Just waiting for a brave moment to update.
« Last Edit: July 20, 2010, 11:49:00 AM by judgej »
-- Jason

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Flush the DNS cache
« Reply #10 on: July 20, 2010, 03:29:00 PM »
The TTL may be set to 24 hours or more, and SME Server very strictly adheres to this. However, most ISPs now use four hours or less for their own cache and so there is no point waiting for 24 hours ...

The cache TTL is not set by the local resolver (i.e. dnscache running in SME server) - it's part of the DNS data provided by the DNS provider (registrar/ISP/DNS hoster).

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Flush the DNS cache
« Reply #11 on: July 20, 2010, 03:55:20 PM »
I'm pretty much in that situation, with some web servers that are being moved. I have control over the domain names, sub-domains and IP addresses, but not the TTL. The [nameserver] hosting company has a 24 hour TTL set for all domains and cannot (or will not) change it.

Use a different nameserver hosting company.