Why am I getting inconsistent outputs for nslookup and dig?
Issue
- Why do I not get the dig output when I
digwithout theFQDNof the node ? - Why am I getting inconsistent output when I
diga node in my environment as compared to thenslookupcommand for the same node? node1,node2are DNS clients whilenode3is my DNS server. Consider the below :
[root@node1 ~]# dig node2.example.com +short =====> I get the expected answer when I use the FQDN while querying.
192.168.122.161
[root@node1 ~]# dig node2 +short ==============> I do not get the expected answer when I do not use the FQDN while querying.
I get consistent outputs with nslookup command no matter whether I use the FQDN or not.
[root@node1 ~]# nslookup node2.example.com =====> I get the expected answer when I use the FQDN while querying.
Server: 192.168.122.170
Address: 192.168.122.170#53
Name: node2.example.com
Address: 192.168.122.161
[root@node1 ~]# nslookup node2 =============> I again get the expected answer when I DO NOT use the FQDN while querying (unlike in the case of dig command).
Server: 192.168.122.170
Address: 192.168.122.170#53
Name: node2.example.com
Address: 192.168.122.161
[root@node1 ~]# hostname
node1
[root@node1 ~]# hostname -f
node1.example.com
Environment
- Red Hat Enterprise Linux (RHEL)
- bind
- dig
- nslookup
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.