The IP on Carnivore doesn’t change much but when it does, it’s almost always at inconvenient times.
I knew ZoneEdit could do DynDNS but I’d never set it up. I did some searching a found a script here.
I changes a bit of it to make it work a little better for me. (Instead of going to a website to find out what my IP is, I just grab it off of the interface, I have it send me an email with the new IP, and have it run my iptables script if there is a new update)
Just dump this somewhere, create a domains.list file, and tell cron to run it every so often. I have mine set to run every 4 hours. The TTL on my zones are 1 hour. This seems reasonable enough.
#ZoneEdit DNS Updater#Zone Edit config
ZEuser=”USERNAME”
ZEpasswd=”PASSWORD”#Log file
dns_tmp=/tmp/dns_temp.log
dns_log=/var/log/dnsupdate.log#If the lastIP record doesn’t exist, make a fake one.
if [ ! -f lastIP.txt ]; then
touch lastIP.txt
fi#Get IP for error checking
myIP=`/sbin/ifconfig eth0|/bin/grep addr:|/bin/sed ‘s/.*addr:\([^ ]*\) .*/\1/’`
OldIP=`cat lastIP.txt`if [ "$myIP" != "$OldIP" ]; then
#run firewall script
/path/to/FW-SCRIPT
#send email
echo “Carnivore IP Changed to $myIP” | /usr/bin/formail -I “Subject: New IP for SERVERNAME” | /usr/sbin/sendmail EMAIL-ADDRESS
#begin update
echo “========================================”
echo Time: `date ‘+%T – %d %B %Y’` >> $dns_log
echo “NEW = $myIP OLD = $OldIP” >> $dns_log# domains.list is a file that has each of the hostnames you want to update, 1 on a line
if [ -f domains.list ]; then
#Update each domain in domains.list
for domain in `cat domains.list`; do
echo “Updating: $domain” >> $dns_log
wget -O $dns_tmp –http-user=$ZEuser \
–http-passwd=$ZEpasswd –no-check-certificate \
“https://dynamic.zoneedit.com/auth/dynamic.html?host=$domain”
cat $dns_tmp >> $dns_log
rm -f $dns_tmp
done
else
echo “Domain list file does not exist.”
fi#rm -f index.html
echo $myIP > lastIP.txtelse
echo “No Update Necessary”fi
exit 0