The most basic test after the DNS server has been set up properly is to ping the hostname of the nameserver and the domain itself. If both return a reply, your nameserver is querying properly.
Step 1. Ping the hostname of the nameserver for your network—in this case, RHEL01:
# ping rhel01
PING rhel01.example.com (172.168.1.1) 56(84) bytes of data.
64 bytes from rhel01.example.com (172.168.1.1): icmp_seq=1 ttl=64 time=0.036 ms
64 bytes from rhel01.example.com (172.168.1.1): icmp_seq=2 ttl=64 time=0.020 ms
— rhel01.example.com ping statistics —
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.020/0.028/0.036/0.008 ms
Step 2. Next, you can ping the domain name to ensure that the primary nameserver is again functioning properly:
# ping example.com
PING example.com (172.168.1.1) 56(84) bytes of data.
64 bytes from rhel01.example.com (172.168.1.1): icmp_seq=1 ttl=64 time=0.036 ms
64 bytes from rhel01.example.com (172.168.1.1): icmp_seq=2 ttl=64time=0.020 ms
— example.com ping statistics —
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.020/0.028/0.036/0.008 ms
Another useful tool that can help test whether your DNS server is functioning properly is the host command.
Syntax: host [option] HOSTNAME
Options:
-l Allows you to perform zone transfers
-r Disables recursive processing
-t Specifies the query type
-v Provides verbose output
You can use this command for two simple purposes to ensure functionality.
Step 3. First, perform a forward lookup to test the main zone file:
# host rhel01
rhel01.example.com has address 172.168.1.1
Step 4. Second, perform a reverse lookup to test the reverse lookup zone file:
# host 172.168.1.1
1.1.168.172.in-addr.arpa domain name pointer rhel01.example.com.
If the results that you are expecting don’t match what is displayed, or if the hostname or IP address can’t be found, it is a good indication there is a problem with that particular zone file.
This is a good way to test a few of the entries in each zone file to verify functionality of the DNS server. Aside from the host command, you can also use the nslookup command that offers slightly different information about lookups.
Step 5. Query the domain name again:
# nslookup example.com
Server: 172.168.1.1
Address: 172.168.1.1#53
Name: example.com
Address: 172.168.1.1
This time you see the nameserver for the example.com domain respond. This is a good way to find out which DNS server is responsible for a particular domain.
Step 6. You can also use nslookup like the host command to perform forward lookups:
# nslookup rhel01
Server: 172.168.1.1
Address: 172.168.1.1#53
Name: rhel01.example.com
Address: 172.168.1.1
Step 7. Plus, you can use it to perform reverse lookups:
# nslookup 172.168.1.1
Server: 172.168.1.1
Address: 172.168.1.1#53
1.1.168.172.in-addr.arpa name = rhel01.example.com.
No comments:
Post a Comment