Dynamic DNS for subdomains

I own domain.com (example). I have two physical locations: home.domain.com, and apartment.domain.com. I want to have dynamic dns updated for both. At my home router, ddns updates domain.com’s IP address successfully. But if I try to switch the A Record to home.domain.com, it will not work (I get an error that it can’t find the zone ID).

Am I missing something? Is it possible to update multiple subdomain A Records for a singular domain ownership?

Not knowing the software that’s being used to do the updating or how it was written… it’s hard to say what the exact error is. But when accessing the API for Cloudflare the zone generally does not change (it would always be domain.com in this example) what changes is usually some field which would be the host name.

So here’s an example (for example) of a PowerShell script… which I haven’t actually used, but did a quick sanity check read through on: https://blog.netnerds.net/2015/12/use-powershell-and-Cloudflare-api-v4-to-dynamically-update-Cloudflare-dns-to-your-external-ip/


Import-Module .\CloudflareDynDns.psm1
Update-CloudflareDynamicDns -Token 1234567893feefc5f0q5000bfo0c38d90bbeb -Email [email protected] -Zone example.com -Record homelab

You can see this script uses both the zone name and then a record parameter to be updated. So yes… should be possible.

Above script was based on a 30 second Google search so not a recommendation just an example.

I use LEDE firmware on my Linksys routers, and they have a Cloudflare-v4 API update script. I tried switching just the hostname to “home” and left the domain section as “domain.com”, but that’s when I got the zone ID error. I’m checking the page you linked.

I just haven’t found an example of someone doing this with multiple subdomains; every example I’ve seen, has a singular domain/subdomain they update.

I found a fix, after opening a ticket for the ddns-scripts package on GitHub: <ddns-scripts> ddns-scripts_cloudflare.com-v4 not updating subdomain A record, and changes traffic status on success · Issue #5097 · openwrt/packages · GitHub.

The correct syntax for “domain” is actually “[email protected]”, when using subdomains.


DDNS on Cloudflare only works in linux distributions with systemd service deamon by default script. But it have cross platform compiler that can be adjusted and used.

The core.py file can be changed to create or update any subdomains.

Cheers :slight_smile: