There are a number of shortcuts you can use to make your life easier:
If you use Bind or similar software that uses files to store the zone data: point your zones to the same file for example:
zone "example.net" {
type master;
file "/etc/bind/zone/default.zone";
};
zone "example.org" {
type master;
file "/etc/bind/zone/default.zone";
};
Because you can make use of certain DNS shorthands you can create a universal zone file:
$TTL 1h ; default expiration time of all resource records without their own TTL value
@ IN SOA ns1.example.com. username.example.com. (
20140218131405 ; Serial number YYYYMMDDHHMMSS
28800 ; Refresh 8 hours
7200 ; Retry 2 hours
604800 ; Expire 7 days
86400 ; Minimum TTL 1 day )
@ IN NS ns1.example.com. ; ns1.example.com is a primary nameserver
@ IN NS ns2.example.com. ; ns2.example.com is a backup nameserver
@ IN MX 10 mail.example.com. ; mail.example.com is the mailserver
@ IN MX 20 mail2.example.com. ; the secondary mailserver
@ IN A 192.0.2.1 ; IPv4 address for the bare domain
IN AAAA 2001:db8:10::1 ; IPv6 address for the bare domain
www IN A 192.0.2.1 ; www.domain
IN AAAA 2001:db8:10::1 ; IPv6 address for www.domain - note by starting the line with a blank it becomes the continuation of the previous record and this IPv6 record applies to www
wwwtest IN CNAME www ; wwwtest is an alias for www
This makes use of the fact that the hostnames in zone files that don't end with
a dot . are always expanded with the $ORIGIN
which in turn is implicitly set to the zone name. And @ is short-hand for the $ORIGIN.
Rather than maintain individual zone files by hand, enable a method interact programmatically with your name servers.
I've used PowerDNS which allows for a RDMS as a back-end which fit in very well with the LAMP stack we were using at the time. Cloud Services like Amazon Route 53 also expose web-API's.
But even venerable Bind also supports dynamic Update which is a method for adding, replacing or deleting records in a master server by sending it a special form of DNS messages. The format and meaning of those messages is specified in RFC 2136.
Dynamic update is enabled by including an allow-update
or an update-policy
clause in the zone statement. For more info check the Bind Administrator Reference Manual.