export out of database into zone files for bind

Started by planohog, March 19, 2007, 03:47:34 PM

Previous topic - Next topic



did a search file,  I really need to export the database into zone files for safe keeping.

we will be moving to bind out of tinydns but keeping the gui for operations.

can anyone point me at a script or show me how I can get this

tinydns to bind conversion.. Used search found old things from 2004 unanswered

thanks in advance.


NicTool doesn't support BIND very well. It should, and somebody hacked together some export scripts that are here on the forum.

For those that want to transfer data from NicTool to BIND, the easiest path is exporting to tinydns, and doing zone transfers from axfrdns (it comes with djbdns) to your BIND server.


yeah, djbdns does not do dnssec, which is a business requirement.
i am hoping for something that was like ProBIND2, but maybe commercially supported.

by 'not very well' and 'someone hacked together some scripts', i am fair
old linux hack, and the mod-perl stuff is not daunting.

is it 'usable'?

We have 16 BIND servers spread across 5 DC's. I need something that can manage
them all.

We have some one at work, who is trying to sell everyone on powerdns, and I need
to find something that can, even with some tweaking, take the data and push it
to a BIND server. named.conf too if possible, to make it a total mgt thing.

Anyone know the limitations of these hacks?
I work for a company that should've had their own better way of doing things, but didn't,
and before someone sells management on a worse way (custom inhouse Ruby thing), I
wanted to find something out there people who use BIND use, since
BIND is *old* and so widespread, there had to be something better.



You might want to see a post I just added about a BIND export script.



Hey guys,

Good news. Another client needed some custom DNS exports so I wrote an export system for NicTool. It completely replaces the old exports. Now it is much, much easier to export to other DNS servers, including BIND. I'm available to write this now, if someone were interested in funding it.


Good job for this export script to BIND.

I discorvered somhting that make some specifics zones failed. In those specifics zones there's only NS RECORDs.
If you administer a root  dns zone this export tool cannot be use.

a root zone (like .zr)


.zr  ttl in SOA soa_server.fqdn email(
.zr NS primary.
.zr NS secondary.

toto NS ns1_for_toto.
       NS ns2_for_toto.


With the export script to BIND (nt_export.pl)

.zr  ttl in SOA soa_server.fqdn email(
.zr NS primary.
.zr NS secondary.

.toto NS ns1_for_toto.
.toto NS ns2_for_toto.


Because of the beginig point "."  we change the  $ORIGIN.
So all the entries of that zone have seen as "out-of-zone  data".



I'm not following your example. Can you please create a sample zone in NicTool that demonstrates the problem? Then include the zone data that NicTool exported and a diff of the export and what the zone file needs to have to work properly?


The files are joined


Ah, I think I see the problem. Try this:

--- a/server/lib/NicToolServer/Export/BIND.pm
+++ b/server/lib/NicToolServer/Export/BIND.pm
@@ -59,10 +59,14 @@ sub zr_txt {

sub zr_ns {
-    my ($self, $r) = @_;
+    my ($self, $r, $fully_qualified) = @_;

+    if ( $fully_qualified ) {
# name  ttl  class  type  type-specific-data
-    return "$r->{name}.        $r->{ttl}       NS      $r->{address}\n";
+        return "$r->{name}     $r->{ttl}       NS      $r->{address}\n";
+    };
+    return "$r->{name} $r->{ttl}       NS      $r->{address}\n";

sub zr_ptr {
diff --git a/server/lib/NicToolServer/Export/Base.pm b/server/lib/NicToolServer/Export/Base.pm
index 18488e7..1f97090 100644
--- a/server/lib/NicToolServer/Export/Base.pm
+++ b/server/lib/NicToolServer/Export/Base.pm
@@ -53,8 +53,8 @@ sub export_db {
         my $fh = $self->get_export_file( $z->{zone} );
         $self->{nte}{zone_name} = $z->{zone};

-        $fh->print($self->{nte}->zr_soa( $z ));
-        $fh->print($self->{nte}->zr_ns(  $z ));
+        $fh->print($self->{nte}->zr_soa( $z    ));
+        $fh->print($self->{nte}->zr_ns ( $z, 1 ));

         my $records = $self->get_records( $z->{nt_zone_id} );
         foreach my $r ( @$records ) {


Il will try this  and make you know



Those changes on BIND.pm remove the point '.' after the records but this introduce another issue.

On all zones now the no nameserver

because we have now:

mq.  IN SOA ...(
         .. ...


The  zones now have no nameserver on them  because there's no more point "." after  de FQND

consoto.com  IN NS ns1.fqdn.
consoto.com IN NS ns2.fqdn.

Bind translate this to consoto.com.consoto.com.

a good  zone description would be:

consoto.com.  IN NS ns1.fqdn.   
consoto.com. IN NS ns1.fqdn.

i put my nameserver in BIND.pm directly.
i'm working on a correction for that.