/var/net/sys/admin/blog
| More

Some sample websites that you can use with curl to display your external public IP. As you know, especially if you are connected to a router, it will provide you private IP via the DHCP and it is NAT’ed. So using ‘ifconfig’, ‘ip addr show’, ‘hostname -I’ or via the GUI won’t show the public IP.

curl ifconfig.co  
curl icanhazip.com
curl ifconfig.me
curl ipecho.net/plain ; echo
curl ident.me ; echo
curl checkip.amazonaws.com
curl bot.whatismyipaddress.com ;echo
curl myexternalip.com/raw
curl whatismyip.akamai.com ; echo
curl myip.dnsomatic.com;echo
curl -s ipinfo.io | jq .ip
#need to install jq

Or you want to challenge yourself, you can combine it with sed to do some filtering

curl -s checkip.dyndns.org | sed -e ‘s/.*Current IP Address: //’ -e ‘s/<.*$//’

Share

Leave a comment

Name: (Required)

E-mail: (Required)

Website:

Comment:

 

About FLT

This site is dedicated to everyone who likes to learn and explore the beautiful world of Linux. If you have comments and suggestions, please feel free to email at freelinuxtutorials@gmail.com. I am happy to serve and share things esp. that is free and enjoyable as Linux.