Hi list. I'm making a program that maps some ip address to a specified
dns. My problem is relative to CNAME record.
Supposing we have google ip, generated from a program, and we don't know
that this ip is pointing to www.google.it. This program try to get
hostname and give that the specified ip points to:
fra07s07-in-f103.1e100.net.
This name is obtained from gethostbyaddr();
There is a method to know that fra07s07-in-f103.1e100.net is pointed
from www.google.it?
Try to do the simple dns query to www.google.it, i get
; <<>> DiG 9.7.3 <<>> www.google.it
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58155
;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 4, ADDITIONAL: 4
;; QUESTION SECTION:
;www.google.it. IN A
;; ANSWER SECTION:
www.google.it. 327389 IN CNAME www.google.com.
www.google.com. 586589 IN CNAME www.l.google.com.
www.l.google.com. 165 IN A 209.85.148.104
www.l.google.com. 165 IN A 209.85.148.105
www.l.google.com. 165 IN A 209.85.148.106
www.l.google.com. 165 IN A 209.85.148.147
www.l.google.com. 165 IN A 209.85.148.99
www.l.google.com. 165 IN A 209.85.148.103
;; AUTHORITY SECTION:
google.com. 282625 IN NS ns2.google.com.
google.com. 282625 IN NS ns3.google.com.
google.com. 282625 IN NS ns1.google.com.
google.com. 282625 IN NS ns4.google.com.
;; ADDITIONAL SECTION:
ns3.google.com. 240988 IN A 216.239.36.10
ns4.google.com. 240988 IN A 216.239.38.10
ns1.google.com. 240988 IN A 216.239.32.10
ns2.google.com. 240988 IN A 216.239.34.10
;; Query time: 0 msec
;; SERVER: 10.1.1.5#53(10.1.1.5)
;; WHEN: Mon Apr 18 11:54:33 2011
;; MSG SIZE rcvd: 311
It said that www.google.it is a cname that point to www.google.com, that
point to www.l.google.com and that www.l.google.com. points to some
addresses.
Supposing that I have 209.85.148.104 ip, is possible (only knowing the
ip) go back to the CNAME record www.google.it?
I've tried this:
dig -x 209.85.148.104:
; <<>> DiG 9.7.3 <<>> -x 209.85.148.104
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64966
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4
;; QUESTION SECTION:
;104.148.85.209.in-addr.arpa. IN PTR
;; ANSWER SECTION:
104.148.85.209.in-addr.arpa. 69495 IN PTR fra07s07-in-f104.1e100.net.
;; AUTHORITY SECTION:
148.85.209.in-addr.arpa. 70180 IN NS ns4.google.com.
148.85.209.in-addr.arpa. 70180 IN NS ns3.google.com.
148.85.209.in-addr.arpa. 70180 IN NS ns1.google.com.
148.85.209.in-addr.arpa. 70180 IN NS ns2.google.com.
;; ADDITIONAL SECTION:
ns4.google.com. 240552 IN A 216.239.38.10
ns1.google.com. 240552 IN A 216.239.32.10
ns2.google.com. 240552 IN A 216.239.34.10
ns3.google.com. 240552 IN A 216.239.36.10
;; Query time: 0 msec
;; SERVER: 10.1.1.5#53(10.1.1.5)
;; WHEN: Mon Apr 18 12:01:49 2011
;; MSG SIZE rcvd: 231
and then, query the google dns:
dig @ns1.google.com -x 209.85.148.104
; <<>> DiG 9.7.3 <<>> @ns1.google.com -x 209.85.148.104
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62862
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available
;; QUESTION SECTION:
;104.148.85.209.in-addr.arpa. IN PTR
;; ANSWER SECTION:
104.148.85.209.in-addr.arpa. 86400 IN PTR fra07s07-in-f104.1e100.net.
;; Query time: 46 msec
;; SERVER: 216.239.32.10#53(216.239.32.10)
;; WHEN: Mon Apr 18 12:02:15 2011
;; MSG SIZE rcvd: 85
and this is the max level that I can obtain.
I've tried also with another domain (www.cnr.it) and using this method,
I can get from ip address that it points to www.cnr.it, The only
difference is that in cnr dns, www.cnr.it is not a cname record but IN
record.
Could someone point me in the right direction?
Thanks in advance