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
> dig +short myip.opendns.com @resolver1.opendns.com 11.22.33.44 > dig TXT +short o-o.myaddr.l.google.com @ns1.google.com "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
leftovers/find_my_public_ip.txt · Last modified: 2023-11-03 20:02 by dave