Every new domain on a DirectAdmin server gets a DNS zone built from a template. Improving the template once – correct nameservers, SPF, DMARC, CAA and sensible TTLs – means every future domain starts with good DNS instead of being fixed by hand.
Before you start
- Admin-level access and root SSH.
- Your default nameservers set in administrator settings.
Where the template lives
The default template is /usr/local/directadmin/data/templates/named.db. Never edit it directly – updates overwrite it. Copy it to the custom folder and edit the copy:
mkdir -p /usr/local/directadmin/data/templates/custom && cp /usr/local/directadmin/data/templates/named.db /usr/local/directadmin/data/templates/custom/DirectAdmin uses the custom copy automatically when it exists.
Template variables
The template uses tokens that DirectAdmin replaces for each domain, such as |DOMAIN|, |IP|, |NS1|, |NS2|, |SERIAL| and |TTL|. Keep those intact and add your records around them.
Recommended additions
- SPF: make sure there is a TXT record like
"v=spf1 a mx ip4:|IP| ~all". - DMARC: add
_dmarc 14400 IN TXT "v=DMARC1; p=none; rua=mailto:dmarc@|DOMAIN|", or point reports to a central address you monitor. - CAA:
|DOMAIN|. 14400 IN CAA 0 issue "letsencrypt.org"if you only issue Let's Encrypt certificates. - TTL: 3600 is a good default; lower values help migrations but increase queries.
DKIM records are added automatically per domain when DKIM is enabled; see DKIM, SPF and DMARC.
Test with a new domain
Create a test domain, open DNS Management for it and check the records. Validate the zone syntax with named-checkzone testdomain.com /var/named/testdomain.com.db (path depends on the DNS server).
Existing domains
Templates apply only to new zones. To update existing domains, change records per domain, or script it carefully with DirectAdmin's API or the DNS admin page. Avoid mass-overwriting zones that customers have customised.
Reseller templates
Resellers can have their own DNS template (for example with their private nameservers) if you allow it in their package. Their template overrides the server default for their users. See reseller private nameservers.
Troubleshooting
- New zones ignore changes: the custom file is in the wrong folder or has wrong permissions.
- DNS server fails to load zones: a syntax error in the template – missing quotes or trailing dots. Test with
named-checkzone. - Records duplicated: the default template already contained a record you added again.
