Date: Wed, 6 Jun 2012 09:11:02 -0500 (CDT) From: Robert Bonomi <bonomi@mail.r-bonomi.com> To: freebsd-questions@freebsd.org Subject: Re: IP -> e-mail Message-ID: <201206061411.q56EB2sf030101@mail.r-bonomi.com> In-Reply-To: <20120606134611.GA2185@tiny>
next in thread | previous in thread | raw e-mail | index | archive | help
Matthias Apitz <guru@unixarea.de> opined: > El dia Wednesday, June 06, 2012 a las 09:17:47AM -0400, Robert Huff escribio: > > Matthias Apitz <guru@unixarea.de> 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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206061411.q56EB2sf030101>