Detecting change of IP address

Jeremy Prior jez at
Tue Nov 14 16:34:45 GMT 2000

On Tue, Nov 14, 2000 at 03:23:08PM -0000, Gary Brewer wrote:
# Hello,
# I need to create a small script which will tell me if my ip address has
# changed in the device tun0. Does anyone know how I could do this?

I can't think of an easy way to detect a change of address other
than polling the interface at regular intervals.

However, if what you are trying to do is determine when your dynamic
IP address has changed on your ppp connection, you can do it with
a ppp.linkup script.  I use this to write a shell script into
/usr/local/bin called myaddr that echoes my IP address.  (I also
use it to start a daemon that generates sufficient traffic to keep
my link up).

Mail me if you want the gory details...
Jeremy Prior  <jez at>
 Netcraft Ltd,  1 Somerset Street,  Bath,  BA1 1TS,  England.
  Tel: +44-1225-404405 (direct-dial)   Fax: +44-1225-404401

More information about the Ukfreebsd mailing list