Overview
Lately I have been using Porkbun for hosting some of my domains. Porkbun is a great registrar, but they do not have as much support from the market on dynamic DNS (DDNS) updating. Here is how I was able to get DDNS working for IPv4 and IPv6 on my Porkbun domains.
Note: Many DDNS applications have a Docker version. If you are wanting to update IPv6, I do not recommend you use the Docker version as the docker container will likely not be able to see the host’s IPv6 address.
Process
1. Install DDNS-Updater
DDNS Updater is a lightweight DDNS client recommended by porkbun. To get started, we will want to download the application onto the server.
sudo mkdir /opt/ddns-updater
sudo chown $USER /opt/ddns-updater
mkdir /opt/ddns-updater/data
touch /opt/ddns-updater/data/config.json
cd /opt/ddns-updater
# Replace URL with the correct URL for your system
# wget "https://github.com/qdm12/ddns-updater/releases/download/v2.9.0/ddns-updater_2.9.0_linux_amd64"
2. Configure DDNS-Client
Update the file data/config.json to change how DDNS-Client will work. Below is an example of a very basic config which will update a Porkbun domain, attempting both IPv6 and IPv4.
Note: If you are using split DNS, DDNS-Client may incorrectly see your domain as being incorrect and trying to update it. In this case, you will want to set the RESOLVER_ADDRESS environment variable when running DDNS-Client. Step 4 of this guide will set this as a part of the systemd unit.
{
"settings": [
{
"provider": "porkbun",
"domain": "subdomain.example.com",
"api_key": "pk1_12345678901234567890",
"secret_api_key": "sk1_12345678901234567890"
}
]
}
3. Test DDNS-Client
If everything is correct, you should now be able to launch DDNS-Client and see it successfully update your subdomain!
ddns-updater_2.9.0_linux_amd64: INFO reading JSON config from file data/config.json
ddns-updater_2.9.0_linux_amd64: INFO Found single setting to update record
ddns-updater_2.9.0_linux_amd64: INFO Reading history from database: domain <DOMAIN> owner <SUB> ...>
ddns-updater_2.9.0_linux_amd64: INFO [http server] http server listening on [::]:8000
ddns-updater_2.9.0_linux_amd64: INFO [backup] disabled
ddns-updater_2.9.0_linux_amd64: INFO IP address of <FULL_DOMAIN> is ... and your IP address is ...>
ddns-updater_2.9.0_linux_amd64: INFO Updating record [domain: <DOMAIN> | owner: <SUB>> | provider:>
ddns-updater_2.9.0_linux_amd64: "GET http://<LOCAL_IP>:8000/ HTTP/1.1" from <LOCAL_IP>:46368 - 200 2585B in 48.354µs
[Optional] 4. Autorun DDNS-Client
If everything is set up properly and working, you may want to create a systemd unit to have DDNS-Client automatically run at startup.
Here is what my unit looked like. You may need to change yours slightly if you downloaded a different version of DDNS-Client, or used different paths.
[Unit]
Description=DDNS Client
Wants=network.target
After=network.target
[Service]
User=<USER>
Group=<GROUP>
Type=simple
Environment="RESOLVER_ADDRESS=1.1.1.1:53"
ExecStart=/opt/ddns-updater/ddns-updater_2.9.0_linux_amd64
WorkingDirectory=/opt/ddns-updater
[Install]
WantedBy=network-online.target