3 ms·
This only seems to work if your client can send requests directly to resolver1.opendns.com. It does not work if you have a server that is intercepting DNS or if
by dfc 3y ago
This only seems to work if your client can send requests directly to resolver1.opendns.com. It does not work if you have a server that is intercepting DNS or if you use the system configured DNS. The google version posted below is closer to what I was looking for:
$ dig +short TXT o-o.myaddr.l.google.com @ns1.google.com
"A.B.C.D"
$ dig +short TXT o-o.myaddr.l.google.com
"172.253.195.202"
"edns0-client-subnet A.B.C.0/24"
$ dig +short TXT o-o.myaddr.l.google.com @9.9.9.9
"162.244.55.23"
$ dig +short TXT o-o.myaddr.l.google.com @1.1.1.1
"172.71.221.175"
The opendns implementation returns nothing if you try something similar to the last three.
- arjvik 3y agoThere's a whole list of such resolvers: Akamai: dig +short whoami.akamai.net @ns1-1.akamaitech.net Google: dig +short o-o.myaddr.l.google.com txt @ns1.google.com Cloudflare: dig +short whoami.cloudflare ch txt @1.1.1.1 OpenDNS: dig -4 +short myip.opendns.com @resolver1.opendns.com Note that if you leave off the `@service.authoritative.nameserver` portion of all of the above, you get the IP address of the recursive resolver that your machine is configured to use. If you pass this to a service like https://ipinfo.io/ https://ipinfo.io/, you can use this to figure out what company's DNS service is currently configured, be it your ISPs, or an internet company like Cloudflare/Google/Quad9. Arguably, that is the only valid reason to be using an IP address echoer via DNS, as if you truly wanted your own IP, you could fetch it far easier from a service like icanhazip.com. Personally, Akamai's offering is by far the most useful and convenient--it's an A record, so you won't accidentally forget to add "txt" to your dig invocation, and has a very easy to remember name. Google's works too, though it requires remembering the strange domain name. Cloudflare tries to be cute and uses the Chaosnet DNS class, which while being an incredibly cool reference to internet history, unfortunately is not propagated by most public recursive resolvers. And like the parent comment mentions, OpenDNS somehow blocks requests that pass through a recursive resolver.
- dfc 3y agoThe opendns server does not return anything if I send the query to anything other than opendns.
- arjvik 3y agoAdmittedly my comment was incredibly long, but I did include > And like the parent comment mentions, OpenDNS somehow blocks requests that pass through a recursive resolver.
- pepa65 3y agoCudos: Akamai also doesn't put the returned IP address in quotes, unlike Google and Cloudflare.
- arjvik 3y agoBy virtue of being an A record (native IP address) rather than a TXT record (string)