Many times when I checking for example access or error logs, I need to know my public or external IP address (these days most people by now should be using NAT at home because their Internet access router configures it out of the box so that they cannot simply use ifconfig or ipconfig to see which IP address is in use).
To do so I would have more or less two options:
- Retrieve the public IP address from the router, or
- Consult an external server to provide me with the external IP address I'd be using to access that server.
Since routers come in many brands, types and operating systems, it is not generally possible to retrieve any information from it in a standard way. Furthermore, you might just be a simple user of the network that is not responsible for the network administration and as such you would not have access to the router to begin with.
So, that leaves us with the second option. There are many websites that provide a service for you to know your remote IP address, optionally with additional information such as your location, browser, supported languages, screen size, and what not. For me the most used sites are whatsmyip.net, whatsmyip.org and whatsmyip.com, but there are many more.
However, I'm to lazy to open a tab in my browser and type any of those URLs, I'm faster with the command line... ☺
- curl in.je/ip
- wget -qO - in.je/ip
jeroen@dev:~$ time curl in.je/ip 18.104.22.168 real 0m0.103s user 0m0.007s sys 0m0.007s
So it complies with the first requirement of working from the command line, where you can for example pipe it into a different program if necessary.
jeroen@dev:~$ curl in.je/ip/rdns crawl-66-249-76-156.googlebot.com
Please go to in.je/ip to read about all the features.
If you have any improvement or suggestion to share, please leave a message via the link below.