What Is Dynamic DNS?
DNS is the system used on the internet to name computers, with one of its major uses being to translate domain names, like reclaimhosting.com, to IP Addresses, like 188.8.131.52. This system makes it a lot easier to access services online like Google, Reddit, and Reclaim Hosting without needing to remember long strings of numbers. But for DNS to work, these IP addresses need to remain consistent; if the IP addresses of any of these services changed, they would be inaccessible until the DNS records were updated. However, that’s usually not a problem, as server providers like DigitalOcean, Google Cloud, and AWS give servers running on their platforms Static IP addresses which don’t change.
What if you wanted to run a server from home? Well, your ISP may offer Static IP addresses, but this may come with additional costs and may require you to dig around your router settings. No one wants to debug networking issues.xkcd.com
LOOK, THE LATENCY FALLS EVERY TIME YOU CLAP YOUR HANDS AND SAY YOU BELIEVE
More than likely, you have and will continue to have a Dynamic IP address. Dynamic IP addresses may not change all that often, but the important part is they could at any moment. If you’re running a home server and have your DNS all configured, and then your IP changes, you’re out of luck until you manually fix your DNS records.
But there is a solution: Dynamic DNS, or DDNS. DNS records that update themselves!
Configuring DDNS On cPanel’s Side
To create a DDN entry, hit Dynamic DNS under Domains in your cPanel account.
From here, click Create on the right side to create a DDNS entry.
This will take you to a dialog to create a subdomain as your Dynamic DNS Domain and enter in a Description of the entry. Once you’ve chosen your subdomain and given it a description hit Create at the bottom.
This will create the DDNS entry, and generate a URL that ends with a unique string. This URL should be treated like a password, as visiting the URL will update the DDNS entry with the IP address you are visiting from.
Automatically Updating Your DDNS Record
While the DDNS record should not change unless you visit your DDNS URL from another IP address, it may be a good idea to set something up to automatically visit your DDNS URL from your IP, so when/if your dynamic IP changes, your DDNS record automatically changes with it. While some routers have DDNS support, the way cPanel handles DDNS is often different from the way other providers handle it; this means the DDNS settings in your router may not be the way to go here.
I’ve found that setting up a cronjob to periodically visit the DDNS URL is a quick way to ensure the DDNS record is kept updated. Depending on what type of router you have and what firmware it’s running, you may be able to set this cronjob up right on your router, otherwise, having it run on a home server (that is running Linux, macOS, or some other UNIX-like OS) would be sufficient. You can get to the cronjob editor on such a home server by running:
This cron entry below would visit your DDNS URL every hour on the 0th minute; you can use the Crontab Guru to translate crontab schedules.
0 */1 * * * /usr/bin/curl $YOUR_DDNS_URL
@hourly /usr/bin/curl $YOUR_DDNS_URL