How to set up Dynamic DNS (DDNS) on your domain
Dynamic DNS allows you to update your domain's DNS records automatically every time your IP address changes. This is useful if you want to self-host your domain without having to purchase a static IP address or VPS. You can read more about how DDNS works here.
There are a lot of tools out there that will allow you to set up dynamic DNS. In this guide, we will be using a free client called ddns-updater. If you're using a different DDNS client instead, this guide will still contain useful information that will help you configure dynamic DNS correctly. Let's get started!
Enable API access for your domain
Warning
Never ever (ever ever ever ever) allow your API keys to be used or seen by anybody who isn't authorized to make changes to your domain. Ever. Ever ever.
Configure DDNS client
The following steps assume you are using ddns-updater. If you are using a different client, follow that client's specific instructions for installation and setup.
Note
You can also create the "data" folder and the "config.json" file manually if the DDNS client doesn't do it for you.
Configure the "config.json" file according to your domain and API keys. You can update just your "root" domain, or if you want to dynamically update the root domain and your "www" subdomain, that can be done too. Here's an example configuration:
{ "settings": [ { "provider": "porkbun", "domain": "yourdomain.example", "api_key": "pk1_7d114e3f656b00ae082980302e1415a09163c476efec1q3cb0w54fc6f5022", "secret_api_key": "sk1_5299b57125c8f3cdf347d2fe0e743301ee3a1e11a14942b26472593k35368" }, { "provider": "porkbun", "domain": "www.yourdomain.example", "api_key": "pk1_7d114e3f656b00ae082980302e1415a09163c476efec1q3cb0w54fc6f5022", "secret_api_key": "sk1_5299b57125c8f3cdf347d2fe0e743301ee3a1e11a14942b26472593k35368" } ] }
Note
Make sure you are using the correct API key and secret key that you generated for your account/domain when enabling API access. Also, JSON is a bit finicky about formatting, so if you run into any errors with the DDNS client, the first thing to check is the formatting of your config.json file.
That's it! Now whenever you leave the DDNS client open, it will monitor for changes to your public IP address, and every time your IP address changes the program will update your domain's DNS records accordingly. Shine on, you crazy self-hoster!