In both development and ops, I have a lot of reasons that a cached DNS entry might be a problem–moving a site between servers, setting up a local environment, etc.

Given the aggressiveness of browser caches these days, restarting nscd or HUP’ing mDNSResponder doesn’t always do the trick, because browsers like Chrome and Firefox have a sticky DNS cache, too. On the plus side, these caches are easy to clear. On Firefox, Ctrl + Shift + Del will open the Clear History dialog. Check the Cache and Browsing & Download History checkboxes only, and make sure the “Forever” dropdown at the top is chosen before you clear. A much more fun option, however, is to use the DNS Cache extension, which will allow you to selectively clear or even disable the DNS caching in the browser entirely. Incidentally, the ShowIP extension is a wonderful way to tell which IP address (and host, DNS information, and more) is used by a given site at a glance.

Chrome’s story is a bit different, but also fun. Open the chrome://net-internals/#dns in Chrome. Chrome will actually show you the list of what’s in the cache and its status. To clear it, use the “Clear host cache” button partway down the page. Thanks to StackOverflow for finding me that trick.