Getting your public IP Address from the command line

Written by James McDonald

October 14, 2023

Note: If you are filtering DNS for Proxy & Filter Avoidance or have configured you network to only allow connection to trusted DNS Servers the first two will fail so use the Web Request options

linux / wsl DNS Query

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

Windows DNS QUery

nslookup myip.opendns.com resolver1.opendns.com

Linux using Web Request

echo $(curl -s ifconfig.me)
# or
curl -s https://ifconfig.me; echo 

Powershell WEB rEQUEST

(Invoke-WebRequest ifconfig.me/ip).Content

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…