Debian 6 Slow DNS Resolution

  • Thread starter Thread starter KIA
  • Start date Start date

KIA

KIA

Man of Honour
Joined
14 Nov 2004
Posts
13,826
Hi,

DNS is slow to resolve under certain situations. A ping to a random domain will resolve almost instantly:

Code:
root@debian:~# time ping -c 1 bbc.co.uk
PING bbc.co.uk (212.58.224.138) 56(84) bytes of data.
64 bytes from virtual-vip.thdo.bbc.co.uk (212.58.224.138): icmp_req=1 ttl=122 time=31.8 ms

--- bbc.co.uk ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 31.805/31.805/31.805/0.000 ms

real    0m0.125s

It's a different story when it comes to wget against a fast HTTP server:

Code:
root@debian:~# time wget http://www.thinkbroadband.com/images/header/thinkbroadband-white.png
--2011-04-03 16:58:06--  http://www.thinkbroadband.com/images/header/thinkbroadband-white.png
Resolving www.thinkbroadband.com... 80.249.99.130, 2a02:68:1::4
Connecting to www.thinkbroadband.com|80.249.99.130|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4015 (3.9K) [image/png]
Saving to: `thinkbroadband-white.png.1'

100%[======================================>] 4,015       --.-K/s   in 0.03s

2011-04-03 16:58:11 (124 KB/s) - `thinkbroadband-white.png.1' saved [4015/4015]


real    0m5.202s

I'm currently using Google DNS. The same issue occurs if I switch to OpenDNS.

Any ideas?

Cheers.
 
Last edited:
Looking at those timings, I'm not quite sure what the problem is. :confused:

real 0m5.202s vs real 0m0.125s ?

Isn't that the timing for the entire command, not just the DNS part?

Wget is doing a whole lot more than ping is doing, and pulling in many more bytes.
 
If you were to see a video of the wget command in action, you would see it sit on "resolving domain.com" for four seconds.

Here's the same command on another box:

Code:
[user@host /usr/home/user]$ time wget http://www.thinkbroadband.com/images/header/thinkbroadband-white.png
--2011-04-03 16:32:32--  http://www.thinkbroadband.com/images/header/thinkbroadband-white.png
Resolving www.thinkbroadband.com (www.thinkbroadband.com)... 80.249.99.130, 2a02:68:1::4
Connecting to www.thinkbroadband.com (www.thinkbroadband.com)|80.249.99.130|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4015 (3.9K) [image/png]
Saving to: `thinkbroadband-white.png'

100%[======================================>] 4,015       --.-K/s   in 0.002s

2011-04-03 16:32:32 (2.49 MB/s) - `thinkbroadband-white.png' saved [4015/4015]


real    0m0.235s
 
Code:
root@debian:~# cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
root@debian:~#

Code:
root@debian:~# dig overclockers.co.uk @8.8.8.8

; <<>> DiG 9.7.2-P3 <<>> overclockers.co.uk @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19790
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;overclockers.co.uk.            IN      A

;; ANSWER SECTION:
overclockers.co.uk.     9772    IN      A       91.151.218.10

;; Query time: 40 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Sun Apr  3 19:50:45 2011
;; MSG SIZE  rcvd: 52

Similar to http://www.linuxquestions.org/questions/linux-networking-3/slow-dns-resolution-789109/

dig, host & ping don't suffer from the issue.
 
I know of x11 forwarding etc. I don't want to install anything unnecessary if I can help it. :)

It hangs on:

Code:
recvfrom(3, "a`\201\200\0\1\0\3\0\0\0\0\3www\6google\3com\0\0\1\0\1"..., 2048, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, [16]) = 84
gettimeofday({1301858080, 376379}, NULL) = 0
poll([{fd=3, events=POLLIN}], 1, 4915

Let me know if you need the rest of the output.
 
Edit that file and change the line to:
Code:
alias net-pf-10 off ipv6
Then reboot.

Not sure if it'll help but worth a shot.
 
:rolleyes: Thought you tried the link I posted earlier.

Please try to keep up when others are helping you out. So it is an ipv6 issue... Scroll up, there's enough in this thread for you to figure it out, without me spoon feeding the answer to you.

Oh dear, I missed something but I must have done it on purpose, right?

Forget the "help" if you're going to speak to me like that.

Thank you, russ0r, for the help without the unnecessary remarks. :)
 
Back
Top Bottom