Date: Wed, 3 Sep 2003 16:21:11 -0700 From: "Drew Tomlinson" <drew@mykitchentable.net> To: "Matthew Emmerton" <matt@compar.com>, "FreeBSD Questions" <freebsd-questions@freebsd.org> Subject: Re: How to Get Public IP From LinkSys Router? Message-ID: <020b01c37272$10de05d0$6e2a6ba5@lc.ca.gov> References: <019101c37248$ffd50c30$6e2a6ba5@lc.ca.gov> <001401c3724a$ba4dc0b0$1200a8c0@gsicomp.on.ca> <01e101c37265$f0b9aef0$6e2a6ba5@lc.ca.gov> <005401c3726e$0db28c40$1200a8c0@gsicomp.on.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
----- Original Message ----- From: "Matthew Emmerton" <matt@compar.com> To: "Drew Tomlinson" <drew@mykitchentable.net>; "FreeBSD Questions" <freebsd-questions@freebsd.org> Sent: Wednesday, September 03, 2003 3:52 PM Subject: Re: How to Get Public IP From LinkSys Router? > > > > I need to get my public IP address from a LinkSys cable router and > > don't > > > > have any idea where to start. The LinkSys is doing NAT and my FBSD > > box > > > > in on the private network on the inside. What commands and/or ports > > are > > > > there that would provide the public IP address from the command line > > so > > > > I pass the IP to a script? Any ideas? > > > > > > The way I do it with my router (BEFW11S4 V2) is to use lynx to > > download the > > > HTML status page from the router and extract the public IP address. I > > do > > > this in a cron job every 15 minutes, and when it notices an IP change, > > it > > > fires off my dynamic DNS updates. > > > > This seems like the best way. Would you be willing to share your script > > that grabs the status page and extracts the IP? I'm not very good with > > regular expressions yet and would appreciate the kick start. > > The sequence of commands I used is quite dependent on the format of the page > (which has changed in the past after firmware upgrades). > > /usr/local/bin/lynx -dump -auth=username:password http://routerip/Status.htm > | /usr/bin/grep "IP Address" | /usr/bin/tail -1 | /usr/bin/awk ' { print > $3 } ' Thank you! That works on my regular BEFW11S4 (no version) at firmware level 1.44.2z, Dec 13 2002 (the latest for this model). Drew
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?020b01c37272$10de05d0$6e2a6ba5>