Howto get your external IP address via command line
September 28, 2013
I just had to find out the external IP address (as seen from the Internet) of a Linux server which is behind a NAT router. The normal way to goto WhatsMyIP didn’t work as I was only connected via SSH to this server. But the solution is quite easy thanks to the guys from ipecho, just type:
wget http://ipecho.net/plain -O - -q ; echo
Thats so easy! And even faster than using a browser in the first way ….. 🙂
4 Comments »
RSS feed for comments on this post. TrackBack URI
Leave a comment
Powered by WordPress
Entries and comments feeds.
Valid XHTML and CSS.
37 queries. 0.058 seconds.
Why not just:
curl http://ipecho.net/plain
Comment by Craig — September 28, 2013 #
After I discovered ifconfig.me I totally stopped using other similar sites. It helps to remember the URL that it is named after a unix utility.
IIRC if not specified it will use the User-Agent field to format the response. So you don’t even have to specify plaintext. Example:
curl ifconfig.me
Comment by Henrik — September 29, 2013 #
I never heard about it before. great alternative 🙂
Comment by Monika — October 9, 2013 #
@Henrik
Relying on the site’s interpretation of the User-Agent sounds seriously dangerous, if you’re going to use that in an application or some automated script.
So in that regard ipecho.net/plain is A LOT safer.
Comment by Mario — February 9, 2014 #