How to find your IP address through DNS query
I found this snippet while looking at slides from a talk Rule 53 - Bizarre And Unusual Uses of DNS - FOSDEM 2023 most of which were funny, but not useful, until I came across this slide and it has 2 different methods of getting your IP address via DNS.
- host -t txt o-o.myaddr.1.google.com ns1.google.com
- dig myip.opendns.com @resolver1.opendns.com +short
example:
mattrose@fiesole:~$ host -t txt o-o.myaddr.1.google.com ns1.google.com
Using domain server:
Name: ns1.google.com
Address: 216.239.32.10#53
Aliases:
o-o.myaddr.1.google.com descriptive text "138.197.159.56"
mattrose@fiesole:~$ dig myip.opendns.com @resolver1.opendns.com +short
138.197.159.56