zone reload questions
Ralf Peng
ralf.peng at gmail.com
Fri Mar 20 08:23:14 UTC 2009
Hmm! I was just thinking this is a BUG!
I wrote a function in Perl to modify the serial number:
sub increase_serial {
my $bindetc = "/usr/local/bind/etc/";
my @zones = get_zones(); # get the zones
for my $zone (@zones) {
for my $isp ('tel','cnc') { # two isp links
my $file = $bindetc . "$zone.$isp.db";
my @c;
open HD, $file or die $!;
while(<HD>) {
s/(\d+)(\s+\; Serial)/($1 + 1) . $2/e; # increase the
serial number by 1
push @c,$_;
}
close HD;
open HDW, ">", $file or die $!;
print HDW for @c;
close HDW;
}
}
return 1;
}
I do below to execute the reload:
increase_serial();
system("/usr/local/bind/sbin/rndc reload");
OK I run two reload in a second, the serial number was increased
correctly, but bind only reload zones correctly for the first time.
This is the system log:
[the first reload is successful]:
Mar 20 16:08:46 localhost named[25599]: received control channel
command 'reload'
Mar 20 16:08:46 localhost named[25599]: loading configuration from
'/usr/local/bind9.6/etc/named.conf'
Mar 20 16:08:46 localhost named[25599]: using default UDP/IPv4 port
range: [1024, 65535]
Mar 20 16:08:46 localhost named[25599]: using default UDP/IPv6 port
range: [1024, 65535]
Mar 20 16:08:46 localhost named[25599]: reloading configuration succeeded
Mar 20 16:08:46 localhost named[25599]: reloading zones succeeded
Mar 20 16:08:46 localhost named[25599]: zone test.duxieweb.com/IN/cnc:
loaded serial 102502
Mar 20 16:08:46 localhost named[25599]: zone my.test.com/IN/cnc:
loaded serial 101
Mar 20 16:08:46 localhost named[25599]: zone test.duxieweb.com/IN/tel:
loaded serial 102502
Mar 20 16:08:46 localhost named[25599]: zone my.test.com/IN/tel:
loaded serial 101
[the second time bind doesn't reload zones even zones db were changed]:
Mar 20 16:08:46 localhost named[25599]: received control channel
command 'reload'
Mar 20 16:08:46 localhost named[25599]: loading configuration from
'/usr/local/bind9.6/etc/named.conf'
Mar 20 16:08:46 localhost named[25599]: using default UDP/IPv4 port
range: [1024, 65535]
Mar 20 16:08:46 localhost named[25599]: using default UDP/IPv6 port
range: [1024, 65535]
Mar 20 16:08:46 localhost named[25599]: reloading configuration succeeded
Mar 20 16:08:46 localhost named[25599]: reloading zones succeeded
Will bind only reload zone files based on the file's mtime by second?
That's will be a huge problem for some dynamic dns I may think.
Thanks.
Ralf.
2009/3/20 Ralf Peng <ralf.peng at gmail.com>:
> Hello,
>
> I'm using Bind-9.6-P1, and found something strange about zone reloading.
>
> I have two views, for example, one is cnc, another is tel (the default).
> The records for cnc and tel are parsed to two different ISP's links.
>
> Sometime our cnc link is disconnected, at this time I copy cnc's zone
> db to a backup file, for example:
>
> cp cnc.zone.db cnc.zone.db.bak
>
> and copy tel's zone db to cnc's, for example,
>
> cp tel.zone.db cnc.zone.db
>
> Then I reload bind (sbin/rndc reload), all works fine.
>
> But, the problem is, when cnc link is re-connected, I restore cnc's
> zone db to the original one, for example:
>
> mv cnc.zone.db.bak cnc.zone.db
>
> and reload bind.
>
> this time things work not fine.
> bind didn't load the correct cnc zone (restored from cnc.zone.db.bak),
> it kept the old one which was copied from tel's.
>
> in order to let bind reload correctly, I need to do:
>
> cd /usr/local/bind/etc
> touch *
> /usr/local/bind/sbin/rndc reload
>
> then bind reloads all zones correctly.
>
> Why this happens? is it problematic for automatic SA job?
> btw: my name server is: ns.test.duxieweb.com
>
> Thanks.
>
> Ralf.
>
More information about the bind-users
mailing list