Search Tillamook Rage
Google Custom Search

9.10.2007

DNS Speedup

You'll be interested in this post if your web browser takes longer than it should on the "looking up" phase of a request.

This procedure was developed using Xubuntu 7.04 (Feisty Fawn), but should work equally well with any Ubuntu derivative or Debian derivative for that matter. Also, always be careful when editing your system configuration files as you could end up with a broken system if a mistake is made.

The use of mousepad on the command line can be substituted for vim if you prefer to work inside the terminal.

So, here's a fix for the slow DNS lookup problem in Xubuntu. We got it all figured out and you don't even have to stand on your head with tinfoil on your feet to make it work. The root of the problem seems to be that some DNS servers (including many of Verizon's and Comcast's) may ignore the first couple of hits from a Linux machine. We think that its something in the mechanics of how the Linux DNS client makes its requests. Below is the procedure to get Xubuntu back up to where it is just as fast or faster than Windows on the web.

Editing the DHCP configuration
From the X Terminal type sudo mousepad /etc/dhcp3/dhclient.conf. Enter your administrator password. Once the file opens in mousepad, scroll down to the prepend domain-name-servers line and uncomment it (remove the #) and remove the entry of 127.0.0.1 if it exists. If the line does not exist, add it just below the domain-name line. Make sure that you don't add IP addresses to the domain-name line or you will have problems. Just use the IPs separated by commas, i.e. prepend domain-name-servers 131.161.247.231, 131.161.247.250;. Don't forget the semi-colon or the script will throw an error. Uncomment the line that says select-timeout 5; and change the 5 to a 1. Save the file and exit mousepad. By the way, check out www.opennic.unrated.net/public_servers.html to see where we got these DNS addresses from. You might want to use addresses that are in your region. I would suggest testing each IP address that you want to try by adding it by itself in the prepend domain-name servers line and seeing if it speeds up your connection. Work down the list of IP addresses writing down the ones that speed up your connection. Also, please note that since these are open and free DNS servers, you may get some "drift" in the reliability of the servers over the course of months or years, so be aware that you may have to come back and grab new addresses some day.

Restarting the ethernet connection
Type sudo ifdown eth0. After that's done type sudo ifup eth0. (NOTE: If you're using wireless or you have multiple ethernet ports and it's a different number then enter that instead, ie sudo ifup wifi0) Exit the X Terminal.

Open Firefox and it should be about 100 times faster on DNS resolution. These changes will stay persistent even after you reboot too. The ifdown and ifup commands are 'interface down' and 'interface up'. They shut down or bring up a given interface respectively. eth0 is usually the default name of your first network card (interface). If you had two you would have eth0 and eth1. The select-timeout entry is how long the DNS client waits for a valid response from a DNS server before moving on. You could easily add more DNS servers to the list to make it even more bulletproof.

Turn off ipv6
You may not have to do this step. Try the procedures above first, and then give this a shot if you're still having problems. From the X Terminal type sudo mousepad /etc/modprobe.d/aliases, and find the line that says alias net-pf-10 ipv6. Change this line to read alias net-pf-10 off. Save and exit mousepad. What this does is blacklists the IPv6 kernel module and prevents it from loading.

No comments: