# Bind Master/Slave Zone xfer problems.

## hookooekoo

I have recently migrated my DNS servers from Fedora to Gentoo.

When I update zone files on master and increment the serial no., the changes don't propogate to the slave server.

I restart named and reload rndc.  

If i delete the zone file on the slave, it does update.

It does the transfer via axfr, and from my understand that is the correct way to do it when you manually update your zone files?

Any clue why the transfers don't occur?

Master Named.

```

options {

        directory "/var/bind";

       

        // uncomment the following lines to turn on DNS forwarding,

        // and change the forwarding ip address(es) :

        //forward first;

        //forwarders {

        //      123.123.123.123;

        //      123.123.123.123;

        //};

        //listen-on-v6 { none; };

        //listen-on { 127.0.0.1; 10.0.0.2; };

        //to allow only specific hosts to use the DNS server:

        allow-query {

                any;

        };

        // if you have problems and are behind a firewall:

        query-source address * port 53;

        pid-file "/var/run/named/named.pid";

};

zone "inc.com" IN {

        type master;

        file "pri/inc.com.zone";

        allow-update { none; };

};
```

Slave named.conf

```

options {

        directory "/var/bind";

        // uncomment the following lines to turn on DNS forwarding,

        // and change the forwarding ip address(es) :

        //forward first;

        //forwarders {

        //      123.123.123.123;

        //      123.123.123.123;

        //};

        //listen-on-v6 { none; };

        //listen-on { 127.0.0.1; 10.0.0.2; };

        //to allow only specific hosts to use the DNS server:

        allow-query {

                any;

        };

        // if you have problems and are behind a firewall:

        query-source address * port 53;

        pid-file "/var/run/named/named.pid";

};

zone "inc.com" IN {

        type slave;

        file "/var/bind/sec/inc.com.zone";

        masters { 

                10.0.0.2; };

};
```

----------

## kashani

You're running a fairly unfancy config. I'd do two things. Specify the IP of the slave server as being allowed to transfer. You really don't want to allow open access to your name server like that. And second add a notify statement. The notify will have the master clue the slave that a change has taken place. Else the slave only requests updates of the slave as often as you've specified in the zone file itself.

Assuming the master is 10.0.0.1 and the slave is 10.0.0.2 your master config should look something like this plus the rest of your config.

```

options {

        directory "/var/bind"; // sets root dir, use full path to escape

        allow-recursion { 127.0.0.1; 10.0.0.0/8; }; // allow recursive lookups

        allow-transfer { 10.0.0.2; }; // allow transfers to these IP's

        notify yes; // notify the above IP's when a zone is updated

        transfer-format many-answers; // Generates more efficient zone transfers

        pid-file "/var/run/named/named.pid"; // location of pid file

};

```

kashani

----------

## hookooekoo

Thanks for the reply,

I had already realized I had left out the allow-transfer and notify line and added them.  The zonefiles still don't update though.

Update named

```
options {

        directory "/var/bind";

        allow-transfer { 10.0.0.3; 10.0.0.4; };

        notify yes;

        // uncomment the following lines to turn on DNS forwarding,

        // and change the forwarding ip address(es) :

        //forward first;

        //forwarders {

        //      123.123.123.123;

        //      123.123.123.123;

        //};

        //listen-on-v6 { none; };

        //listen-on { 127.0.0.1; 10.0.0.2; };

        //to allow only specific hosts to use the DNS server:

        allow-query {

                any;

        };

        // if you have problems and are behind a firewall:

        query-source address * port 53;

        pid-file "/var/run/named/named.pid";

};
```

----------

## kashani

Strange. Does the master show that it's sending notifies in the log files?

kashani

----------

## hookooekoo

Yes, It sends it a few minutes after restart of named, but the serial no. does not update on the slave.

----------

## hookooekoo

One of the zone files just updated.  

I thought it was  supposed to update immediately after reload?

I think the Refresh and that is the reason it updated?

----------

## kashani

How about the slave servers? Anything interesting in their logs? They should log the incoming notify and then log the xfer that happens as well. On my Gentoo name servers it's pretty instanteous.

kashani

----------

## hookooekoo

Ya slave shows it.

```
zone xxxxx.com/IN: sending notifies (serial 2005090602)
```

----------

## hookooekoo

Restarting named on both servers causes both dns servers to send notifies.  The Master server sends notify with new Serial, slave sends notify with old, and doesn't get updated.

Master

