Dynamic DNS
Why Dynamic DNS
Dynamic DNS is useful when ISP is providing public IP address with the address value allocated dynamically via DHCP. In such configuration, IP address may change when, for example, ISP router resets.
Thus, although devices at IP address dynamically allocated by ISP are accessible from the Internet, their address is not stable and may change at any time to some unpredictable values.
Dynamic DNS allows binding a stable DNS host name with a dynamic IP address. When dynamic IP address changes, Dynamic DNS service updates DNS record to the new IP address value.
“Dynamic DNS” abbreviations
Dynamic DNS term is often abbreviated as DDNS. In the current post this abbreviation is intentionally avoided as it is also used for Decentralised DNS that is a completely different technology. Another term that is often used in DynDNS. Unfortunately DynDNS is also a name of a particular Dynamic DNS service provider. Therefore the full Dynamic DNS name is used here instead of its ambiguous abbreviated variants.
How it works
Dynamic DNS service provides an API to update DNS record in real time as host IP address changes.
The client connected to dynamic IP address is responsible for updating its DNS records using Dynamic DNS service API.
The client can find its IP address from the network driver if it is connected directly to ISP, or by querying an external server if it is connected via router NAT (e.g. typing “what is my IP” in Google prompt).
Dynamic DNS client software
There are three main options of Dynamic DNS client software:
- Embedded router software
- Manually installed application or service on any modern OS
- Custom script
Embedded Router Software
The simplest approach is to use embedded router software. Dynamic DNS APIs are not standard and a typical router software has a limited number of the supported Dynamic DNS providers. Use router software approach if it supports required Dynamic DNS provider.
The following figure shows an example of the router Dynamic DNS software configuration page:
Manually Installed Application
Many Dynamic DNS service providers also provide a client application responsible for DNS records updates. Most such software are proprietary and closed-source.
Three popular open source packages of Dynamic DNS client software are:
ddclient
is included in Debian distributive and its derivatives such as
Raspberry Pi OS or Ubuntu.
ddclient installation and configuration
On Debian systems ddclient
can be installed with the following command:
# as of writing, current ddclient version is 3.9.1
sudo apt install ddclient
When running above apt command, the installer should present the following sequence of configuration screens:
The resulting configuration file is located at /etc/ddclient.conf
.
Dynamic DNS services supported by ddclient
The following services are supported directly via configuration dialogue:
Regarding Google Domains – as of writing this article, already registered domains are still working. However, on September 7, 2023, Squarespace acquired all domain registrations and related customer accounts from Google Domains. Customers and domains will be transitioned over the next few months. It is still uncertain if Squarespace is going to offer a Dynamic DNS service and keep prices reasonable.
There are many other services supported. See configuration documentation for further details.
Custom script
The last and the most flexible option is to implement a custom Dynamic DNS client script. The following repository is an example of a such script in Python for porkbun DNS service: porkbun-dynamic-dns-python