Teststation Order from Chaos

Getting external IP using OpenDNS

I often need to know my external IP for debugging remote endpoints. I used to have an elaborate script to scrape it off whatismyip.com or use one of their API services, but they keep changing something or the other and make it difficult to rely on it. It turns out OpenDNS has a way to return your own IP address, and that too structured as a DNS responsesource:

dig @resolver2.opendns.com +short myip.opendns.com

That’s pretty neat, it’s fast and reliable :D