Post

🔨Configuring Synology NAS to use its own domain name. Part 3

In my previous two posts “Configuring Synology NAS to use own domain name. Part 1” and “Configuring Synology NAS to use its own domain name. Part 2” I described configuring DSM to update Dynamic DNS in the Google Domains. Literally, until today, namely, before I updated DSM to version 7, everything worked fine. But after the update to version 7 DDNS Updater 2 stopped working due to incompatibility with the latest version. Unfortunately, I wasn’t able to get the source code of DDNS Updater 2 to have a chance to modify it and had to come up with a solution of how to live without that awesome package.

For some reason, Synology still has a weird implementation of DDNS in the settings, i.e. there is no way to provide a wildcard in the domain name, due to validation error, a custom provider didn’t work for me too as well as it complains to add more than two same providers.

Without hesitation, I decided to go in a different way. Since Google Domains provide an API I’ve created a bash script to update the IPs and configured a scheduler to run the job each hour.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env bash

WILDCARD_DOMAIN=*.fisenko.net
WILDCARD_USERNAME=FROM_GOOGLE_DOMAINS
WILDCARD_PASSWORD=FROM_GOOGLE_DOMAINS

ROOT_DOMAIN=fisenko.net
ROOT_USERNAME=FROM_GOOGLE_DOMAINS
ROOT_PASSWORD=FROM_GOOGLE_DOMAINS

CURRENT_IP=$(curl -s ipecho.net/plain | cut -d '%' -f1)

function update() {
  echo "https://${1}:${2}@domains.google.com/nic/update?hostname=${3}&myip=${CURRENT_IP}"
  curl --location --request GET "https://${1}:${2}@domains.google.com/nic/update?hostname=${3}&myip=${CURRENT_IP}"
}

update ${WILDCARD_USERNAME} ${WILDCARD_PASSWORD} ${WILDCARD_DOMAIN}
update ${ROOT_USERNAME} ${ROOT_PASSWORD} ${ROOT_DOMAIN}

Below an example of my scheduler for that.

Configuration

I know this is not the perfect solution since I have to modify the script manually each time I need to make a modification, but such changes are very rare it should be fine, at least for now until I have a better solution.

Hopefully, you will find it helpful 🙏🏻

This post is licensed under CC BY 4.0 by the author.