NetWiki

I can make net work

User Tools

Site Tools


leftovers:find_my_public_ip

Find My Public IP

Web Sites

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

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki