Sometimes, when you are setting up a linux machine, there is a need to know what IP our machine is being connected to the public internet. There are many websites that provide this kind of service, but below are some of my favorites that work well with commands.
To be able to use this, we need a text based web browser. We will use curl in this case. Install curl if your machine does not have one.
# yum install curl -y
To get our ip address, run curl like below. Choose whichever you like :).
$ curl ipecho.net/plain
210.210.210.210
$ curl icanhazip.com
210.210.210.210
{
"ip": "210.210.210.210",
"city": "Kuala Lumpur",
"region": "Kuala Lumpur",
"country": "MY",
"loc": "3.1390,101.6869",
"org": "AS4818 Digi Telecommunications Sdn. Bhd.",
"postal": "50505",
"timezone": "Asia/Kuala_Lumpur",
"readme": "https://ipinfo.io/missingauth"
}
$ curl ipinfo.io/ip
210.210.210.210
$ curl ipinfo.io/city
Kuala_Lumpur
No comments:
Post a Comment