Organizing Zone Data Files in Different Directories

3.7.1 Problem

You want to organize your zone data files in different directories.

3.7.2 Solution

Specify the full path or a relative path to the zone data files in the zones' file substatements. For example:

zone "foo.example" { type master; file "/var/named/masters/db.foo.example"; }; zone "bar.example" { type slave; masters { 192.168.1.1; }; file "/var/named/slaves/bak.bar.example"; };

Or, using relative paths:

zone "foo.example" { type master; file "masters/db.foo.example"; }; zone "bar.example" { type slave; masters { 192.168.1.1; }; file "slaves/bak.bar.example"; };

Relative paths are interpreted relative to the name server's working directory.

3.7.3 Discussion

Splitting zone data files into one directory for primary master zones and one for slave zones is handy, but on a name server with hundreds or thousands of zones, you may still end up with an unwieldy number of zone data files in each directory. On a name server like that, you might create 26 subdirectories, named "a" through "z." Then you could organize data files into subdirectories according to the first letter of the zone's domain name. Or you could create subdirectories after the last label of a zone's domain name, and each of those subdirectories could have subdirectories named for the next-to-last label, and so on, like so:

/example/ /example/db.foo /example/bak.bar /arpa/ /arpa/in-addr/ /arpa/in-addr/192/ /arpa/in-addr/192/168/ /arpa/in-addr/192/168/db.0

This makes it easy to find a zone data file and keeps directories small.

3.7.4 See Also

Section 3.6 and "Using Several Directories" in Chapter 7 of DNS and BIND.

Категории