Default zonefiles

Default zonefiles are useful when one has a large number of identical zones. They are also useful for setups like "have all records resolve to a given IP address", for example when setting up connections to the internet that require authentication to use, and want all traffic to be directed to a web page stating "you're not logged in to use the internet yet".

A default zonefile is a CSV2 zone file where stars can be at the end of hostnames. There are a few restrictions with default zone files:

With the exception of these restrictions, and having the ability to have a '*' at the end of a hostname (or simply the catch-all wildcard hostname '*'), a csv2 default zone file functions like a normal csv2 zone file.

A default zone file looks like this:

# This is an example csv2_default_zonefile

*       SOA     example.com. email@example.com. 1 7200 3600 604800 1800

*       NS      a.example.com.
*       NS      b.example.com.

# Here are some A (ipv4 address) records; since this is the most
# common field, the zone file format allows a compact representation
# of it.

* 10.10.10.10

# The A record can be specified explicitly, but doesn't need to be
# E.g. the above line could have been written '* A 10.10.10.10'
www.* A 10.10.10.10

# Here is a MX record
* MX 10 mail.example.com.
Here, "example.com" is replaced with the name of the zone server running MaraDNS, "a.example.com." and "b.example.com." replaced with the NS entries running MaraDNS, 10.10.10.10 is replaced with the IP for the machine in question, and "mail.example.com." is replaced with the name of the machine that accepts mail for this domain.

NS entries are the names of machines which are running this instance of MaraDNS. In the above example, we will also have an "example.com" zone that will have "a.example.com" and "b.example.com" entries. The example.com domain will also have an "example.com" entry and a "mail.example.com" entry.

What this does is allow people to serve a large number of domains with MaraDNS without using up too much memory, and without needing to load a large number of domains when starting MaraDNS. The only caveat is that all of the domains need to be identical. This is often the case with large web serving farms. In situations where different domains are served by different machines in the web serving farm, one simply runs multiple instances of MaraDNS on different IPs; machines hosted on different machines just use different DNS servers. Since MaraDNS is a small program, suitable for embedded applications, even running multiple instances of MaraDNS will be more lightweight than running other DNS servers when there are a large number of domains and only a few web servers processing the domains.

Record searching order

When the default zonefile is enabled, MaraDNS searches for records in the following order: