Home > Network, Ubuntu > Slow connection

Slow connection

So there was something peculiar with my Linux box at my office. While my network connection is reasonably fast, it would take about ten seconds sometimes for my browser to start getting information from web sites. And almost 100% of the times I tried to load twitter.com the URL would just not resolve. I did some research and thought that maybe there was something with the DNS setup that might be awry.

Apparently in Ubuntu there’s thing called “Network Manager” that makes decisions about which nameserver to connect to. While I don’t know why this happened, Network Manager did a very bad job of selecting the nameserver to connect which resulted in this issue. I first tried connecting to Google’s nameserver (didn’t realize this was an option) and had pretty great results. I believe the IP is “8.8.4.4.” Then I did some more research and learned about this FANTASTIC application that tries its very best to choose the best nameserver for your setup. It’s called “namebench” http://code.google.com/p/namebench. The smartest part of namebench is it actually looks at your browser history (if available) to get the quickest nameserver for your actual usage. After running that tool, it recommended three nameservers to connect to. So after getting the results, I did the following:
$ sudo emacs /etc/resolv.conf
nameserver 198.6.1.3
nameserver 198.6.1.4
nameserver 208.77.239.139

 

And then you have to do one more thing to make sure Network Manager doesn’t override your changes the next time the machine starts up.
$ sudo chattr +i /etc/resolv.conf

If you want to edit the file again you need to undo the chattr setting like so:
$ sudo chattr -i /etc/resolv.conf

Categories: Network, Ubuntu Tags:
  1. No comments yet.
  1. No trackbacks yet.