Home page

HOWTO build a DNS registry

Sheets


Credits

How to contribute

Legal notice

Whois service

Search:

Printable version    Version française

The zone file generator

Stephane Bortzmeyer

$Date: 2003/10/22 16:19:18 $


It is quite difficult to write a software that will work for every NIC in the world (even with a lot of options in the configuration file). Unless everybody chooses the same model of a registry, of course. But if you want to follow your own way, you'll have to do some coding. One element of this software is the zone file generator, that will create a zone file from the information stored in the database.

In this model, the information (domain names, contacts, name servers - not always with the IP address, only when it's necessary, resellers, etc) is in some sort of database (a RDBMS, for instance) and the zone file is generated from the database.

To extract info from the database, use something like Perl DBI (a ten-line script is sufficient) or a shell command as simple as (for PostgreSQL):

#!/bin/sh
psql -q --no-align --tuples-only registry \
     -c "SELECT address, hosts.name as host, domains.name as domain\
           FROM Hosts,Domains,Nameservers\
           WHERE nameservers.domain = domains.id AND \
                 nameservers.nameserver = hosts.id" |\
   awk -F \| '{ print $3". IN NS "$2"."; if ($1) {print $2". IN A "$1"" } }' 
This generator is not perfect. If a name server is used for N domains, its glue record will appear N times in the zone file. But you get the idea.

This is more work than just managing the BIND zone file by hand but it's worth it.

Last news
Changing the IP address of the TLD name server

The whois service

Anycast, une nouvelle technique de gestion d'un parc de serveur de noms

Setting up a DNS registry with XML and XSL

The choices for a nameserver

Checking your domaine: why and how

Modélisation de données

Should you publish social information about you registrants?

The zone file generator

HOWTO setup a domain registry

IDN (Internationalized Domain Names)

DocBook/XML source of this page

For every question about generic NIC, please ask info@generic-nic.net.

(last rebuild by WML 2.0.8 (30-Oct-2001): Wednesday 9 March 2005)