[oclug] How to verify my IP address remotely

David G. quarrington.robinson at sympatico.ca
Fri Jul 11 13:10:53 EDT 2003


Jon Earle wrote:
> 
> I did that for my home box.  I whacked together a script that ran after
> ppp completed its connection.  It ran 'ifconfig ppp0', grepped for the IP
> and mailed that to another account (you could use anything that has a
> stable (IP-wise) webmail address (hotmail for example).
> 
> Something like this works fine:
> 
> /sbin/ifconfig eth0 |
>         grep "inet addr" |
>         cut -d : -f 2 |
>         awk '{print $1}' |
>         mail -s "My IP" <email address to send to>
> 
> There's probably a better way to do it (fewer commands) but this works in
> a pinch.
> 
> Cheers!
> Jon
>
--- snipped ---

Jon:

With a hardware router the outcome is:

[whacker at flamen whacker]$ /sbin/ifconfig eth0 | grep "inet addr"
          inet addr:192.168.xxx.yyy  Bcast:192.168.xxx.255 

The address the world currently sees is 64.230.107.219 and that's what
I'm after.

However, I appreciate your hints with the other commands on how to
process glorp I capture, to extract the "gold". I think your script is a
thing of beauty! I never did any real shell programming, and it seems I
know even less every day!

Have a week goodend;
DaveR



More information about the OCLUG mailing list