LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Blogs > serafean
User Name
Password

Notices


Rate this Entry

Slow DNS lookups

Posted 11-16-2012 at 05:11 PM by serafean

Since quite some time I had been experiencing slow DNS lookups on some linux boxes. Today I finally got around to fixing it.
Symptoms : KDE fails to load google/wikipedia sometimes. firefox too, less often.

ping was the main tool in this case.
What I found was that
Code:
ping www.google.com
got an IP to ping very fast, however before anything appeared onscreen, it took up to 5 seconds. Pinging the IP address however returned immediately.
On a hunch, I tried disabling name resolution in ping.
Code:
ping -n www.google.com
Problem identified : reverse lookup. From there, I knew I had enabled mdns (avahi reverse lookup). A quick check on the Archlinux wiki revealed that indeed, it could be the cause of my slowdown.
From there, the fix was simple : in /etc/nsswitch.conf modify
Code:
hosts: files mdns4 dns
to
Code:
hosts: files mdns4_minimal dns mdns
Works a lot better!

Always remember : the simplest tool, used correctly, is the most powerful... Start dumb, get smart.
Posted in Random fixes
Views 1137 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 03:31 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration