Knowledge Base ISC Main Website Ask a Question/Contact ISC
Using the 'map' zone file format in BIND 9.10
Author: Cathy Almond Reference Number: AA-01120 Views: 3795 Created: 2014-02-05 10:07 Last Updated: 2014-04-22 17:55 0 Rating/ Voters

What is a zone file format?

A zone file is used to store the resource records for a zone. On a master server, the zone file is created externally to BIND, and is usually kept in text format for convenience and flexibility in maintaining it. A master server reads in the information that it finds in zone files without needing to know how that information got there. Master zone data can be maintained using dynamic updates, or it can be maintained by using some third-party software (such as a text editor or an IPAM system) to edit the zone file. Dynamic update protocols enable BIND's in-memory zone information to be updated while BIND is running; the updated zone information is then written to the zone file(s). If a master zone file is updated by some means external to BIND, then BIND must reload the entire zone file in order for those updates to take effect.

A slave server receives its zone data from the master server and saves that data by writing it to stable storage as a zone file. That is what makes it a slave. The zones that it receives are stored locally as files, so that they do not need to be retrieved from the master every time BIND restarts. When they are stored locally, they will be both written and read by the same software (BIND) and therefore can be encoded in a very specialized format if such a format can provide some advantage.

If a zone file is stored on a  server in text format, that format must be encoded each time it is stored, and decoded each time the stored copy is loaded. For small zones this is not an issue, but a zone file with a million records in it can take quite a long time to encode and decode.

A zone file can be stored on a  server in raw format, which is the 'wire format' in which a zone file is transmitted from master to slave. Unless specified otherwise, BIND 9 master servers expect to find zone files in text format and BIND 9 slave servers keep their zone files in raw format. (An aside: where DLZ is used, or where inline DNSSEC signing is used, the notion of zone files varies somewhat from what is described here.)

BIND 9.10 supports a map format for zone files, which is much faster but much more sensitive to changes in its processing environment. It can be used either on master servers or slave servers, but it is simplest to use text format on master servers.

What is the 'map' format for zone files and how do you use it?

While BIND is running, it keeps zone information in the computer's memory. What it means to decode a zone file is to read it from disk, find the information, and store that information in memory. If the zone file is written out to the disk exactly as it is stored in memory, using a technique called memory mapping, then it does not need to be decoded to be used. BIND can simply link to the file as if it were in memory, and the operating system will shortly ensure that it is in memory.

To specify map format for a zone file on a slave server, just add the term

    masterfile-format map;

to the zone declaration, resulting in something resembling this:

    zone third.example.com {
          type slave;
          file "sec/third.example.com"; 
          masterfile-format map;
          masters {192.168.1.100;}; 
      };

The map format is much faster than raw format, because the zone file does not need to be processed before it is used. The zone data is just there. Exactly how fast it is depends on many details of the host operating system and hardware. The speed of accessing a map-format zone file depends on disk speeds, disk cache sizes and speeds, operating system memory management algorithms, hardware memory bus speeds, and other activity on the computer's backplane. ISC has observed speedups of  50x of map format over raw format, but has also observed speedups far less than that.

Warning: map format not usable between systems or between versions of BIND

A map-format zone file is tied to the computer, operating system, and version of BIND on which it was written. You should not try to create a map-format zone file on one computer and use it on another. If you are upgrading BIND or upgrading the operating system used to support BIND, you should delete all map-format zone files and let them be re-created by zone transfers once BIND starts up. If you are an operating-system guru and you are certain that you understand and are in control of the nuances of your servers' mmap capabilities, you can push these limits, but ISC does not recommend it.

Deciding whether or not to use 'map' format for zone files.

There is little risk or inconvenience in using the map format on a slave server. Zones enter a slave server via zone-transfer protocols and are written to files by BIND and then read back by BIND. In normal operation there is no need for a person to look at a zone file stored on a slave server, but if it does need to be inspected, the named-compilezone program can be used to encode and decode a map-format zone file. If  BIND is upgraded, the operating system upgraded, or the server hardware replaced, you should delete the zone files and let them be re-created as part of BIND's normal slave-to-master synchronization.

You can use map format on a master server, which will enable it to be started or restarted more quickly. But if you do, then you must have a way of creating and editing those files outside BIND. You can create an empty zone file in map format and then manage it via dynamic updates, or you can use a conversion tool that will translate between text and map format. The software tool named-compilezone will convert back and forth between map format and text format, so it is possible to set up a workflow for a master server using map-format zone files. Whether this is too much of an inconvenience is something you will have to decide for yourself. If you do this, you must be certain to use the version of named-compilezone that was packaged with your version of BIND. They must match exactly.


© 2001-2015 Internet Systems Consortium

Please help us to improve the content of our knowledge base by letting us know below how we can improve this article.

If you have a technical question or problem on which you'd like help, please don't submit it here as article feedback.

For assistance with problems and questions for which you have not been able to find an answer in our Knowledge Base, we recommend searching our community mailing list archives and/or posting your question there (you will need to register there first for your posts to be accepted). The bind-users and the dhcp-users lists particularly have a long-standing and active membership.

ISC relies on the financial support of the community to fund the development of its open source software products. If you would like to support future product evolution and maintenance as well having peace of mind knowing that our team of experts are poised to provide you with individual technical assistance whenever you call upon them, then please consider our Professional Subscription Support services - details can be found on our main website.

Feedback
  • There is no feedback for this article
Info Submit Feedback on this Article
Nickname: Your Email: Subject: Comment:
Enter the code below:
Quick Jump Menu