# Slow DNS lookups?[SOLVED- sort of]

## CKirocZ

My Gentoo box is having some problems with DNS lookups. It takes ~10 seconds to connect to any site with any program. I first emerged net-dns/bind-tools to troubleshoot the problem but for some reason the problem was not repeatable with these tools. I then emerged net-dns/djbdns and set up dnscache to forward DNS queries to my router (DI-624, with DNS Relay enabled), this seemed to help a little - ~2 seconds to connect. Finally, I googled "slow dns" and found a recommendation for OpenDNS which I promptly implemented (both at the router and dnscache-setup).

My DNS lookups are now normal.

I don't have a clue why my DNS lookups were so slow to begin with, and I also know that what I have done is a bandaid fix for the original problem that still exists. I would appreciate any and all help resolving this problem, and also reports of the same problem.

Also check out http://www.opendns.com/

Also, before anyone asks - of course I used the forum's search feature, but it's still like finding a needle in a haystack!Last edited by CKirocZ on Sun Dec 31, 2006 4:24 pm; edited 1 time in total

----------

## PaulBredbury

It sounds like the nameservers that the router was using were bad/slow.

I'd say the best way to use bind/djbdns is to let it do its job of contacting the root nameservers and drilling down as normal, rather than relying on some ISP's overloaded nameservers. Personally, I happily run bind.

----------

## MrPaulAR

You may also have some good luck with OpenDNS if you don't want to run your own nameserver.  I've noticed they respond *much* faster than my office (internal nameservers) and ISPs.  They also offer some pretty neat features (typo correction, anti-phishing, etc).

----------

## CKirocZ

Thanks for the replies!!

I work strange hours so I don't get to check back often enough.

I have to very respectfully disagree about the DNS servers being overloaded causing my problem. The problem doesn't occur in Windows, only in Gentoo. (I should have mentioned this in my original post but I had to run off to work) I am thinking that it may be something off in my configuration, but I don't know where to begin.

/etc/conf.d/net:

```
# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /etc/conf.d/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

modules=( "!apipa" "!arping" "!ccwgroup" "!iptunnel" "!macchanger" "!macnet" "!rename" "ifconfig" "!iproute2" "!system" "dhclient" "!dhcpcd" "!ip6to4" )

config_eth0=( "dhcp" )

dhcp_eth0="release nodns nontp nonis"

dns_servers_lo=127.0.0.1

fallback_eth0=( "192.168.14.103 netmask 255.255.255.0" )

fallback_route_eth0=( "default via 192.168.14.1" )

```

/etc/resolv.conf:

```
# Generated by net-scripts for interface lo

nameserver 192.168.14.1

```

How do I keep my resolv.conf from being overwritten? It should be "nameserver 127.0.0.1" for djbdns (svscan).

I thought the "nodns" in /etc/conf.d/net would stop that from happening.

Here's some possibly relevant stuff from syslog-ng:

```
Dec 29 13:36:44 * eth0: link up, 100Mbps, full-duplex, lpa 0x41E1

Dec 29 13:36:48 * dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8

Dec 29 13:36:48 * dhclient: DHCPOFFER from 192.168.14.1

Dec 29 13:36:48 * dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67

Dec 29 13:36:48 * dhclient: DHCPACK from 192.168.14.1

Dec 29 13:36:48 * dhclient: bound to 192.168.14.103 -- renewal in 256680 seconds.

```

----------

## CKirocZ

Here's some more info from verbose setting in rc.conf output through syslog-ng:

```
 *     modules: ifconfig dhclient

 *       ifconfig provides interface

 *       dhclient provides dhcp

 *   Bringing up eth0

 *     dhcp

 *       Running dhclient ...                                                                                             [ ok ] *       eth0 received address 192.168.14.103/24

```

----------

## cswbww

if you don't want dhcp to change your resolv.conf. you can set that in /etc/dhcp/dhclient.conf as

```
supersede domain-name-servers 127.0.0.1;
```

there is an example conf.

----------

## CKirocZ

My /etc/dhcp/dhclient.conf.sample looks like this:

```
send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;

send dhcp-lease-time 3600;

supercede domain-name-servers 127.0.0.1;

request subnet-mask, broadcast-address, time-offset, routers,

   domain-name, domain-name-servers, host-name;

require subnet-mask, domain-name-servers;

timeout 60;

retry 60;

reboot 10;

select-timeout 5;

initial-interval 2;

media "-link0 -link1 -link2", "link0 link1";

reject 192.33.137.209;

alias {

  interface "ep0";

  fixed-address 192.5.5.213;

  option subnet-mask 255.255.255.255;

}

lease {

  interface "ep0";

  fixed-address 192.33.137.200;

  medium "link0 link1";

  option subnet-mask 255.255.255.0;

  option broadcast-address 192.33.137.255;

  option routers 192.33.137.250;

  option domain-name-servers 127.0.0.1;

  renew 2 2000/1/12 00:00:01;

  rebind 2 2000/1/12 00:00:01;

  expire 2 2000/1/12 00:00:01;

}

```

What needs to be changed/removed/added in order to drop the .sample and use it? (I don't have a dhclient.conf!)

This is quite possibly the only sample/example config file that does not explain how to configure it properly.

Thanks, for your help!

----------

## cswbww

you only add lines that you want, no need for all sample configs in example file.

----------

## CKirocZ

Thanks cswbww, will try that immediately! Back in a moment, hopefully.

----------

## CKirocZ

It worked!! Thanks, again!

----------

## CKirocZ

Now how do I append [Solved] to this topic?

----------

