Why am I getting inconsistent outputs for nslookup and dig?

Solution Verified - Updated -

Issue

  • Why do I not get the dig output when I dig without the FQDN of the node ?
  • Why am I getting inconsistent output when I dig a node in my environment as compared to the nslookup command for the same node?
  • node1,node2 are DNS clients while node3 is 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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.