A simple PERL script that can be run through cron to detect, adjust for, and notify by email changes in IP environment on a machine.
This script has been written to help keep an unattended OpenBSD box working as a firewall on a cable modem. The box gets its IP through DHCP, and as such this can change. When the IP changes, there have been problems with NAT and IPF -- so these are restarted/reconfigured. Since the DNS records must also be updated, when the IP changes this information is mailed to a given admin address, so the machine is never "lost".
Whenever something else comes up that mucks up the machine, I add it to this script. So far so good, five months and counting.
Get the script here or view it here. Requires PERL.
|