Friday, December 27, 2019

Discover External IP from Command Line

Getting your external IP address from the command line in both windows and linux is very easy with the OpenDNS resolver and a couple of easy commands found here.

In short, use dig on any unix variant (Linux, BSD, MacOS) as it is usually installed by default

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

and on Windows, if you don't have dig installed you can use nslookup

nslookup myip.opendns.com. resolver1.opendns.com