2020-08-17
md
DNS and Static IP address
<-Domoticz Backup Scripts

This morning, I started the backup server to copy the Domoticz database which is the home automation software running on a Raspberry Pi. Since the backup script is not yet completed, I left the server powered off until an email warned me that it had been 15 days since a backup was made. As expected, the database was copied ot the backup server. On the other hand, the archive created on August 17 had August 15 as the creation date. Moreover, August 15 was the current date according to the system. Suddenly, I was asking myself a few questions.

  1. Could the hardware clock be so imprecise that it could loses 48 hours in 15 days?
  2. Was it more likely that the battery in the clock module could already be dead after only two or three months?
  3. How was it that systemd-timesyncd had not synchronized system clock and date?

Leaving the first two questions aside, I looked at the timing synchronization issue. The systemd-timesyncd service was starting to synchronize the time with an NTP server, but it could not get the date. It took a little too long before I realized that the system could no longer resolve domain names. It was then that I remembered an important change made recently. I had replaced my ISP's domain name servers with quad9 servers.

By placing the IP addresses of the quad9 servers in the resolv.conf configuration file, the system was able to resolve domain names again. Here is the original configuration file

becky@backserver:~ $ cat /etc/resolv.conf~ domain something.home search something.home nameserver 192.168.1.1

And I edited it to become.

becky@backserver:~ $ sudo nano -B etc/resolv.conf

nameserver 9.9.9.9 nameserver 149.112.112.112 nameserver 2620:fe::fe nameserver 2620:fe::9

Surprisingly, the Raspberry Pi which is the host of the home automation system and which also has a static IP address had no problems when the change in DNS servers was made. Here is the configuration file on the Pi.

woopi@goldserver:~ $ cat /etc/resolv.conf # Generated by resolvconf nameserver 192.168.1.1 nameserver db08:cfab:192::4

So the Pi sends DNS requests to the router which is configured to forward domain names to the quad9 servers. I tried using this configuration file with the backup server but that did not work. If this substitution had succeeded, I would have been surprised since the original configuration file of on the backup server and the one on the Raspberry Pi both specify nameserver 192.168.1.1.

The lesson is clear, if you change domain name servers then you have to be careful with local network systems with static IP addresses, since they do not get the DNS server address from the local network DHCP server.

<-Domoticz Backup Scripts