1. Current Location: Home >  NAS >  On NAS, Docker runs ddns-go, dynamic domain names update automatically, and even if you change IPv6 prefixes, it still keeps up

On NAS, Docker runs ddns-go, dynamic domain names update automatically, and even if you change IPv6 prefixes, it still keeps up

ddns-go dynamic domain name configuration tutorial: On the NAS, a Docker container chases the home IP, and even if the IPv6 prefix is changed, it can still be resolved

Going out to connect to the home NAS, the client ran around for a long time, then logged into the router and checked, the public IP had changed again. The domain name resolution still contained the old address from three days ago. My family had already gone through this last year, relying on the router's built-in DDNS to get by. The details were written in the article on router DDNS. But this year, I switched my domain to one I bought from Alibaba Cloud, and my little bit of router resources weren't enough. In the end, a Docker container on my NAS covered it all, called ddns-go.

The router's built-in DDNS is blocking my three major hurdles

In my AX3000T 31.1 backend, under Advanced Settings, there is indeed a DDNS page, and there are four service providers to choose from: Huataoke, Gongyun 3322, DynDNS, and No-IP. The first hurdle is this—my domain was registered on Alibaba Cloud, and I wanted to resolve it to my home IP, but none of these four companies recognized it. The router's built-in DDNS basically goes through the same route as "giving you a second-level domain," like xxx.oray.com where your own domain cannot be inserted.

The second hurdle is the No-IP rule. The free version requires manual login and confirmation every 30 days; if you miss a domain name once, it will be deleted. I once returned from a business trip lasting forty days, but the analysis was long gone, so I had to reconfigure it again. The third hurdle was at my cousin's family, Synfa. The Synology control panel comes with built-in DDNS and is fine with IPv4, but the list of domain name providers doesn't have full AAAA support records. Their IPv6 direct connection solution is stuck here—I mentioned this pitfall in the article about IPv6 direct connection, which was filled in by ddns-go at the time. This time, I'll explain it thoroughly.

Let's put it a bit aside: If your home doesn't have public IPv4 or IPv6 broadband, don't look further yet. DDNS isn't feasible. Go for relay or intranet traversal, < a href="https://www.shunot.com/en/nas/1281.html">FRP and FN The Connect article is about this. How to tell if you have a public IP address? I saw in the WAN post that anything starting with 100.64 doesn't have one.

What is ddns-go: a single 11MB file, managing about twenty service providers

ddns-go is an open-source dynamic domain name tool, maintained by jeessy2 on GitHub and written by Go. I downloaded a Linux-amd64 package from Release. After compression, it was 4.7MB, and after extraction, it was just an 11.4MB single file with no dependencies. The web configuration interface was all packaged in this folder. When running, it monitors port 9876 by default, and when the browser opens, it opens to a configuration page.

It is stronger than the router's built-in in two aspects. First, the list of service providers is long: Alibaba Cloud, Tencent Cloud, DNSPod, Cloudflare, Huawei Cloud, Baidu Cloud, GoDaddy, Namecheap—about twenty companies in total. My Alibaba Cloud domain matched the number directly. Second, there are three ways to obtain an IP: via API lookup (visiting public websites asking "What is your own IP?"), local network card reading (reading the NAS's own network card address, which IPv6 relies on), or using custom commands. IPv4 and IPv6 configurations are completely independent; you can enable only one or both.

Here's a small detail from my actual test. It has more than one built-in IPv4 detection interface. In my network environment, myip.ipip.net reply instantly and even casually provide the location; api.ipify.org just waited for nothing to happen. Multiple ports are tested in rotation, and which one is universal, which is more stable than many single-port scripts.

Install into the NAS:host network—don't choose the wrong step at this step

Install on Feiniu, open Docker, enter jeessy/ddns-go as the image name, pull it and create the container—just three places to watch.

? . The , .
How to fill in configuration items, why
Network mode host (using host network) In bridge mode, containers cannot see the IPv6 address on the NAS network card; v6 parsing directly causes confusion
host is mounted to the /root directoryand the configuration file is a hidden file under /root.ddns_go_ config.yaml, if you don't display it, the container will be deleted and all configurations will be lost
Restart policy: alwaysNAS restarts after the container reboots on its own; otherwise, the domain name will be interrupted when updated

The network model is the easiest part of the entire process to remove. By default, Docker assigns the container a bridge network, which is like letting the container live in a mid-building. It can only see the virtual network card of its own room—IPv4 is decent enough to check public IPs via interfaces, but IPv6 uses the network card to read addresses under the bridge. Why is there such a big difference between host and bridge? I explained in the article Docker two network modes. Synology users are the same. When creating containers in Container Manager, check "Use the same network as Docker Host," and the principle is the same. Additionally, the desktop versions of Windows and Mac Docker do not support host mode, so if you want to play v6, don't install it on either type of machine.

