Friday, April 22, 2011

Show DNS servers / DNS cache

Show current DNS Servers
cat /etc/resolv.conf
DNS Cache
By default, Ubuntu doesn't perform DNS caching, however, the browser like FireFox may maintain its own DNS cache. To cache the DNS,
  • Use nscd (Name Service Cache Daemon)

    According to its description, this daemon should be installed only if the slow services like LDAP, NIS or NIS+ are used.
sudo apt-get install nscd
    To reset the nscd cache (equivalent to "ipconfig /flushdns" in Windows), use
sudo /etc/init.d/nscd restart
    or
service nscd restart
    or
service nscd reload
    Some said the following command should also clear the cache:-
sudo /etc/init.d/dns-clean start
    But it doesn't look like the dns-clean is designed to do that. According to the description in the dns-clean script, this script should be run at bootup to clean up any mess left by 0dns-up which is the other script that arranges for the correct resolv.conf file to be copied into place when a PPP connection comes up. PPP (Point-to-Point Protocol) is used for dial-up access to the Internet.

  • Use dsnmasq (Small Caching DNS proxy and DHCP/TFTP Server)

    To install dsnmasq, use
sudo apt-get install dsnmasq
    To reset the cache, use
sudo /etc/init.d/dnsmasq restart

  • Use BIND (Berkeley Internet Name Domain)

    It is Internet domain name server software. To install BIND, use
sudo apt-get install bind9
    To reset the cache, use
sudo rndc flush

If the DNS-resolved IP address is still incorrect, flush the DNS cache on all the upstream DNS servers.

Refs:
http://www.ubuntugeek.com/howto-clearflush-dns-cache-in-ubuntu.html
http://txt.binnyva.com/2009/04/find-current-dns-server/
http://omg.n1.pld.plz.thx.gg/cgi-bin/man/man2html?pppconfig+8
http://www.cyberciti.biz/faq/rhel-debian-ubuntu-flush-clear-dns-cache/

No comments:

Post a Comment