Sunday, January 11, 2015

How to Flush Your DNS Cache

Happy New Year! I thought I'd start off the year with a quick reference post on flushing your DNS cache. This falls under the flag of "This shouldn't be a pain in the ass, but here we are..."

Sometimes your laptop switches networks and your DNS lookups don't follow. Sometimes something on the network decides to go wonk. Sometimes sunspots and planets align just right. At any rate, once in awhile the system needs to have name lookup cobwebs swept. Here's how to do it.

On Windows, use

ipconfig /flushdns

...from the command prompt. On Linux, you can usually use 

/etc/init.d/named restart

or

/etc/init.d/nscd restart

...depending on which one your system uses.

OS X is more fun because Apple devs insist on changing stuff periodically. For OS X 10.10:

sudo discoveryutil udnsflushcaches

On 10.9:

dscacheutil -flushcache; sudo killall -HUP mDNSResponder

On 10.7 and 10.8:

sudo killall -HUP mDNSResponder

On 10.5 and 10.6 (who's using those now?):

sudo dscacheutil -flushcache

No comments:

Post a Comment