This is a work in progress, I will be... Full Story
By Manny Fernandez
May 11, 2020
Doing “IP Chicken” from the CLI
OK, so it is not REALLY IPChicken, but I need to equate it to something. I use www.ipchiken.com
but there are a bunch out there. When you are on a Linux server with no GUI, you can run a command via the CLI that will tell you what public IP you are using.
Note, some minimal installs do not have dig
by default. You will need to install it. To install it, type:
yum install bind-utils
NOTE: This is for a CentOS distribution, if you are using a Debian based, you can apt-get install
instead.
dig TXT +short o-o.myaddr.l.google.com @ns1.google.com
you should see your IP as the output
e.g. 12.1.1.1
You can also use curl
& if you do not have it installed, you will need to install it. To install it, type:
yum install curl
NOTE: This is for a CentOS distribution, if you are using a Debian based, you can apt-get install
instead.
curl http://ipinfo.io
And thanks to Aldo Lopez, he also suggested curl ifconfig.me
which is similar to the .io
but more concise output without the additional info.
And thanks to Matt Sherif, he also suggested using curl but with the domain of icanhazip.com
Hope this helps
Recent posts
-
-
I have been playing with the free version of... Full Story
-
In my day job, I am on a lot... Full Story