[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to determine WAN IP address from behind a NAT router?



On Thu, May 05, 2005 at 04:30:27PM -0500, Alex Malinovich wrote:
> To quote the OP:
[snip]
> > But I don't want to rely on an external website.

Oops. Sorry about that. In that case, I'd use wget to grab
the status page off your router, then grep the part of the
page that lists the external IP. In my case -- with a
Linksys WRT54G router -- I'd do

wget -O - --http-user admin --http-passwd mypassword http://192.168.1.1/Status_Router.asp 2>/dev/null |grep -A 1 'IP Address:' |tail -1 |grep -o '<B>.*</B>' |sed 's/<\/\?B>//g'

That's a very-specific-to-my-router, very hackish way of
getting what I want, that will break as soon as the
formatting of the status page changes. But it works. If
you'd like me to walk through what the command line does,
let me know.

-- 
Stephen R. Laniel
steve@laniels.org
+(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key

Attachment: signature.asc
Description: Digital signature


Reply to: