Lan Barnes wrote:
> Some time ago I asked about how to send myself email when Cox changes my
> IP address. With help from the list, I came up with this, which works
> through testing (but hasn't yet been tested by Cox).
> 

[snip - script to connection to whatismyip.com & parse html response,
compare with old IP, etc]

What I do is to use traceroute  to get my home router to cough up it's
IP address (which is my external IP, of course), something like:

#!/bin/sh
# Old address saved in file
oldip=`cat ~/.ipaddress`
# Get your default routers inet address
export inetip=`/usr/sbin/traceroute -n -m1 smtp.west.cox.net |
/usr/bin/sed -e "/traceroute/d" | /usr/bin/awk '{print $2}'
if ! [ $oldip -eq $inetip ] ; then
  echo $inetip > ~/.ipaddress
  echo "New IP address : "$inetip
  echo "IP changed - "$inetip | mail -s "New IP" [EMAIL PROTECTED]
fi

As always, YMMV. The advantage is that it doesn't rely on an external
website or connectivity except to the router.

Dave Looney

-- 
I don't want to achieve immortality through my work; I want to achieve
immortality through not dying. - Woody Allen


-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to