I l@ve RuBoard Previous Section Next Section

2.22 Filtering a Host Table into Zone Data Files

2.22.1 Problem

You want to filter an existing host table, such as an /etc/hosts file, into zone data files.

2.22.2 Solution

Use a tool such as h2n to filter your host table into the corresponding zone data files. With h2n, you specify the domain name of a forward-mapping zone to create as the argument to the -d option and the networks associated with that zone as the argument to one or more -n options. For example, the following command would build data files for the foo.example and 168.192.in-addr.arpa zones:

% h2n -d foo.example -n 192.168

These zone data files would each contain a SOA record and an NS record pointing to the local host, as well as A records or PTR records for hosts in /etc/hosts on the 192.168/16 network. Additional options allow you to create other records, including NS records pointing to other name servers.

2.22.3 Discussion

You can get a copy of h2n from the tar ball that accompanies DNS and BIND, located at ftp://ftp.oreilly.com/published/oreilly/nutshell/dnsbind/dns.tar.Z. Also, Andris Kalnozols of Hewlett-Packard has enhanced h2n significantly; he makes his souped-up version available at ftp://ftp.hpl.hp.com/pub/h2n/h2n.tar.gz.

There are other tools available for filtering host table-format data into zone data files; h2n is only one option. Take a look at the contents of bind-contrib.tar.gz, available in the same directory as the latest BIND 8 release, for some of your options.

2.22.4 See Also

Section 1.12 for how to get a copy of BIND (or bind-contrib.tar.gz), and "Tools" in Chapter 4 of DNS and BIND.

    I l@ve RuBoard Previous Section Next Section