Deploy DNS master-slave replication, zone transfer

Environmental Science:
Main server ip: 10.254.12.238
Secondary server ip: 10.254.10.161

There are two conditions for decision-making:
   1. Authorize to the secondary server
     2. NS, A or PTR are configured in the zone file of the primary server

Simple and rough installation of bind for both devices
    `yum install bind -y`

Configure primary server

Modify the master profile of the master server:

~]# vim /etc/named.conf
listen-on port 53 { any; };
allow-query     { any; };
masterfile-format text;           If the secondary server is not configured, the files that cannot be accessed will be scrambled;

--------------------------------------The above part is in options Configured inside;

zone "songhe.com." IN {
    type master;
    file "songhe.com.zone";
    allow-transfer { 10.254.12.161; };
        notify yes;       ----Initially configured at options It's found that it doesn't work. It can be configured here;
};     

To create and configure a zone resolution library file for the primary server:

~]# touch songhe.com.zone
~]# chmod 640 songhe.com.zone 
~]# chown root:named songhe.com.zone
~]# ll songhe.com.zone 
-rw-r----- 1 root named 335 1 Month 815:43 songhe.com.zone
~]#
~]#
~]# vi songhe.com.zone
$TTL 600
@ IN SOA ns1.songhe.com. mail.songhe.com. (
            20190107;
            2H;
            10M;
             3W;
            1D;
)

           IN   NS   ns1
           IN   NS   ns2
           IN   A    10.254.12.238
ns1        IN   A    10.254.12.238
ns2        IN   A    10.254.12.238
www        IN   A    10.254.12.161

Because I am a virtual machine, I need to configure / etc/resolv.conf as the local ip,

~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 10.254.12.238

Configure secondary server

Modify the primary profile of the secondary server:

  listen-on port 53 { any; };
    allow-query     { any; };
    masterfile-format text;
--------------------------------------The above part is in options Configured inside;

zone "songhe.com." IN {
    type slave;
    file "slaves/songhe.com.zone";
    masters { 10.254.12.238; };
};     

Because the zone files are synchronized from the primary server, there is no need to configure them separately.

It is also necessary to change the ip address of / etc/resolv.conf as the main server.

Remember to use named checkconf and named checkzone to check the configuration file for syntax errors.
Then systemctl start named starts the bind service to see if the zone file of the master server already exists in the slave server.

If the area is not synchronized, the firewall may not be turned off, or the slave server may not be configured with NS record A record on the master server. The time of the two servers is synchronized!!!

Log observation synchronization information process:

The process of the first zone transfer is called full zone transfer (axfr)
Every subsequent area transfer is called incremental area transfer (ixfr)

Tags: Linux yum vim firewall

Posted on Sun, 01 Dec 2019 09:10:41 -0800 by kusal