LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   'dig' resolving (https://www.linuxquestions.org/questions/linux-general-1/dig-resolving-791432/)

junust 02-25-2010 02:26 AM

'dig' resolving
 
Hi,

Code:


root@localshot:/etc/rc.d# host dc3
dc3.test.com has address 192.168.1.2


Code:

root@localhost# nslookup dc3
Server:        192.168.1.100
Address:        192.168.1.100#53

Name:  dc3.test.com
Address: 192.168.1.2

BUT

Code:

root@localhost:/etc/rc.d# dig dc3

; <<>> DiG 9.4.3-P3 <<>> dc3
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 60864
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;dc3.                          IN      A

;; Query time: 0 msec
;; SERVER: 192.168.1.100#53(192.168.1.100)
;; WHEN: Thu Feb 25 17:19:03 2010
;; MSG SIZE  rcvd: 22

Code:


cat /etc/resolv.conf
search test.com
nameserver 192.168.1.100


Why 'dig', could not resolve name to IP, whereas 'host' and 'nslookup' could...


tested on RHEL5 and Slackware 13

bathory 02-25-2010 02:44 AM

Hi,

By default dig ignores the search/domain directive in /etc/resolv.conf. If you want to use it add "+search" option in your command:
Code:

dig dc3 +se
Regards

junust 02-25-2010 02:59 AM

Thanks...


I added $HOME/.digrc (+search option)to do stuff permanent


All times are GMT -5. The time now is 09:47 PM.