Slow DNS lookups on Ubuntu 9.10

Today, I setup Ubuntu 9.10, which you probably knew from my blogs … but anywho… I ran into issues where Firefox and other apps were constantly looking up addresses and taking forever.

The fix for me was to edit the resolv file by doing the following command:

sudo pico /etc/resolv.conf

Once in there I took out my normal router IP and placed in a trusted outside DNS server like: 4.2.2.2 (You can/need to use one YOU trust :) )

It works perfect now.

I hope that helps someone out there!

*EDIT* DHCP will change it back everytime. Below I outline what to do about that issue. Here’s what it says in better formatting:

Okay here’s a solution for you.

##################

1. Go to a terminal
2. Type “sudo pico /etc/dhcp3/dhclient.conf”
3. You’ll see a line commented out (If not add your own)… that says:

“prepend domain-name-servers YOUR_DNS_IP_HERE;”

I added mine just above the request subnet-mask line.

4. You can reboot to make sure it sticks.

###################

Author:  Crimm

Software engineer (PHP, Bat, VBS), Sr. Systems Admin, Techie, Father, Gamer, Anime watcher (Wannabe Otaku), & full of geek!

  • shawn a.k.a. abd al-Shakur

    thanks for the info. this problem has plagued me since the version before Jaunty (can't seem to remember the name now for some reason). i've tried editing the same file, but on my desktop version (server version is unaffected), where network manager runs, network manager keeps changing it back to my router. any advice?

  • Crimm

    Actually yes, I do have a solution for you.I'm about to head into a WoW raid, so I'll type something up for you tomorrow morning.

  • Crimm

    Okay here's a solution for you. DHCP is what is changing your DNS server back to your local router. What you need to do is tell Ubuntu not to pick up the DNS server via DHCP or at least make it static. The easiest way to do this is:1. Go to a terminal2. Type "sudo pico /etc/dhcp3/dhclient.conf"3. You'll see a line commented out (If not add your own)… that says:"prepend domain-name-servers YOUR_DNS_IP_HERE;"I added mine just above the request subnet-mask line.4. You can reboot to make sure it sticks. If it does or does not, let me know :)

  • shawn

    Thanks for the edit. That worked on my server, but I’m still having problems on both of my laptops with Karmic and it’s slow “Resolving host…” Seems to occur on both Chromium and Firefox. I’m currently using OpenDNS servers, but I’ve also tried 4.2.2.2. Thanks again.

  • http://crimm.me admin

    Okay, so the fix works perfect on your server, but when you try that on your PC’s … It doesn’t help?

    When they are giving you that issue, can you ifconfig and double check the DNS setting is correct? I only say that thinking maybe it’s not taking the setting. Once changing the DNS to 4.2.2.2 as a test, restart the network with:

    sudo /etc/init.d/networking restart

    See if that helps. Let me know.

  • shawn

    The setting did keep, but it was still incredibily slow. The bug is being tracked here: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/417757. I’ve tried the solution and both of my laptops and it does help. The “Resolving host…” problem has gone away, but it’s still definitley slower than Win 7. I have Win 7 dual booting on the same laptop with Karmic and Win 7 is definitely faster. I want to switch completely to Ubuntu, but its things like this that are preventing me. Sure, I can workaround and eventually figure it out, but my non-technical wife can’t. She just wants it to work. Anyway, enough of my rant. Thanks for all your help.

  • shawn

    sorry, I meant to say I tried solution #72 on the bug tracker

  • Cristen Jamal

    What a rocking submit man – many thanks! And good web page theme BTW. It appears to be like a bunch like a wordpress weblog but I do know it’s blogenegine and it’s completely unique. The place did you uncover it?