Finding IPv6 from IPv4 address of a host
One of my friend asked me an interesting question about relating IPv4 with IPv6. His question was: in dual stack setup, if we have IPv4 of a router/host, how can we find IPv6 associated with it?
Well, as far as I know there’s no direct way to relate IPv4 with IPv6 but there’s a nice trick out. Say e.g we have Google Public DNS operating at IPv4 – 8.8.8.8. To find IPv6 address of same server (if it exists at all), we can lookup for reverse DNS to get hostname,
anurag@laptop:~$ dig -x 8.8.8.8 +short
google-public-dns-a.google.com.
Next, we can lookup for AAAA record associated with that hostname.
anurag@laptop:~$ dig google-public-dns-a.google.com. AAAA +short
2001:4860:4860::8888
Simple, isn’t it? 🙂
This actually works. Here’s a pure IPv6 DNS lookup:
anurag@server7:~$ dig @2001:4860:4860::8888 he.net aaaa
; <<>> DiG 9.7.1-P2 <<>> @2001:4860:4860::8888 he.net aaaa
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;he.net. IN AAAA
;; ANSWER SECTION:
he.net. 63215 IN AAAA 2001:470:0:76::2
;; Query time: 35 msec
;; SERVER: 2001:4860:4860::8888#53(2001:4860:4860::8888)
;; WHEN: Mon Jan 2 17:58:38 2012
;; MSG SIZE rcvd: 52
Have a rocking IPv6 year ahead! 🙂
Nice trick Anurag!
Thanks for sharing. Keep it up!
Anurag, this won’t work if there is no PTR associated with IPv4.
Yes Alex, you are right about that. This whole crazy logic depends on PTR. 🙂
Nice post!
Btw what is status of IPv6 in India?
Slow man. Nothing considerable yet in case of IPv6. 🙁