Friday, August 10, 2007

Slow Internet / DNS response in Ubuntu Dapper

I recently upgraded to Linux Dapper Drake with a CD, and everything was working very well until I allowed Dapper to perform its automatic updates.

The updates created a problem in Firefox: URL's did not even begin to load for twenty seconds. I guessed this was related to my Linksys router, however I also knew that Windows was working fine, and Dapper worked before the updates. I researched the issue and patched together a solution, which I posted to the Ubuntu community forums. If my DNS servers change, there could be an issue, however at that point I could switch to open DNS.

Here's the problem: Ubuntu is having difficulty with DNS because of miscommunication with the router (related to wrong ports).

Here is my advice:
Establish a direct DNS connection. No need to disable IPv6!

1. Find your DNS servers. You may need to check your router settings (usually 192,168.1.1 or 192.168.0.1). Look for a status tab, or similar with the current DNS information. Write down your DNS servers (x.x.x.x & x.x.x.x).

You may wish to back up your dhclient.conf file at this point. In the Terminal, type:
cp /etc/dhcp3/dhclient.conf /etc/dhcp3/dhclient.bak

2. Enter these DNS servers directly in your dhclient.conf file:

sudo gedit /etc/dhcp3/dhclient.conf

You should see your dhclient.conf file displayed (with text in it). Add two lines to the end:

supersede domain-name-servers x.x.x.x,x.x.x.x;
prepend domain-name-servers x.x.x.x,x.x.x.x;

The x's represent your DNS server IP addresses that you found in Step 1.

Save your dhclient.conf file, close gedit and return to the Terminal.

Now restart your DNS lookup with (assuming eth0 is your connection to the router):

sudo ifdown eth0 && sudo ifup eth0

You should immediately experience an improvement in your Internet speed.

I built this solution with help from https://forum.bytemark.co.uk/viewtopic.php?pid=1790 as well as several Ubuntu forum entries.