```
Sep  7 15:16:22 ns2 named[23558]: zone xxx.com/IN: sending notifies (serial 2005090701)
```

Slave

```

Sep  7 08:16:27 ns3 named[21171]: zone xxx.com/IN: sending notifies (serial 2005090607)
```

Can't figure out why the slave doesn't sync.

I also don't know why the log on ns2 is using GMT.

----------

## hookooekoo

To add to my confusion.

If i reload the zone on the slave, it loads all the serials for all 19 zone files.  Then it sends notifies, but hangs on the 14th zone file, and I can't tell why.

----------

## kashani

In regards to the GMT stuff, check that you've set your timezone by ln -sf /etc/localtime to the proper zone. That's the usual mistake... or at least the one I tend to make.  :Smile: 

I think there is something odd about your setup. I don't see any notifies from my slave servers to the master. Can you post your new slave config and a copy of one of your zone file?

kashani

----------

## hookooekoo

Sure,

I wondered about the whole slave sending notify, that didn't seem right.  But for the life of me I don't see anything wrong in my named.conf, etc.

Slave named.conf

```

options {

        directory "/var/bind";

        // uncomment the following lines to turn on DNS forwarding,

        // and change the forwarding ip address(es) :

        //forward first;

        //forwarders {

        //      123.123.123.123;

        //      123.123.123.123;

        //};

        listen-on-v6 { none; };

        listen-on { 127.0.0.1; };

        // to allow only specific hosts to use the DNS server:

        //allow-query {

        //      127.0.0.1;

        //};

        // if you have problems and are behind a firewall:

        //query-source address * port 53;

        pid-file "/var/run/named/named.pid";

};

zone "xxx.com" IN {

        type slave;

        file "/var/bind/sec/xxx.com.zone";

        masters { 

                10.0.0.2; };

};
```

Here is the zone from Master

```

$TTL 86400

@       IN      SOA     ns2.xxx.com.      chris.xxx.com. (

                        2005090705      ; serial number YYMMDDNN

                        28800           ; Refresh

                        7200            ; Retry

                        864000          ; Expire

                        86400           ; Min TTL

                        )

                NS      ns2.xxx.com. 

                NS      ns3.xxx.com. 

                MX      10 mail.xxx.com.

                MX      20 mail2.xxx.com.

; SPF record

xxx.com.   IN      TXT             "v=spf1 ip4:0/27 ip4:0/27 ~all"

$ORIGIN xxx.com.

                        A               0.0.0.0

                        A               0.0.0.0

ftp                     A              0.0.0.0

```

And the file that gets xferred.

```

$ORIGIN .

$TTL 86400      ; 1 day

xxx.com            IN SOA  ns2.xxx.com. chris.xxx.com. (

                                2005090705 ; serial

                                28800      ; refresh (8 hours)

                                7200       ; retry (2 hours)

                                864000     ; expire (1 week 3 days)

                                86400      ; minimum (1 day)

                                )

                        NS      ns2.xxx.com.

                        NS      ns3.xxx.com.

                        A       0.0.0.0

                        A       0.0.0.0

                        MX      10 mail.xxx.com.

                        MX      20 mail2.x.com.

                        TXT     "v=spf1 ip4:0.0.0.0/27 ip4:0.0.0.0/27 ~all"

$ORIGIN xxx.com.

admin                   A       0.0.0.0

                            A       0.0.0.0
```

----------

## kashani

Assuming your master server is ns2 that looks pretty normal. About the only thing that looks off is the zone file name in the conf file. IIRC when you use "@ IN SOA" it's best for the file name of the zone to be the domain name itself. You may want to try changing the file name or using "xxx.com. IN SOA". I can't find a reference to the file name SOA thing so I might be totally off on it. In either case it'll either help or do nothing.

kashani

----------

## hookooekoo

That is what the slave creates, the master is as you say.

Where are the log files created for named?

Wiki says /var/named/conf/logging.conf.  It is not in the chroot of this path and I can not find it.

----------

## hookooekoo

I got it working.

Thanks for the help.

I am not sure I can explain why it is working now, but it is  :Very Happy: 

----------

## kashani

Normally named will log to /var/log/message in Gentoo. I'd suggest breaking out the named logs into it's own set of files. There's an article on the wiki that has a good logging config. I'm not sure how it'll deal with the chroot, but you can probably change the paths on create var/log/named/ in the chroot.

http://gentoo-wiki.com/HOWTO_Setup_a_DNS_Server_with_BIND

kashani

----------

