How to Find Public IP Address from CLI

Often, an IP address is hidden behind a proxy or NAT. Here is how you can tell the public IP:

Using Curl to check Public IP:

curl -s|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'

Check Public IP with Curl

Using Telnet to check Public IP:

telnet 80 | grep confidence | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}'

Check Public IP with Telnet

Using wget to check Public IP:

wget -O - -q

Find Public IP with wget

Using lynx to find Public IP Address:

wget -O - -q

Find Public IP with lynx

6 replies on “How to Find Public IP Address from CLI”

I don’t know cisco, but a 30 second google found commands like ‘show ip route’ and ‘show ip interface’ that will point you in the right direction. I believe you can pipe to ‘include’. I don’t have a cisco anything to test on though. I’m sure one of the other readers knows off the top of their head 🙂

You can also use the following command to get external IP address
Non-authoritative answer:
Address: <—– External IP Address

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.