From owner-freebsd-questions@FreeBSD.ORG Wed Jun 6 14:10:36 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D55B3106564A for ; Wed, 6 Jun 2012 14:10:36 +0000 (UTC) (envelope-from bonomi@mail.r-bonomi.com) Received: from mail.r-bonomi.com (mx-out.r-bonomi.com [204.87.227.120]) by mx1.freebsd.org (Postfix) with ESMTP id 8F7B58FC18 for ; Wed, 6 Jun 2012 14:10:36 +0000 (UTC) Received: (from bonomi@localhost) by mail.r-bonomi.com (8.14.4/rdb1) id q56EB2sf030101 for freebsd-questions@freebsd.org; Wed, 6 Jun 2012 09:11:02 -0500 (CDT) Date: Wed, 6 Jun 2012 09:11:02 -0500 (CDT) From: Robert Bonomi Message-Id: <201206061411.q56EB2sf030101@mail.r-bonomi.com> To: freebsd-questions@freebsd.org In-Reply-To: <20120606134611.GA2185@tiny> Subject: Re: IP -> e-mail X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 14:10:36 -0000 Matthias Apitz opined: > El dia Wednesday, June 06, 2012 a las 09:17:47AM -0400, Robert Huff escribio: > > Matthias Apitz opined: > > > > > > lynx -dump myip.nl | fgrep 'WAN IP' > > > > > > strore the result in a file and when it changes, trigger a mail; > > > > Or, using only tools in the base system: > > > > ifconfig | head | grep "inet " | awk '{print $2}' > > This will not work if your host has some private addr which is NAT'ed by a > router; FALSE TO FACT. Given the OP's actual request. > the real test is ask some remote side "how I do apear to you?" > ofc you could do this as well by SSH'ing to some side and asking with > netstat(1) there (which may be shows another NAT'ed addr too :-)) Matthias, your lynx-based 'solution' does *NOT* solve the OP's question. He wants to know -when- his DHCP assigned address changes. Consider what happens if both the expired address and the new address are behind the _same_ NAT translation. The internal addrress changes, but the external one does not. To do what the OP _asked_, parsing the 'ifconfig' output *is* the correct approach. _IF_, on the other hand, he wants to know when the 'externally visible' address (a _very_ different question) for that host changes, then your approach is the correct one.