18

I am doing some work on some domain names. I'm updating them. By using dig I can query our nameserver and I can see that the correct name has been updated. However our office dns cache is still showing the old name. Yesterday I set the TTL down to 10 minutes, so I don't have to wait long. However is there any way to trick the office's dns cache to update? Any sneaky little trick I can do to make things easier?

UPDATE Let's assume I don't have access to the server, and can't restart it? Is there anything else I can do?

John Gardeniers
  • 27,458
  • 12
  • 55
  • 109
Amandasaurus
  • 31,471
  • 65
  • 192
  • 253

5 Answers5

17

Assuming your DNS server is on a PC and not a router etc:

Linux cache flush:

/etc/init.d/nscd restart

Or for distros without nscd

/etc/init.d/named restart

Windows client cache flush for individual machines:

ipconfig /flushdns

Windows server cache flush for office server (thanks to ericmayo for the correction):

  1. Navigate to Administrator Tools
  2. expand the server object
  3. right click cached objects
  4. select clear cache

Mac (possibly?!):

dscacheutil -flushcache

If you have a web GUI etc for a router, there will be an option in there somewhere.

Cross platform cache flushing as above

About DNS and caching

Andy
  • 5,230
  • 1
  • 24
  • 34
  • ipconfig /flushdns does not flush the DNS cache of a Windows DNS server; it only flushes the client's cache. To flush a Windows DNS server cache, open DNS under Administrator Tools, expand the server object, right click cached objects and select clear cache. nscd is not on my distro. In that case, just killall named and restart it; usually /etc/rc.d/rc.bind start – Kilo Jul 15 '09 at 14:06
  • For mac: `dscacheutil -flushcache` flushes the local cache in the operating system, not the bind name server. `rndc flush` will clear the bind name server on a mac which will affect all computers using that name server. – Matt Connolly Apr 20 '12 at 00:21
12

If you are running BIND as a resolver for your office - ie. not forwarding to another a resolver.

Flush everything in the cache:

rndc flush

Flush a specific record:

rndc flushname example.com

If you are forwarding then you are at the mercy of the forwarder's cache.

Dan Carley
  • 25,617
  • 5
  • 53
  • 70
4

With the Windows DNS just restarting the service flushes the cache. Worth a try on your office server.

JR

John Rennie
  • 7,776
  • 1
  • 23
  • 35
3

If your using Windows, you can use nltest.

  /DSREGDNS - Force registration of all DC-specific DNS records
  /DSDEREGDNS:<DnsHostName> - Deregister DC-specific DNS records for specified DC
      /DOM:<DnsDomainName> /DOMGUID:<DomainGuid> /DSAGUID:<DsaGuid>
  /DSQUERYDNS - Query the status of the last update for all DC-specific DNS records

And if your using WINS, nbtstat.

0

If you're using Bind9 as your dns server, restart the service

sudo service bind9 restart

  • 1
    This is not true for all distros; RH/CentOS uses `service named restart`, as Andy alludes to above. This would be a more helpful answer if you found out which distros it was true for (I suspect it's "*Debian and derivatives*", but I'm no Debian expert) and added that in. That said, welcome to SF! – MadHatter Jul 17 '16 at 05:48
  • @MadHatter ...additionally it would be depend on the "state" of `bind`, if it's used as an authoritative, or recursive server. In my opinion, as it stands, this answer on it's own doesn't make that much sense. – gxx Jul 17 '16 at 07:51