Dette er lavet til OpenWrt (linux til routere / emedded devices, for info se
http://www.macsat.com), men burde køre under alle linux, hvor det eksterne netværksinterface får brugerens "Internet IP".
#!/bin/sh
#
#
# Configuration Start
# Files containing the old IP and the changelog
OLDIP=/etc/gratisdns_ipaddr
CHANGELOG=/tmp/gratisdns_changes
# Username, password and domainname/hostname on gratisdns.dk
USERNAME=<bruger>
PASSWORD=<kode>
DOMAIN=<domain>
HOST=<host.domain.dk>
# End of Configuration
currentip=`ifconfig vlan1 | awk '/inet/{print $2}' |cut -d: -f2`
if [ ! -f "${OLDIP}" ]
then
echo "127.0.0.1" > ${OLDIP}
fi
previousip=`cat ${OLDIP}`
timestamp=`date`
if [ "${currentip}" = "${previousip}" ]
then
exit 0;
fi
echo "${currentip}" > ${OLDIP}
echo "${timestamp} | ${currentip}" >> ${CHANGELOG}
UPDATESTM="https://ssl.gratisdns.dk/ddns.phtml?u=${USERNAME}&p=${PASSWORD}&d=${DOMAIN}&h=${HOST}&i=${currentip}"
curl -k "${UPDATESTM}"