WAN-IP of router

Michael Hipp Michael at hipp.com
Thu Aug 5 04:35:08 PDT 2010


On 8/5/2010 2:59 AM, Jorge Almeida wrote:
> Is there any sensible, script-friendly, way of finding my router's
> external (dynamical) IP? It looks surprisingly difficult, judging by
> Google results...
> The thing is an ASUS RT-N16. I intend to install dd-wrt, eventually,
> but for the time being it has the original software, which appears to
> be complete crap, BTW.

Take a look at this url:
  http://whatismyip.com/automation/n09230945.asp

Here's how I do it:
ip="$(lynx -dump http://whatismyip.com/automation/n09230945.asp  | egrep 
-o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')"

I don't remember where I stole that regex. Lynx is really handy for 
stuff like this.

Michael



More information about the Linux-users mailing list