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

1
The first thing you'll need to do is generate API keys and enable API access for your domain. Check out our guide on enabling API access for detailed instructions on how that's done.
2
After creating the API key and secret key per the guide linked above, take note of them (make sure to store them somewhere secure). You will use these API keys in your DDNS client's configuration.

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.

3
Make sure you have enabled API access for the specific domain(s) you're wanting to set up with DDNS. Again, the guide linked in step 1 will show you how.

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.

1
Install the ddns-updater client. Make sure you're installing the correct version based on your computer's operating system. You can also find some more installation instructions in the "Setup" section of the README for ddns-updater. If you run into any problems getting the client working, read those instructions thoroughly to see if it's related to your OS and/or file-writing permissions.
2
After installing the ddns-updater client, move the downloaded file into its own directory on your computer. This isn't required, but it's a good idea to have everything managed in one easily accessible place.
3
Run the executable file you downloaded. When the client opens, you'll see a summary of default settings, and some messages indicating that the program created a new "data" folder with a "config.json" file in it.

Note

You can also create the "data" folder and the "config.json" file manually if the DDNS client doesn't do it for you.

4
Close out of the DDNS client for now. Navigate to the "data" folder that was created, and open up the "config.json" file. JSON files can be opened and edited with any text/code editor. You should see a file that's empty other than opening and closing brackets.

5
Here we can configure the DDNS client for your specific domain and API key on Porkbun. There are a few required parameters, as well as some additional optional settings. The ddns-updater client has specific configuration instructions for Porkbun, so check that out too.

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.

6
After configuring the file with your specific domain/keys, save the config.json file and close out of it. Open the DDNS client again. You should see some messages indicating your domain's DNS records have been updated to reflect your IP address.

7
You've successfully set up DDNS! You can confirm the changes were made to your domain's DNS records by reviewing the DNS records menu on Porkbun. The "Answer" value should match your IP address, meaning you are now self-hosting your domain's DNS records.

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!

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.