Basic DNS Troubleshooting





Basic DNS Troubleshooting

Sometimes the source of problems can be due to misconfigured DNS rather than poor network connectivity. As mentioned before, DNS is the system that helps map an IP address to your Web site's domain name and your site may suddenly become unavailable if the mapping is incorrect.

Using nslookup to Test DNS

The nslookup command can be used to get the associated IP address for your domain and vice versa. The nslookup command is very easy to use; you just need to type the command, followed by the IP address or Web site name you want to query.

The command actually queries your DNS server for a response, which is then displayed on the screen. Failures can be caused by your server not having the correct value set in the /etc/resolv.conf file, as explained in Chapter 18, poor connectivity to your DNS server, or an incorrect configuration on the DNS server.

Using nslookup to Check Your Web Site Name

Here we see nslookup returning the IP address 216.151.193.92 for the site www.linuxhomenetworking.com:

     [[email protected] tmp]# nslookup www.linuxhomenetworking.com
     ...
     ...
     Name:   www.linuxhomenetworking.com
     Address: 216.151.193.92
     [[email protected] tmp]#

Using nslookup to Check Your IP Address

The nslookup command can operate in the opposite way in which a query against the address 216.151.193.92 returns the Web site named www.linuxhomenetworking.com:

     [[email protected] tmp]# nslookup 216.151.193.92
     ...
     ...
     Non-authoritative answer:
     92.193.151.216.in-addr.arpa    name = extra193-92.my-isp-provider.net.
     Authoritative answers can be found from:
     193.151.216.in-addr.arpa        nameserver = dns1.my-isp-provider.net.
     193.151.216.in-addr.arpa        nameserver = dns2.my-isp-provider.net.
     dns1.my-isp-provider.net   internet address = 216.151.192.1

     [[email protected] tmp]#

Using nslookup to Query a Specific DNS Server

Sometimes you might want to test the DNS mapping against a specific DNS server; this can be achieved by adding the DNS server's IP address immediately after the IP address of the Web site name you intend to query:

     [[email protected] tmp]# nslookup www.linuxhomenetworking.com 68.87.96.3
     ...
     ...
     Server:         68.87.96.3
     Address:        68.87.96.3#53
     Name:   www.linuxhomenetworking.com
     Address: 216.151.193.92

     [[email protected] tmp]#

Note

The nslookup command will probably be removed from future releases of Linux, but can still be used with Windows. The Linux host command can be used as a good replacement.


Using the host Command to Test DNS

More recent versions of Linux have started to use the host command for basic DNS testing. Fortunately, syntax is identical to that of nslookup and the resulting output is very similar:

     [[email protected] tmp]# host 216.151.193.92
     92.193.151.216.in-addr.arpa domain name pointer extra193-92.my-isp-
     provider.net.
     [[email protected] tmp]#

     [[email protected] tmp]# host www.linuxhomenetworking.com
     www.linuxhomenetworking.com has address 216.151.193.92
     [[email protected] tmp]#

     [[email protected] root]# host www.linuxhomenetworking.com 68.87.96.3
     Using domain server:
     Name: 68.87.96.3
     Address: 68.87.96.3#53
     Aliases:

     www.linuxhomenetworking.com has address 65.115.71.34
     [[email protected] root]#


     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows