2.7 KiB
2.7 KiB
Namecheap Dynamic DNS on Alpine (LXC) with ddclient
This setup uses one ddclient instance to update a single dynamic host per domain, then points all service subdomains at that host via CNAMEs.
Recommended DNS strategy (per domain)
- Create an A record
dyn(e.g.dyn.example.com) and let ddclient update it. - Convert all service subdomains (blog, grafana, calibre, etc.) to CNAME records pointing to
dyn.<domain>. - Optionally create a wildcard CNAME
*pointing todyn.<domain>and add exceptions for any hosts that should not follow the wildcard. - Apex
@cannot be a CNAME on Namecheap. Keep@as an A record. You can update@via ddclient if you choose (the template includes@entries), but the recommended default isdyn+ CNAMEs.
Namecheap “Advanced DNS” steps
Repeat these steps for each domain:
-
Create an A record for the dynamic host:
- Type: A Record
- Host:
dyn - Value: your current public IP (will be updated by ddclient)
- TTL: Auto
-
Convert each subdomain to CNAME:
- Type: CNAME Record
- Host:
blog(orgrafana,calibre, etc.) - Value:
dyn.<domain> - TTL: Auto
-
Optional wildcard:
- Type: CNAME Record
- Host:
* - Value:
dyn.<domain> - TTL: Auto
- Note: wildcard CNAMEs are not updated by ddclient.
Note: some Namecheap setups require enabling Dynamic DNS per host in their panel. If updates fail, verify that Dynamic DNS is enabled for the dyn host.
Alpine validation
-
Check detected public IP:
curl -s https://dynamicdns.park-your-domain.com/getip -
Run ddclient once in debug mode:
ddclient -daemon=0 -debug -verbose -noquiet -
Check logs:
tail -f /var/log/messages # or logread -f
Config placement and secrets
- Place your real Namecheap Dynamic DNS token in
/etc/ddclient/ddclient.conf. - Do not commit real API tokens to this repo. Use the template at
templates/ddclient/ddclient.conf.templateas a reference. - The Namecheap Dynamic DNS Password (not the API key) is required for each domain.
Environment variable list (per domain)
These are used by the installer when it writes /etc/ddclient/ddclient.conf:
NAMECHEAP_DDNS_PASSWORD_ALEXANDRE_VAZQUEZ_CLOUDNAMECHEAP_DDNS_PASSWORD_ALEXANDRE_VAZQUEZ_COMNAMECHEAP_DDNS_PASSWORD_PORTFOLIOJOURNAL_APPNAMECHEAP_DDNS_PASSWORD_XSLTPLAYGROUND_COMNAMECHEAP_DDNS_PASSWORD_OLALLALAB_ORG
Simple shell setup for Alpine (root login shell)
This helper script appends the exports to /root/.profile for the default ash login shell:
./scripts/setup-ddclient-env-alpine.sh
Edit the REPLACE_ME values in /root/.profile, then re-login or run:
. /root/.profile