Dynamic DNS

Dynamic DNS service is provided by dyndns.com (no-ip.org is good as well). ddclient script is called at system startup. This periodically checks what IP address has been assigned to the PPP interface and contacts the Dynamic DNS server to update the DNS entry. Thus the router is always reachable using a domain name even though the WAN IP address may change whenever the PPP session is restarted.

root@voyage:/etc/init.d# ls
README killprocs php-fastcgi ssh
bootlogs klogd pppd-dns sudo
bootmisc.sh kmod procps sysklogd
checkfs.sh live radvd udev
checkroot.sh live-config rc udev-mtab
cron mountall-bootclean.sh rc.local umountfs
ddclient mountall.sh rcS umountnfs.sh
dibbler-client mountdevsubfs.sh reboot umountroot
dnsmasq mountkernfs.sh resolvconf urandom
ebtables mountnfs-bootclean.sh rmnologin voyage-pxe
halt mountnfs.sh rpcbind voyage-sync
hostapd mountoverflowtmp rsync voyage-util
hostname.sh mtab.sh sendsigs watchdog
hwclock.sh networking single wd_keepalive
ifplugd nocatsplash skeleton wide-dhcpv6-client

ddclient gets settings from /etc/ddclient.conf

root@voyage:~# cat /etc/ddclient.conf

daemon=600
# check every 600 seconds

# log update msgs to syslog
syslog=yes

# Mail failed updates to user
mail-failure=xxxxx@xxxxxx.com

# record PID in file.
pid=/var/run/ddclient.pid

## Detect IP with our CheckIP server
use=web, web=checkip.dyndns.com/, web-skip='IP Address'

## DynDNS username and password here
login=xxxxxx
password=xxxxxx

## Default options
protocol=dyndns2
server=members.dyndns.org

## Dynamic DNS hosts
xxxxxxxx.dyndns-remote.com

To debug dynamic DNS, run ddclient in debug mode

root@voyage:~# ddclient -daemon=0 -noquiet -debug
DEBUG: proxy =
DEBUG: url = checkip.dyndns.com
DEBUG: server = checkip.dyndns.com
DEBUG: get_ip: using web, checkip.dyndns.com reports xx.xx.xx.xx
WARNING: cannot update xxxxxx.dyndns-remote.com from xx.xx.xx.xx to xx.xx.xx.xx until after Thu Jan 1 00:00:30 1970.
DEBUG: proxy =
DEBUG: url = myip.dnsomatic.com
DEBUG: server = myip.dnsomatic.com
DEBUG: get_ip: using web, myip.dnsomatic.com reports xx.xx.xx.xx
WARNING: cannot update opendns_network_label from xx.xx.xx.xx to xx.xx.xx.xx until after Thu Jan 1 00:00:30 1970.

It’s not working in this case, and the error is related to the system date. What date does it think it is?

root@voyage:~# date
Sat Dec 12 19:05:29 GMT 1914

Not sure what’s gone wrong there, but might as well install NTP to keep the system time up to date.

root@voyage:~# apt-get install ntp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libcap2 libopts25
Suggested packages:
ntp-doc
The following NEW packages will be installed:
libcap2 libopts25 ntp
0 upgraded, 3 newly installed, 0 to remove and 112 not upgraded.
Need to get 628 kB of archives.
After this operation, 1448 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://cdn.debian.net/debian/ wheezy/main libcap2 i386 1:2.22-1.2 [14.0 kB]
Get:2 http://cdn.debian.net/debian/ wheezy/main libopts25 i386 1:5.12-0.1 [72.2 kB]
Get:3 http://cdn.debian.net/debian/ wheezy/main ntp i386 1:4.2.6.p5+dfsg-2 [542 kB]
Fetched 628 kB in 5s (122 kB/s)
Selecting previously unselected package libcap2:i386.
(Reading database ... 18045 files and directories currently installed.)
Unpacking libcap2:i386 (from .../libcap2_1%3a2.22-1.2_i386.deb) ...
Selecting previously unselected package libopts25.
Unpacking libopts25 (from .../libopts25_1%3a5.12-0.1_i386.deb) ...
Selecting previously unselected package ntp.
Unpacking ntp (from .../ntp_1%3a4.2.6.p5+dfsg-2_i386.deb) ...
Setting up libcap2:i386 (1:2.22-1.2) ...
Setting up libopts25 (1:5.12-0.1) ...
Setting up ntp (1:4.2.6.p5+dfsg-2) ...
[ ok ] Starting NTP server: ntpd.

Check NTP. These timeservers are installed by default.

root@voyage:~# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
-ns1.ooonet.ru 89.109.251.23 2 u 9 64 1 132.414 1.078 0.737
+service0-eth4.d 195.111.98.17 2 u 7 64 1 79.145 -5.807 0.906
+ntp.goneco.de 129.69.1.153 2 u 5 64 1 66.232 -4.427 1.494
*hosted.by.pcext 193.190.230.66 2 u 3 64 1 46.044 -5.622 0.631

Check the date again

root@voyage:~# date
Wed Jul 17 22:06:58 GMT 2013

Restart ddclient in debug mode again

root@voyage:~# ddclient -daemon=0 -noquiet -debug
DEBUG: proxy =
DEBUG: url = checkip.dyndns.com
DEBUG: server = checkip.dyndns.com
DEBUG: get_ip: using web, checkip.dyndns.com reports xx.xx.xx.xx
DEBUG: proxy =
DEBUG: url = myip.dnsomatic.com
DEBUG: server = myip.dnsomatic.com
DEBUG: get_ip: using web, myip.dnsomatic.com reports xx.xx.xx.xx
DEBUG:
DEBUG: nic_dyndns2_update -------------------
DEBUG: proxy =
DEBUG: url = http://members.dyndns.org/nic/update?system=dyndns&hostname=xxxxxx.dyndns-remote.com&myip=86.40.184.26
DEBUG: server = members.dyndns.org
SUCCESS: updating xxxxxx.dyndns-remote.com: good: IP address set to xx.xx.xx.xx
Advertisements