I have written up a small perl script which can be used to generate a zone file for your domain. This is useful if you have no control panel on your server and wish to create valid zone files easily. By default, the zone file is printed into the screen (which you can easily redirect to a file if required) Here’s how the script works:

[vimal@vimal perl]$ ./generate_dns_zone.pl

./generate_dns_zone.pl: Perl script to dump standard zone file for a domain

USAGE: ./generate_dns_zone.pl <domain name> <ip address> <nameserver1> <nameserver2>
 [nameserver1 IP] [nameserver2 IP]

======================================================
<domain name>    - Name of the domain (e.g.: example.com)
<ip address>    - IP address of the domain (A record)
<nameserver1>    - Nameserver hostname [ns1] (e.g.: ns1.zoneedit.com)
<nameserver2>    - Nameserver hostname [ns2] (e.g.: ns2.zoneedit.com)

If your domain name is example.com with its A record pointing to 192.168.1.1 with nameservers
 ns1.zoneedit.com and ns2.zoneedit.com, then command to dump the zone file is:

./generate_dns_zone.pl example.com 192.168.1.1 ns1.zoneedit.com ns2.zoneedit.com

[nameserver1 IP] and [nameserver2 IP] should be used **ONLY** if you are using custom
nameservers. For example, if you are using ns1.example.com and ns2.example.com (custom
nameservers) which resolve to 192.168.1.2 and 192.168.1.3 respectively, then the command
will be:

./generate_dns_zone.pl example.com 192.168.1.1 ns1.example.com ns2.example.com 192.168.1.2
192.168.1.3
======================================================

Let’s give it a try:

[vimal@vimal perl]$ ./generate_dns_zone.pl example.com 192.168.1.1 ns1.example.com
 ns2.example.com 192.168.1.2 192.168.1.3

$TTL 14400

example.com.       86400   IN      SOA     ns1.example.com.  admin.example.com.        (

                                                2010041301 ;Serial Number
                                                86400 ;refresh
                                                7200 ;retry
                                                3600000 ;expire
                                                86400 ;minimum

)

example.com.       86400   IN      NS      ns1.example.com.
example.com.       86400   IN      NS      ns2.example.com.
example.com.       14400   IN      A       192.168.1.1
example.com.       14400   IN      MX      10      mail.example.com.
example.com.       14400   IN      TXT    "v=spf1 a mx ~all"
mail    14400   IN      CNAME   example.com.
www     14400   IN      CNAME   example.com.
ftp     14400   IN      CNAME   example.com.
ns1.example.com.   14400   IN      A       192.168.1.2
ns2.example.com.   14400   IN      A       192.168.1.3

You can download the script here : http://www.technomenace.com/generate_dns_zone.pl.gz