I purchased a domain through Cloudflare, let’s call it example.com for this discussion. I configured the DNS settings with an A record pointing example.com to my NPM server IP address (DNS only mode) and added a CNAME record for * pointing to example.com (also DNS only). Now I’m wondering about creating additional subdomains like test.example.com. Do I need to set up separate A and CNAME records for each subdomain? Or can I reuse the existing configuration for different NPM containers? My goal is to run multiple setups: - Various subdomains following the pattern service.20.example.com on one NPM instance - Simple subdomains like app.example.com on a different NPM instance. Also curious if anyone knows whether I can configure example.com as a dynamic DNS service for my Ubiquiti equipment?
wildcard cname should work fine for your setup - no need for extra dns records. just make sure your npm instances are listening on different ports internally and configure each one to handle the right subdomain patterns. btw cloudflare’s api works great with ubiquiti ddns, just need to setup a custom provider with your api token.
Your current wildcard setup is solid and will cover both subdomain patterns without needing additional DNS records. I’ve been running a similar configuration for about two years now with multiple NPM instances behind the same domain. What you’ll want to focus on is the backend routing - each NPM container can listen on different internal ports while sharing the same external IP through your reverse proxy setup. For the service.20.example.com pattern, that’s perfectly manageable with your existing wildcard record since it catches any subdomain depth. Just make sure your NPM instances don’t have overlapping proxy host configurations or you’ll run into conflicts. One thing I learned the hard way is to document which NPM instance handles which subdomain patterns, especially when troubleshooting later. As for Ubiquiti DDNS with Cloudflare, it works well through their API but you’ll need to create an API token with zone edit permissions and configure it as a custom DDNS provider in your Ubiquiti controller.
The wildcard CNAME record you already have set up should handle most of your subdomain needs without requiring individual DNS entries for each one. Since you pointed *.example.com to example.com, both test.example.com and service.20.example.com will resolve to your main IP address. The routing magic happens at the NPM level, not DNS. For your multi-instance setup, you can absolutely run different NPM containers on the same server using different ports internally, then configure each container to handle its specific subdomain patterns. One NPM instance can manage all your service.20.example.com subdomains while another handles app.example.com and similar simple subdomains. Regarding the Ubiquiti dynamic DNS question - Cloudflare does support dynamic DNS updates through their API, and most Ubiquiti gear can work with custom DDNS providers. You would need to configure the Ubiquiti device with Cloudflare’s API credentials and endpoint. However, this would typically update your main A record, so make sure that aligns with your NPM routing strategy.