Occasionally it is very useful to know what your public IP address is.  This can be beneficial for public services that require a route or port forward through your firewall, or if you just want to know what the public IP address is of a customer.



There are many ways to find your public IP address.


The most simplistic way is to visit a website that is designed to show you what your public IP address is.  A couple of examples are:


https://www.whatismyip.com


https://ipchicken.com



On occasion, it may be useful for you to use a command line prompt to find out what your public IP is.  Because your local computer won't have a public IP address assigned to it, simply issuing an "ifconfig" or "ipconfig" command will not work.  That will only return the private IP address of your local network.


Instead you will need to use a couple of DNS queries to return your public IP address.




For WINDOWS, copy and paste the following into your Command Prompt window:


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




For macOS, copy and paste the following into your Terminal window:


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