MaraDNS: Shortcuts in zone files

Previously I have blogged about installing MaraDNS as an authoritative nameserver on CentOS Linux. In this article I am going to look at some convenient shortcut functions that you can use in your MaraDNS zone files.

Zone files for your domain names can contain some easy to use shortcut functions. Here are some of them:

  • TTL Function: Add /ttl to a line in your zone file to define the default Time To Live of subsequent zone records:

    /ttl 14400 ~
    example.com. A 192.168.1.100 ~
    www.example.com. A 192.168.1.100 ~

    In the above example both A records will have a TTL of 14400 or 4 hours.

  • Percentage symbol: The percentage sign can be used to refer to the zone file’s domain name. For example if you are creating a zone file for the domain name example.com. and you include this in it:

    % A 192.168.100.1 ~
    www.% A 192.168.100.1 ~

    It is the same as this:

    example.com. A 192.168.100.1 ~
    www.example.com. A 192.168.100.1 ~
  • Serial function: The serial function generates a serial number based on the zone file’s last update timestamp. You can use it in your Start Of Authority (SOA) record:

    example.com. SOA ns1.example.com. email@example.com. /serial 86400 3600 604800 86400 ~

    This function saves you from having to update the serial number each time you make a change in the zone file.

These shortcuts make it more convenient to edit and maintain zone files for your domain names.

Leave a Reply

Your email address will not be published. Required fields are marked *