What is my IP address from the command line, revisited.
Last year I wrote about a little script I use to query checkip.dyndns.org for my current IP address from the Linux CLI. dyn’s checker has served me well over the years and has been rock solid stable, which is why I chose it.
A problem has come about however whereby it is returning a private IP address (192.168.xxx.xxx) which it is taking from the X-Forwarded-For value, rather than ignoring it purely because of the fact that it is a private (internal) IP.
So here is my new script, in its entirety:
echo -e "\n$(curl -s ifconfig.me/ip)\n"
If you visit ifconfig.me, on the bottom half of the page you will find a handful of other information you could extract. Now let’s hope that ifconfig.me sticks around for a while.