From owner-freebsd-questions@FreeBSD.ORG Wed Sep 3 17:40:23 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E802716A4BF for ; Wed, 3 Sep 2003 17:40:23 -0700 (PDT) Received: from freep.dyns.net (adsl-64-170-113-129.dsl.snfc21.pacbell.net [64.170.113.129]) by mx1.FreeBSD.org (Postfix) with SMTP id 4A5D143FBF for ; Wed, 3 Sep 2003 17:40:22 -0700 (PDT) (envelope-from micheas@micheas.dyns.net) Received: (qmail 85753 invoked from network); 4 Sep 2003 00:40:21 -0000 Received: from tux.a (HELO tux) (mail@10.0.0.173) by sol.a with SMTP; 4 Sep 2003 00:40:21 -0000 Received: from micheas by tux with local (Exim 3.36 #1 (Debian)) id 19uiAf-0000CF-00 for ; Wed, 03 Sep 2003 17:40:21 -0700 From: Micheas Herman To: FreeBSD Questions In-Reply-To: <005401c3726e$0db28c40$1200a8c0@gsicomp.on.ca> 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> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1062636021.713.3.camel@tux> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Wed, 03 Sep 2003 17:40:21 -0700 Sender: Micheas Herman Subject: Re: How to Get Public IP From LinkSys Router? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Sep 2003 00:40:24 -0000 On Wed, 2003-09-03 at 15:52, Matthew Emmerton wrote: > > > > 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 } ' > the Xsense routers have no user name so you need -auth='':password to get it to work. Micheas > -- > Matt Emmerton > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" -- Micheas Herman