Dynamic DNS – 2021 Edition

When computers connect to each other over the Internet or on your home network they usually use something called an IP address to know how to reach the destination computer. Unless you have a “business class” Internet package, you are likely given a single, Internet-accessible IP address for your home network. Your network equipment then usually provides computers on your home network with IP addresses from a “private” pool. Those IP addresses are only used on your home network and cannot be accessed from the Internet.

DNS or domain name service is a way to translate a human-readable address such as karylstein.com and turn it into an IP address that a computer understands such as 92.51.130.56. The problem with most companies that provide home Internet is that your Internet-accessible IP address can and will change over time. That means if you want to be able to access your home network over the Internet using an easy-to-remember name, you need to make sure that the DNS server will provide the correct IP address even when it changes. That is where dynamic DNS comes into play. The main goals of the dynamic DNS service on the Stein Home Network are:

  • Automatically update DNS servers on the Internet when the Internet-accessible IP address for the home network changes
  • Be able to update multiple translations such as thesteins.org, karylstein.com, www.thesteins.org, etc.

The following technologies and services are used to implement this solution:

  • unRAID server for hosting the dynamic DNS client in a Docker container
  • ddclient as the dynamic DNS client
  • Namecheap as the main DNS server

There is not much to this implementation. In previous incarnations the dynamic DNS client was on two different servers so that if one server was unavailable the other server would still provide dynamic DNS services. However, while the Internet-accessible IP address may change at the will of my Internet provider, it usually remains the same unless the main connection to the provider is restarted due to something like a power outage, or a reboot of the cable modem or router. Therefore it is not too important to have redundant dynamic DNS clients.

Many consumer routers will have a dynamic DNS client built into them. However the functionality of those clients can vary. In my case my router, while having a dynamic DNS client, is only able to update one human-readable address. Since I want to be able to maintain multiple addresses, an alternative solution needed to be found.

The ddclient software is a common dynamic DNS client and supports many DNS providers including the one that I use. All that is needed is to install the ddclient Docker on an unRAID server, modify a configuration file following the instructions provided by the DNS provider, and let it run. To test that it is working I logged into my account for my DNS provider and manually changed the IP addresses for my home network. When I tried to connect to my home network over the Internet it did not work at first because it was trying to reach the incorrect IP address. However, after five minutes, (which is the default interval for ddclient to check for changes), connections worked again as the IP address was automatically updated to the correct value.

One thing to keep in mind is that DNS servers assign a “time to live” (TTL) when returning an IP address in response to a translation request. When a computer first needs to determine an IP address from a human-readable name, it will send a query to the DNS server. The computer then stores the response from the DNS server for the entire TTL interval. That means if you are say browsing various web pages on my home network, your computer does not need to reach out to the DNS server each time it needs to access something. When the TTL expires then the computer will query the DNS server again. Therefore when setting up a dynamic DNS client it is desirable to set the TTL interval on the DNS provider to the same or less as the update interval of the dynamic DNS client. For example if the TTL is one hour but the dynamic DNS client update interval is five minutes, and your public IP address changes, computers trying to reach your home network may not be able to for an hour because they are still using the old IP address even though your dynamic DNS client updated the IP address within five minutes of it changing.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top