Read my book

I wrote books about Webpack and React. Check them out!

Monday, July 23, 2012

DNS Woes and How to Deal With Those

I just had a most curious morning. The server hosting my IRC shell (irssi on screen session) didn't respond as usual. I poked the guys at IRC using a web client and found out that it works for them. After a while I came to a conclusion that my DNS must be broken somehow. As a result I decided to try alternative DNS. Now I'm using OpenDNS and things seem to work just fine.

As my router won't allow me to modify its DNS settings I ended up changing the configuration locally. The following set of instructions should work on OS X Lion. You might need to adapt the recipe for your purposes:
  1. Add your new DNS addresses to network settings. In short System Preferences → Network → DNS → DNS Servers (add 208.67.222.222 and 208.67.220.220 here for OpenDNS or 8.8.8.8 and 8.8.4.4 for Google DNS). Same thing graphically.
  2. Flush your DNS cache using sudo killall -HUP mDNSResponder at terminal. Other versions of OS X use a different set of commands.
  3. Flush your browser DNS cache. As I use Chrome I had to navigate to chrome://net-internals/#dns and hit "Clear host cache".
That did it for me. If you ever run into weird behavior with your networking, DNS might be a part of the reason. Apparently DNS provides some additional services so if you need something like parental controls, that might be the way to go.