# very slow DNS resolving [SOLVED]

## sniggit

Hi!

Im having this really annoying bug. Each time I try to load a web site, emerge something, whatever.. the connection hangs for about 10 seconds.

In the case of where I run emerge the system idles at the line "Resolving distfiles.gentoo.org......"  

Could it be i just have to setup a mirror? Seems a bit strange since it also happens why i try to access a random website.

And last, I know its not my connection cause when it first starts downloading I get my usual speed and also the error doesn't happen in Windows.

Thanks for any help!

----------

## m_spidey

Post your /etc/resolv.conf and check that your route is correct.

----------

## Ateo

If it's slow to resolve but normal speeds for downloads then it's the name servers you query. Check your latency to the name servers you query to verify that this could be the issue..

----------

## sniggit

resolv.conf:

```
# Generated by dhcpcd for interface eth0

nameserver 192.168.1.254

```

There it is. Not really sure what its supposed to point to..

BTW: A totally unrelated problem. The marker(the "|" that blinks and shows u where on the page ur writing) 

is set to the same color as the background (white) using firefox. Probably just a variable i have to change in preferences

but not sure what the technical term is, didn't find any obvious names like "marker" in the fonts meny...

----------

## m_spidey

ping that machine and see what kind of times you get back.

----------

## sniggit

```

ING 192.168.1.254 (192.168.1.254) 56(84) bytes of data.

64 bytes from 192.168.1.254: icmp_seq=1 ttl=64 time=0.540 ms

64 bytes from 192.168.1.254: icmp_seq=2 ttl=64 time=0.513 ms

64 bytes from 192.168.1.254: icmp_seq=3 ttl=64 time=0.547 ms

--- 192.168.1.254 ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 1999ms

rtt min/avg/max/mdev = 0.513/0.533/0.547/0.023 ms

```

what u think?

----------

## m_spidey

Their fantastic ping times. I notice the nameserver is actually on your own network is that true?

----------

## sniggit

could be dunno.. hooked up to a netopia router which uses ip 10.0.0.1

if i ping that address i get ping times of 1ms.

the nameserver adress is given by dhcpcd.

Any idea why I get this idle time issue?

----------

## m_spidey

try adding the line

```
nameserver 10.0.0.1
```

 as the first line in your /etc/resolv.conf and see if that improves anything.

----------

## sniggit

ok.

do I have to restart anything for the changes to take effect?

/etc/init.d/net.eth0 stop/start or something?

Update: just tried bringing eth0 down than back up.

seems dhcpcd overwrites resolc.conf everytime it starts.

----------

## m_spidey

Nope don't have to do anything just test out your connection with firefox or something

----------

## sniggit

Still getting the idle time  :Sad: 

Remember when I installed gentoo a few years back, the handbook said something about a

mirrorselect command.. But that would be just for portage right?

----------

## m_spidey

Yea that is just for portage mirrors ... mainly for fetching packages.

----------

## sniggit

kay....

any other ideas why this happens?

----------

## jmbsvicetto

Hi.

Another test you can do is measure how long the DNS server takes to answer your requests. Try the following:

```
# time dig forums.gentoo.org
```

----------

## sniggit

```
; <<>> DiG 9.3.2 <<>> forums.gentoo.org

;; global options:  printcmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12215

;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:

;forums.gentoo.org.             IN      A

;; ANSWER SECTION:

forums.gentoo.org.      56619   IN      A       140.211.166.170

;; Query time: 22 msec

;; SERVER: 10.0.0.1#53(10.0.0.1)

;; WHEN: Fri Mar 24 05:48:16 2006

;; MSG SIZE  rcvd: 51

real    0m0.025s

user    0m0.000s

sys     0m0.004s
```

Id say that was pretty fast... tried pinging a few other sites as well, all came back fast..

----------

## jmbsvicetto

 *sniggit wrote:*   

> 
> 
> Id say that was pretty fast... tried pinging a few other sites as well, all came back fast..

 

Yes, that was fast.

Have you enabled support for ipv6 in the kernel - grep IPV6 /usr/src/linux/.config? Have you defined a proxy - set | grep -i proxy? Have you configured wget to use a proxy - grep proxy /etc/wget/wgetrc | grep -v ^#?

----------

## sniggit

no, dont think so.

I used dhcpcd to set up my connection, u think that may be the problem?

