leftovers:find_my_public_ip
Table of Contents
Find My Public IP
Web Sites
-
- “Go to google and search for “my ip”.
- https://www.ipchicken.com/ - easy to remember
CLI
CLI commands to find your public IP address.
Curl
> curl icanhazip.com 11.22.33.44 > echo $(curl -s https://api.ipify.org) 11.22.33.44 # echo is just to add \n to the end
Dig
# via OpenDNS > dig +short myip.opendns.com @resolver1.opendns.com 11.22.33.44 # via Google > dig TXT +short o-o.myaddr.l.google.com @ns1.google.com "11.22.33.44" # via Akamai > dig @ns1-1.akamaitech.net ANY whoami.akamai.net +short 11.22.33.44
Install the ISC dig and host tools.
nslookup
# same as above, but nslookup for Windoze > nslookup myip.opendns.com resolver1.opendns.com Server: resolver1.opendns.com Address: 208.67.222.222 Non-authoritative answer: Name: myip.opendns.com Address: 11.22.33.44
PowerShell
(Invoke-WebRequest 'http://icanhazip.com/').Content
Which can be shortened to
(iwr 'http://icanhazip.com/').Content
Invoke-WebRequest is also aliased as curl so this is another way to get the same result.
curl icanhazip.com | Select-Object -ExpandProperty Content
You could sub http://api.ipify.org/ to get the same results.
leftovers/find_my_public_ip.txt · Last modified: by dave
