Web Design

Categorized | Networking, cli

Find out your router’s external IP address using the Linux command line

If you want to find out what external IP address your router has assigned to it, you can either search the Internet for sites that can display that said IP address or you can use the Linux command line:

wget -O - -q icanhazip.com

Author Profile

T4L ;

Other posts by T4L

Author's web site



Are you satisfied with this blog?
Why not subscribe our RSS Feed? you will always get the latest post.


4 Comments

  1. Louis

    It gives the wrong address.

    This one works if you know pppoe:
    pppoe-status | grep -w ‘inet addr’ | tr ‘\t’ ‘ ‘ | cut -d ‘:’ -f 2 | cut -d ‘ ‘ -f 1

    else replace pppoe-status with ifconfig iface

    1

  2. @T4L: thanks, nice tip .

    @Louis: your command displays private IP address (internal), not external one :)

    2
  3. notmyrealname

    I had no issues with the wget command, but even simpler is this:

    curl canhazip.com

    cheers!

    3
  4. Anonymous

    @notmyrealname
    Yeah that works slick once I fix the typo of the site name! It looks like it would even work for a shellscript.

    4

4 Trackback(s)

  1. 16 08 2009 : Twitted by papyromancer
  2. 16 08 2009 : «? ? Ubuntu» » ??? ?????? ??????? IP ?? ????????? ?????? Linux
  3. 19 08 2009 : CLI command finds router External IP « Linux & Stuff
  4. 05 01 2010 : Bash script for Sitelutions.com dyndns | Leave a Penny, Take a Penny

Leave A Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>