DNS Lookup

Most mainstream operating systems come with a standard set of DNS tools that allow you to perform certain tasks.

Many of these tools are useful for analysing DNS records. You can perform manual DNS lookups, through your locally defined DNS server or via alternate servers in order to make sure your DNS records have been updated or if you are having problems they can help to diagnose them. It is also possible to flush your DNS and clear the cache if needed.

Windows DNS Tools

From the command prompt, you can run the nslookup command with a set of parameters that allow you to do certain things. One of the most common operations you may wish to perform is to do a simple lookup. This can be done by running the nslookup command followed by the hostname you wish to resolve. Eg.

nslookup www.whatsmydns.net

This method of lookup will use your locally defined DNS server (usually handed out by your networks router).

Sometimes it is useful to do a lookup to an alternate name server, in the case that your default name server is not returning correct results. To perform a lookup on an alternate name server you simply add it as the second parameter to the command line. Eg.

nslookup www.whatsmydns.net ns1.server.com

Flush DNS

Most operating systems and DNS clients will automatically cache IP Addresses and other DNS results, this is done in order to speed up subsequent requests to the same hostname. Sometimes bad results will be cached and therefore need to be cleared from the cache in order for you to communicate with the host correctly. All major operating systems allow you to force this process, outlined below are the common steps you will need to follow in order to flush your DNS cache.

Windows 98/NT/2000/XP Flush DNS

Flushing the DNS on Windows is an easy process, outlined below is the steps that should be run if you wish to clear your DNS cache.

  1. Open a command prompt (Start > Run > cmd.exe > OK).
  2. Type in the command ipconfig /flushdns
flush-dns-windows-xp-step-1
flush-dns-windows-xp-step-2
flush-dns-windows-xp-step-3
flush-dns-windows-xp-step-4
flush-dns-windows-xp-step-5
flush-dns-windows-xp-step-6
flush-dns-windows-xp-step-7

Windows Vista / Windows 7 Flush DNS

Flushing DNS on newer versions of Windows is almost as easy as the earlier versions but due to Microsofts security additions you must run the command prompt with administrator privileges.

  1. Click the start button and navigate to the command prompt (Start > All Programs > Accessories > Command Prompt)
  2. Make sure that you right click on the command prompt application and choose “Run as Administrator”
  3. Type in the command ipconfig /flushdns
flush-dns-windows-vista-7-step-1
flush-dns-windows-vista-7-step-2
flush-dns-windows-vista-7-step-3
flush-dns-windows-vista-7-step-4
flush-dns-windows-vista-7-step-5
flush-dns-windows-vista-7-step-6
flush-dns-windows-vista-7-step-7

Note: It is also possible to type in cmd into the Windows Vista / Windows 7 start menu search field and then right click on the cmd.exe result instead of having to navigate through the various sub menus.

Mac OS X Flush DNS

Flushing the DNS in Mac OS X is an easy process, but the steps taken will depend on which version of OS X you are running.

Mountain Lion or Lion

If you are running Mac OS X 10.7 or 10.8, you need to do the following:

  1. Open up the command terminal.
  2. Run the command sudo killall -HUP mDNSResponder

Snow Leopard

If you are running Mac OS X 10.6, you need to do the following:

  1. Open up a command terminal.
  2. Run the command dscacheutil -flushcache

Leopard and below

If you are running Mac OS X 10.5.1 or below, you need to do the following:

  1. Open a command terminal.
  2. Run the command lookupd -flushcache

Linux Flush DNS

If you are running the nscd Name Service Cache Daemon then you will need to do the following.

  1. Open up a command terminal (either as root or run step 2 with sudo)
  2. Run the command /etc/init.d/nscd restart