LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   "host" works, "dig" fails... what? (https://www.linuxquestions.org/questions/linux-networking-3/host-works-dig-fails-what-922469/)

dafydd2277 01-06-2012 03:00 PM

"host" works, "dig" fails... what?
 
So, I just added a new subnet and subdomain to my DNS environment. "host" sees the new just fine, but "dig" fails? In fact, dig even fails to a subdomain that has been around a while. (The new subnet is next to the old one, and they've been combined with a 23-bit netmask.)

...

What? They're both making the same query to the same DNS server based on the same resolv.conf file.


Existing subdomain/subnet:
Code:

[root@admin ~]# host abc012
abc012.old.sub.dom has address 192.168.22.192

[root@admin ~]# dig abc012
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_5.3 <<>> abc0012
;; global options:  printcmd
;; connection timed out; no servers could be reached

New subdomain/subnet:
Code:

[root@admin ~]# host def005
def005.new.sub.dom has address 192.168.23.107

[root@admin ~]# dig def005
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_5.3 <<>> def005
;; global options:  printcmd
;; connection timed out; no servers could be reached

It gets even weirder! Ping and ssh split the difference. They see the old one, but not the new one.
Code:

[root@admin ~]# ping abc012
PING abc012.old.sub.dom (192.168.22.192) 56(84) bytes of data.
64 bytes from abc012.old.sub.dom (192.168.22.192): icmp_seq=1 ttl=64 time=0.127 ms
64 bytes from abc012.old.sub.dom (192.168.22.192): icmp_seq=2 ttl=64 time=0.110 ms
64 bytes from abc012.old.sub.dom (192.168.22.192): icmp_seq=3 ttl=64 time=0.102 ms

--- abc012.old.sub.dom ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 0.102/0.111/0.127/0.009 ms

[root@admin ~]# ping def005
ping: unknown host def005

Dubya Tee Eff, Ovah? ;-)

Any ideas out there?

dafydd

bathory 01-06-2012 04:10 PM

Hi,

By default digs needs a FQDN, unless using the +search option (or +se). In that case it looks in /etc/resolv.conf for the domains defined by the search directive.
Since host can resolve both old and new subdomains, I guess they are both present in the search line of /etc/resolv.conf.
Try :
Code:

dig abc012 +se
to see if it works

Regards


All times are GMT -5. The time now is 10:31 PM.