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

  1. Why not just:
    curl http://ipecho.net/plain

    Comment by Craig — September 28, 2013 #

  2. 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 #

  3. I never heard about it before. great alternative 🙂

    Comment by Monika — October 9, 2013 #

  4. @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 #

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Powered by WordPress
Entries and comments feeds. Valid XHTML and CSS. 36 queries. 0.043 seconds.