We have all been there: you’re logged into the SSH shell of a Linux box or a managed switch and you really need to check to see your public IP address. In any other situation, we would visit a website like whatismyip.com, but this router doesn’t have a browser. If you are on Linux, you may be able to hack together some unreproducable curl command piped into a heinously complex REGEX….no thanks.
Now there is a solution:
Each one of these commands will return a tiny, easy to read, JSON formatted response with your public IP address info (IPv6 or IPv4). If you want to check a specific address family, you can use ipv4.telnetmyip.com or ipv6.telnetmyip.com (or x.sshmyip.com, both domains point to the same place). The HTTP (port 80 based) service can be used with telnet as well for anybody who has outbound telnet and SSH ports blocked.
If you use SSH to connect to the service, it is worth noting that no authentication is needed to connect, but some SSH clients will require you to enter a username to start the connection. You can enter anything you want, nothing gets checked for authentication.
Using the API
“API’s: so hot right now”. How could anyone build something new and it not have one?
As mentioned above: the service returns a small JSON formatted response which can be parsed by a JSON library to make for a simple API call. If you want to put this API to use, you can find a small example Python library in the main CheckMyIP repo, and usage examples in the README.
If you happen to look at the GitHub Repo, then you will see that the telnetmyip.com service uses the very simplistic CheckMyIP codebase on the backend.
This Python app is very lightweight and does not (yet) have much in the way of protection against abuse. So if you see some way to improve its security or reliability, then please create an issue or fork the repo, commit some changes, and submit a pull request. Any help is appreciated!