Dynamischen DNS-Eintrag mit ddclient aktualisieren
Installation
yum install ddclient yum install perl-IO-Socket-SSL
Konfiguration
Die Konfigurationsdatei /etc/ddclient/ddclient.conf erstellen.
vim /etc/ddclient/ddclient.conf
daemon=600 pid=/var/run/ddclient.pid syslog=yes use=web, web=checkip.dyndns.com/, web-skip='IP Address' login=Benutzername password=Passwort protocol=dyndns2 server=members.dyndns.org Hostname.dyndns.org ssl=yes
Sicher machen
chown root:root /etc/ddclient/ddclient.conf chmod 0600 /etc/ddclient/ddclient.conf
Init-Script erstellen:
#!/bin/sh
# chkconfig: - 65 35
# description: ddclient provides support for updating dynamic DNS services.
# Check that config file exist
[ -f /etc/ddclient/ddclient.conf ] || exit 0
# Source function library
. /etc/rc.d/init.d/functions
# Source networking configuration
. /etc/sysconfig/network
# Check that networking is up
[ "$NETWORKING" = "no" ] && exit 0
exec=/usr/sbin/ddclient
lockfile=/var/lock/subsys/ddclient
cache=/var/cache/ddclient/ddclient.cache
pid=/var/run/ddclient.pid
start() {
echo -n "Starting ddclient: "
[ -f $cache ] || touch $cache
chown ddclient:ddclient $cache && chmod 0600 $cache || exit $?
[ -f $pid ] || touch $pid
chown ddclient:ddclient $pid && chmod 0600 $pid || exit $?
daemon --user=ddclient --pidfile=$pid $exec
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n "Stopping ddclient: "
killproc $exec
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status ddclient
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
;;
esac
exit 0
In den Autostart aufnehmen:
chmod 0755 /etc/rc.d/init.d/ddclient chkconfig --add ddclient chkconfig --level 35 ddclient on
