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