Test 7: Testing for DNS Functionality

Test 7: Testing for DNS Functionality

The function of the DNS server was the topic of Introduction to the Domain Name Service. Everything from the game your are playing, your email program, your web browser and most other programs that use the Internet will use DNS servers to look up the IP addresses for names. You can look up IP addresses, too, using the nslookup command in a command prompt window. It's a good test when you are having trouble reaching sites on the Internet. The basic nslookup command starts an interactive session as shown in the following screenshot.

Starting an nslookup session

The nslookup session starts with the program displaying name and IP address of the default DNS server in use and the ">" prompt signifying that nslookup is waiting for a command. You should see one of the IP addresses that your ISP gave you (either statically or dynamically via your ISP's DHCP server) for your DNS servers in place of the IP address above. Some routers mask your ISP's DNS server by offering a "pass-through" service at your LAN's gateway address. In that case, the DNS server your see will be that IP address (e.g., 192.168.0.1) If you get "DNS request timed out" instead of the ">" prompt, you are having trouble reaching your ISP's DNS servers. We'll cover that in a minute, but for now, let's assume the DNS server is responding and nslookup is waiting for a command. We'll start with the most basic and most often used command, the name to IP address lookup. We do that by typing any site name at the ">" prompt. For example, I typed www.google.com and got the response you see in the screenshot below.

Result of doing an nslookup on www.google.com

Unlike most sites, Google resolves to more than one IP address. The is because Google servers are replicated and geographically distributed all over the world, so more than one may be useable by your computer at any given time. This is also why Google makes a good test subject. Even if one or more Google servers are down at any given time, it's a good bet that at least some of them are up and responding and those will be the ones the DNS query returns.

You can pick the DNS server you wish to use by using the server command as shown in the screenshot below. I explicitly changed to one of my ISP's DNS servers using the command server 199.45.32.38 and hitting enter. The nslookup program acknowledged my change by listing the new "Default Server." Again, I try the names of a few well-known sites that are likely to be known by any DNS server.

Doing an nslookup using an alternate DNS server

Next, I could try my ISP's other DNS server using the server command as above and the IP address of my ISP's other DNS service. It's a good idea to check both DNS servers provided by your ISP (or more if more are provided). If your ISP moves one of its DNS servers to a new IP address, the other one in your list will be used automatically. However, you've now lost DNS redundancy, which was the reason for having more than one DNS server available in the first place. If the remaining server should fail, be taken down for maintenance, or also have its IP address changed, you won't be able to access sites on the Internet except by IP address.

Doing an nslookup from the command line

Finally, you can specify which DNS server to use when using the command line as shown in the next screenshot. This is also useful if you are getting the "DNS request timed out" error using your default DNS server. You can attempt to use your alternate (a.k.a., secondary) DNS server by putting its address.

Doing an nslookup from the command line using an alternate DNS server

If secondary DNS query works, but your primary DNS server query did not, you might want to temporarily switch the order of the DNS servers listed in the TCP/IP properties for your Ethernet adapter. In Windows XP and Vista and even when using dynamic IP addressing, you can explicitly set the DNS servers to use as shown in the following screenshot.

Example of changing to order of DNS server by explicitly setting them

The example above supposes that the lone entry we are using for DNS is the secondary DNS server that we could successfully query. There is an alternative when you are using dynamic IP addressing for your LAN using your router's DHCP server. In this case, you can change the DNS addresses listed in your router's configuration page. The devices on your LAN would then need to ask for new dynamic IP addresses (e.g., using ipconfig /renew in a command prompt window). This may be simpler than changing each device individually.