LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   dig utility does not return any answer for CNAME record (https://www.linuxquestions.org/questions/linux-server-73/dig-utility-does-not-return-any-answer-for-cname-record-4175501013/)

amit.kanade1983 04-08-2014 02:04 PM

dig utility does not return any answer for CNAME record
 
Hi,
I have a CNAME alias in my forward zone as follows...




$TTL 86400
@ IN SOA master-dns.example.com. root.example.com. (
102408 ;serial
3600 ;refresh after 6 hours
1800 ;retry after 1 hour
604800 ;expire after 1 week
86400 ) ;minimum TTL of 1 day
;
IN NS master-dns.example.com.
IN NS slave-dns.example.com.
@ IN A 192.168.88.135
slave-dns IN A 192.168.88.129
master-dns IN A 192.168.88.135
kakarott IN A 192.168.88.130
www2.example.com IN CNAME master-dns

When I do "dig www2.example.com" the output is...

[root@slave-dns slaves]# dig www2.example.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> www2.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 28074
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;www2.example.com. IN A

;; AUTHORITY SECTION:
example.com. 86400 IN SOA master-dns.example.com. root.example.com. 102408 3600 1800 604800 86400

;; Query time: 3 msec
;; SERVER: 192.168.88.129#53(192.168.88.129)
;; WHEN: Wed Apr 9 00:31:58 2014
;; MSG SIZE rcvd: 86


Why does it not respond with an IP address???

bathory 04-08-2014 03:15 PM

Hi,
Quote:

<snip>
www2.example.com IN CNAME master-dns
You miss the trailing dot after www2.example.com. Add it
Code:

<snip>
www2.example.com. IN CNAME master-dns

increase the serial, reload and try again

Regards

T3RM1NVT0R 04-08-2014 03:19 PM

@amit.kanade1983
 
As I can see from your output it says that it restored 0 answers. As you have setup CNAME try out this way:

dig master-dns.example.com, it should return both A record value of this CNAME as well as IP of the host.

amit.kanade1983 04-09-2014 10:10 AM

I have already tried "dig master-dns.example.com". it doesnt show any CNAME record in Answer section. But I'll try the fix suggested by bathory. Will, update soon.

amit.kanade1983 04-11-2014 11:04 AM

Hi,
I did the setting as suggested by bathory and it worked.

www2.example.com. IN CNAME master-dns

Output of "dig www2.example.com"

[root@master-dns ~]# dig www2.example.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> www2.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28011
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 1

;; QUESTION SECTION:
;www2.example.com. IN A

;; ANSWER SECTION:
www2.example.com. 86400 IN CNAME master-dns.example.com.
master-dns.example.com. 86400 IN A 192.168.88.135

;; AUTHORITY SECTION:
example.com. 86400 IN NS master-dns.example.com.
example.com. 86400 IN NS slave-dns.example.com.

;; ADDITIONAL SECTION:
slave-dns.example.com. 86400 IN A 192.168.88.129

;; Query time: 0 msec
;; SERVER: 192.168.88.135#53(192.168.88.135)
;; WHEN: Fri Apr 11 21:33:25 2014
;; MSG SIZE rcvd: 129



Thanks buddy...:)


All times are GMT -5. The time now is 12:03 AM.