There
are "external" means of determining your IP address such as
http://www.whatismyipaddress.com/
and there's also http://www.dyndns.com/
for resetting your IP address.
However, I wanted something
totally "internal" to my system that would:
Not cost extra (i.e continue with a dynamic address);
Not run an unknown program on my computer (I couldn't decode the offered programs to confirm there was no risk to my system);
Promptly detect when my IP address had been changed;
Promptly update the links for the outside world to reach my server; and
Send me an email informing me of the change.
Since
my server was running on Linux, this was satisfied by my writing a
Linux "bash" script,
and placing HTML files within my ISP-provided web-space with pointers
containing my current IP address. I have added another more recent
script for the Wireless
router/modem.
Invoked by a "cron" entry, it: Queries
my router (whichever one I'm using) every minute to see if the
address has changed. Some days, there have been several changes of IP
address. If it has changed,
the script updates the example "template file" on my computer (replacing nonsense string "boobooboo" with my current IP address);
ftp's the updated file to my NCF web-space;
Constructs a report, and emails it to me.
This
email is "optional" (not essential to the operation), but
is merely informative. I can look at the script's log file for a
record of every disconnect, and how long before service became
available again. And remotely, I can browse to one of my domain
pages, clicking on the updated link to find my server's current IP
address (assuming ncf.ca is up!). The script was revised in early
2009 to confirm once per day that the last FTP of addresses had
occurred: FTP has failed silently, leaving a stale address in the NCF
links. Embarrassing!
This method exploits the NCF web-space
allocation as a "stepping stone" and also works if you have
a Domain Name but want to provide content from your web-server. Here
is an example using the above template
file.
I am not a guru, and the above took a lot of
hacking. The hardest part was configuring sendmail, and you are on
your own there! The script does not have to be on your server
computer, but on a Linux box that can access your router in order to
interrogate it to verify that your IP address has not changed.
To see your CRONTAB ...
[whacker@fireball ~]$ crontab -l
# From scratch 10 Feb 2009
# Check to see if router IP address has changed
#
* * * * * /home/whacker/IP-Update/ST-585-restore.sh %
[whacker@fireball
~]$
Last tweaked Fri Jul 10 09:18:47 EDT 2009