One command from the Party is enough:

docker run -d --name ddns-go --restart=always --net=host -v /opt/ddns-go:/root jeessy/ddns-go

Three things on the configuration page: key, domain name, and acquisition method

Open the http://NAS IP:9876 in your browser. The first time you enter, you need to set a username and password. Don't be quick to do this—set it up and then forget. When rebuilding the container, you can't get into the configuration page, so you have to type a command to reset. The reset method is ready-made: docker exec ddns-go ./ddns-go -resetPassword. After typing the new password, try restarting the container, but it's best not to go that far.

Go to the configuration page and first select a service provider. Take Alibaba Cloud as an example: what you need is a pair of AccessKey IDs and AccessKey Secrets. Don't just fill in the main account's AK — create a sub-account in Alibaba Cloud's RAM access control, only authorize cloud DNS resolution, then enter the sub-account's AK. If these keys are ever missed, others might at most alter two DNS records and won't be able to touch other things in your account. Tencent Cloud's keys are on the API key management page in the access management section, with SecretId and SecretKey paired, and the method is the same.

For the domain name, just enter home. Your domain .com is a level 3 domain. Write multiple domains and write multiple lines, and they will resolve them together. For acquisition methods, the IPv4 option is the most hassle-free; IPv6 selects the network card to obtain it, which reads the global address on the NAS's own network card. Here's an advanced trick: Below the IPv6 method is a regular expression box, where a segment of regular expression only matches addresses with specific extensions. Coordinate with the system side to fix the address suffix. How to change the prefix? What you parse is always the machine, just like IPv6 direct connection where netsh suffix is pinned in the same idea: one at the system layer, one at the application layer. If you don't want to run the system, just rely on ddns-go to default to a five-minute detection frequency. Changing the prefix only takes a few more minutes.

Three scams and

a free alert

The first pitfall is the password mentioned earlier. Forgot and you can only reset it via command line. The second pitfall is not updating after setup: first check the logs; the configuration page can directly flip through the last fifty entries. Common errors fall into two categories—incorrect keys (service provider 401) and IP not being obtained (v6 does not have a host network, or the network card is chosen incorrectly, causing errors when multiple network cards are installed on the machine). The third security pitfall: On the configuration page, 'No access from public networks' is set by default—don't hesitate to disable it. This port 9876 contains the AK key for your domain, and exposing it on the public network is like hanging your home key outside. If you want to change settings remotely, use the VPN to activate it at home. Don't just try to save effort by forwarding directly to the port.

A

free gift is a Webhook. At the bottom of the configuration page, there is a Webhook bar. Whether the domain name update succeeds or fails, it will call back the URL you entered. Supported variables include #{ipv4Addr}, #{ipv6Addr}, and #{ipv4Result}. I connected it to Bark, and as soon as my home IP changed, my phone popped up a message saying "IPv4 changed, new address xxx." This is the same channel I used in the NAS alert thread, meaning the DDNS running status is also directly integrated into the alert system. Domain name resolution failures won't be noticed later.

There's nothing special about future container upgrades; it's just copying parameters and rebuilding the process. The process is in the container upgrade article. The only thing to remember is still that /root mount—set up externally, and the container can be handled however you like.

Who can use it, who doesn't

your case? , this . .
Do you want to go in
If you have your own domain name and broadband for public IPv4 or IPv6is the target user for ddns-go
If you don't have a domain but want remote access and find it troublesome, don't bother. Just use Synology QuickConnect or Feiniu FN Connect—slower but zero configuration
No public IP, no IPv6 DDNS can't cure this problem. Go to an FRP or VPN
router with built-in DDNS that works well enough and doesn't need to be replaced. If it works, don't bother it

Here's how I calculate: domain names cost a few dozen yuan a year, one container costs nothing, but what I get is my own domain, the service provider I picked, and if my IP changes, I can keep up within five minutes, plus notifications on my phone. To wrap things up in order—first, click confirm that your home IP can really be accessed from outside, then buy a domain and create a sub-account, then host network to set up a container, and finally set up a webhook. Once these four steps are complete, the dynamic domain name issue is sealed.

Read More


Copyright Notice Scan to read on mobile
All Rights Reserved: 《SHUNOT》 => 《On NAS, Docker runs ddns-go, dynamic domain names update automatically, and even if you change IPv6 prefixes, it still keeps up》
Article URL: https://www.shunot.com/en/nas/1282.html
Unless otherwise stated, all articles are original by 《SHUNOT》. Reposting is welcome! Please indicate the original URL when reposting, thank you.

Contact Us

Online Consultation: Click here to send me a message

WeChat ID: master_135

Scan to follow