Had any experience with dhcpcd?

----------

## jmbsvicetto

dhcpcd will configure your network interface. It will contact your DHCP server and configure it for the assigned ipv4 address.

Regardless of that, you may have or not enabled support for IPv6. I recall reading a long time ago of problems with network delays caused by enabling ipv6 in the kernel and not having support for it in the network.

----------

## sniggit

okay. I have piv6 in the kernel, the CONFIG_IPV6 is buildt in.

Any point in recompiling without this?

Any other modules U think i should leave out?

BTW: dunno if this is relevant but I also had this problem running gentoo from the live cd..

----------

## jmbsvicetto

Well, you have this problem when browsing, right? Have you tried opening Gentoo's page with http://204.225.92.144 instead of http://www.gentoo.org ? Does it take the same time or is it faster? If it takes less time, then you have a problem with name resolution. If not, it's something else.

----------

## sniggit

the ip was WAY faster.. think we are zeroing in on the problem here.

----------

## jmbsvicetto

Do you have nscd running - rc-update show | grep nscd? Look at /etc/nsswitch.conf and /etc/resolv.conf.

----------

## sniggit

Think i'll just print'em for U. Not really sure what I'm looking for

rc-update show came back " nscd |     " guess that means I have it boot its not in any runlevel. Should it be?

my /etc/nsswitch.conf:

```
# /etc/nsswitch.conf:

# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/nsswitch.conf,v 1.1 2005/05/17 00:52:41 vapier Exp $

passwd:      compat

shadow:      compat

group:       compat

# passwd:    db files nis

# shadow:    db files nis

# group:     db files nis

hosts:       files dns

networks:    files dns

services:    db files

protocols:   db files

rpc:         db files

ethers:      db files

netmasks:    files

netgroup:    files

bootparams:  files

automount:   files

aliases:     files

```

and my /etc/resolv: (which get overwritten every time dhcpcd gets started)

```
# Generated by dhcpcd for interface eth0

nameserver 192.168.1.254

```

----------

## jmbsvicetto

You can try using nscd and see if it improves the time for the second time you try to contact a server - rc-update add nscd default. The config files look ok.

You could try creating a DNS server on your network, but from your measurements of the time it took to solve names, I don't think it'll make a big difference.

----------

## sniggit

added nscd like u said and started it:

```

/etc/init.d/nscd start
```

still takes a long timein the: looking up <whatever>.com

any ideas?

also doesn't nscd only keep recent links in cache or am I missing the point?

----------

## jmbsvicetto

 *sniggit wrote:*   

> 
> 
> also doesn't nscd only keep recent links in cache or am I missing the point?

 

Yes, it does. That's why I've asked if it makes any difference on the second time you connect a server.

Are you using iptables or have you enabled any advanced networking feature on your kernel? I would suggest you try creating a new kernel without ipv6 support and any advanced networking feature and compare the time it takes to connect.

----------

## sniggit

okay.

Kernel making isn't exactly my strong side  :Smile: 

If u could tell me a little more precisisely where to look and what to look for

I would be very grateful.

----------

## sniggit

IT WORKS!

The web is flowning like usual!

Removed "Networking-->Networking Options-->The Ipv6 Protocol" and everything's as it should be.

Thanks for all the help, jmbsvicetto!

----------

## jmbsvicetto

I'm glad that you've solved your problem.

Mental note: another report that IPV6 support in the kernel can cause network delays (seems to affect name resolution).

----------

## PMcCauley

You could use the dns provided by your ISP as well.  You should be able to get that information from your routers configuration page.

Patrick

----------

## revertex

 *jmbsvicetto wrote:*   

> You can try using nscd and see if it improves the time for the second time you try to contact a server - rc-update add nscd default. The config files look ok.
> 
> You could try creating a DNS server on your network, but from your measurements of the time it took to solve names, I don't think it'll make a big difference.

 

A time ago i was discovered nscd, after starting using this crap my dns response was getting a hell slower, taking it out an everything was solved.

I strongly suggest you to avoid nscd, at least to me it get exactly the the oposite result as expected.

```
rc-update del nscd default
```

if someone can enlight us why nscd does not work as expected i really apreciate, a proper documentation seems a bit hard to foud.

----------

## Clete2

Sorry to bump, but I have to confirm that removing IPv6 support did the trick for me. Thanks!  :Very Happy: 

----------

