Dynamic DNS for subdomains


#1

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?


#2

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/

PowerShell

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.


#3

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.


#4

I found a fix, after opening a ticket for the ddns-scripts package on GitHub: https://github.com/openwrt/packages/issues/5097.

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