Skip to main content

Secondary dns zone transfer from tinydns to bind

First create necessary users:
# useradd dnslog
# useradd axfrdns

axfrdns-conf command creates axfrdns configuration files and folders: (env, log, Makefile, run, tcp)
# axfrdns-conf axfrdns dnslog /etc/axfrdns /etc/tinydns <tiny dns server ip address>

Allow zone transfer for a bind server that contains secondary zone:
# echo '<bind dns server ip address>:allow,AXFR="<dns zone to allow>"' > /etc/axfrdns/tcp

In order to run make command tcprules should be installed:
# rpm -ivh daemontools-0.76-9.1.i386.rpm
# rpm -ivh ucspi-tcp-0.88-2.1.i386.rpm

make command creates tcp.cdb file:
# cd /etc/axfrdns
# make

run axfrdns tcpserver service:
# ./run

Dnsnotify is a perl script that is used to notify bind dns server about there is a zone update and once bind is triggered it would initiate zone transfer from tiny dns. From another command prompt on the tinydns server run this perl script. dnsnotify needs perl's Net::DNS package to be installed. It can be installed via cpan:
# perl -MCPAN -e shell;
cpan> install Net::DNS

Then run dnsnotify:
# ./dnsnotify

Dnsnotify script contents here: (you should set your axfrdns server ip address)
#!/usr/bin/perl -w
# usage: dnsnotify zone slave [...]
# example: dnsnotify
# requires Net::DNS >= 0.20
use Net::DNS;
use Data::Dumper;
use strict;
my $MY_IP = "<tiny dns server ip address>"; # your own IP here
my $zone = shift;
die "usage: dnsnotify zone slave [...]\n"
  unless defined $zone and @ARGV;
my $res = new Net::DNS::Resolver;
for my $slave ( @ARGV ) {
  my $packet = new Net::DNS::Packet($zone, "SOA", "IN")
    or die "new Net::DNS::Packet failed\n";
  print STDERR Dumper($packet);
  my $reply = $res->send($packet);
  if ( defined $reply ) {
  } else {
    warn "\n;; TIMED OUT\n";
exit 0;


Popular posts from this blog

Find and replace with sed command in Linux

Find and replace feature is always handy. It can turn into a torture when it comes to change or delete a simple constant string in a text file. There is a handy tool in linux for doing these kind of tihngs. Actually sed is not a text editor but it is used outside of the text file to make changes.