April 3, 2011, 10:35 a.m.
posted by whitehat
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
[[email protected] tmp]# nslookup www.linuxhomenetworking.com ... ... Name: www.linuxhomenetworking.com Address: 184.108.40.206 [[email protected] tmp]#
Using nslookup to Check Your IP Address
[[email protected] tmp]# nslookup 220.127.116.11 ... ... Non-authoritative answer: 18.104.22.168.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 = 22.214.171.124 [[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 126.96.36.199 ... ... Server: 188.8.131.52 Address: 184.108.40.206#53 Name: www.linuxhomenetworking.com Address: 220.127.116.11 [[email protected] tmp]#
Using the host Command to Test DNS
[[email protected] tmp]# host 18.104.22.168 22.214.171.124.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 126.96.36.199 [[email protected] tmp]# [[email protected] root]# host www.linuxhomenetworking.com 188.8.131.52 Using domain server: Name: 184.108.40.206 Address: 220.127.116.11#53 Aliases: www.linuxhomenetworking.com has address 18.104.22.168 [[email protected] root]#