IP -> e-mail

Matthias Apitz guru at unixarea.de
Wed Jun 6 13:46:24 UTC 2012

El día Wednesday, June 06, 2012 a las 09:17:47AM -0400, Robert Huff escribió:

> >  Run this in a cronjob:
> >  
> >  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; 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 :-))

Trust me, the above lynx is the nearly only robust version.

Matthias Apitz
e <guru at unixarea.de> - w http://www.unixarea.de/
UNIX since V7 on PDP-11, UNIX on mainframe since ESER 1055 (IBM /370)
UNIX on x86 since SVR4.2 UnixWare 2.1.2, FreeBSD since 2.2.5

More information about the freebsd-questions mailing list