Centos7 DNS主從同步

Centos7 DNS主從同步linux

操做環境:
Centos7系統兩臺
主DNS: 192.168.80.100
從DNS: 192.168.80.101服務器

一、關閉防火牆和SElinux(兩臺虛擬機都要關閉)
systemctl stop firewalld
setenforce 0ide

二、使用YUM安裝ntp時間同步服務(兩臺虛擬機都要安裝)
yum install ntp -y
Centos7 DNS主從同步rest

三、配置ntp服務
vi /etc/ntp.conf
提示:在配置文件中添加如下內容code

restrict 192.168.80.0 mask 255.255.255.0 nomodify notrap 
server 127.127.1.0
fudge 127.127.1.0 stratum 8

Centos7 DNS主從同步

四、實現主從時間同步
systemctl start ntpd --啓動時間同步服務
提示:從服務區器的時間同步服務不要啓動,在從服務器上同步時間
ntpdate 192.168.80.100
Centos7 DNS主從同步
Centos7 DNS主從同步server

五、使用YUM安裝DNS服務(兩臺虛擬機都要安裝)
yum install bind -y
Centos7 DNS主從同步blog

六、主服務器修改DNS配置文件
在主服務器上操做:
vi /etc/named.conf
修改如下內容:dns

listen-on port 53 { any; };
allow-query     { any; };

vi /etc/named.rfc1912.zones
提示:在末尾添如下內容同步

zone "hello.com" IN {                           
        type master;
        file "hello.com.zone";
        allow-update { 192.168.80.101; };
        also-notify { 192.168.80.101; };
};

zone "80.168.192.in-addr.arpa" IN {
        type master;
        file "hello.com.local";
        allow-update { 192.168.80.101; };
        also-notify { 192.168.80.101; };
};

cd /var/named虛擬機

cp -p named.localhost hello.com.zone --複製一個配置文件模板
vi hello.com.zone

$TTL 1D
@       IN SOA  hello.com. 18013882536.qq.com (
                                        1       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      dns.hello.com.
dns     IN A    192.168.80.100
www     IN A    192.168.80.101
ftp     IN A    192.168.80.102

cp -p hello.com.zone hello.com.local
vi hello.com.local

named-checkconf --檢查配置文件語法錯誤

systemctl start named --啓動服務

netstat -anpt | grep named
Centos7 DNS主從同步

七、從服務器修改配置文件
vi /etc/named.conf
修改如下內容:

listen-on port 53 { any; };
allow-query     { any; };

vi /etc/named.rfc1912.zones

zone "hello.com" IN {
        type slave;
        masters { 192.168.80.100; };
        file "slaves/hello.com.zone";
};
zone "80.168.192.in-addr.arpa" IN {
        type slave;
        masters { 192.168.80.100; };
        file "slaves/hello.com.local";
};

systemctl start named
Centos7 DNS主從同步
Centos7 DNS主從同步

相關文章
相關標籤/搜索