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
THIS IS THE TITLE

HOWTO setup a domain registry

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

NDI (Noms de Domaines Internationaux)

Changing the IP address of the TLD name server

Setting up a DNS registry with XML and XSL

Checking your domaine: why and how

The choices for a nameserver

The zone file generator

Modélisation de données

The whois service

DocBook/XML source of this page

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

(last rebuild by WML 2.0.11 (19-Aug-2006): Monday 10 November 2008)