Last time, we gave you an introduction to DNS, what it is and a little bit of how it does it. Today we’re going to discuss a common pitfall of DNS and how to correct it.

Recall there is a hierarchy of DNS servers on the internet, each with its own cache of previously looked-up domain name to IP address records. You might be curious to know how all these copies kept up-to-date? If a website ‘moves house’ (changes host or IP address), who ‘forwards its mail’?

All DNS records have an expiry date. A record’s time to live value (TTL) describes, in seconds, how long it is valid for. Once that time is up, that local copy is discarded and the computer will revert to querying the DNS server. To return to our icanhascheezburger.com example, its TTL is 3600, or 1 hour.1

So, if you change your web host, or move your domain’s email service provider,2 there is a period where the old DNS record copies are still out there, and while technically valid, they’re not pointing to that shinny new something you want to show off. It is a time of uncertainty…

Soon enough, the TTL rule comes into effect, and the updated information trickles down through the hierarchy. We call this DNS propagation. The ‘resolution’ roughly comes down to patience but you can speed things at the local level: tear up your DNS cache and start over. Otherwise known as, flushing the DNS cache.

pp

Apple have a support article on how to do this on OS X. For Lion or Mountain Lion, open up Terminal3 and type at the prompt:

<code>sudo killall -HUP mDNSResponder
</code>

Press Enter. This being a sudo command, you must have administrator privileges and will be asked for your password. There will be no output or response returned, just a new prompt. This is the command line after all, and here ‘no news is good news’.

If you’re not comfortable in CLI-land, don’t worry. We’ve made an AppleScript application that will do the job for you:

> Download FlushDNS.zip

And for those power-users who like Alfred to do everything for them, there’s a Workflow for them:

Flushing your DNS cache

> Download FlushDNS.alfredworkflow

These versions are for Lion and Mountain Lion. If anyone requires the Snow Leopard version, let us know in the comments below.

Happy flushing!


  1. This is quite a low figure, it’s more common to see TTL values in the range of 24-48 hours. ↩

  2. A staple of ours has been moving clients from in-house Microsoft Exchange servers to Google Apps for some time now. ↩

  3. Found in Applications > Utilities. ↩

 

  • Email