配置主从dns域名解析服务器
主域名解析服务器(先安装软件包并关闭防火墙)
[root@localhost ~]# cat /etc/hosts /etc/resolv.conf //设置hosts和resolv.conf文件//
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.200.111 ns1.dou.com
192.168.200.112 ns2.dou.com
nameserver 192.168.200.111
nameserver 192.168.200.112
nameserver 202.106.0.20
=====修改主配置文件
[root@localhost ~]# cat /etc/named.conf
主域名解析服务器(先安装软件包并关闭防火墙)
[root@localhost ~]# cat /etc/hosts /etc/resolv.conf //设置hosts和resolv.conf文件//
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.200.111 ns1.dou.com
192.168.200.112 ns2.dou.com
nameserver 192.168.200.111
nameserver 192.168.200.112
nameserver 202.106.0.20
=====修改主配置文件
[root@localhost ~]# cat /etc/named.conf
options {
directory "/var/named";
directory "/var/named";
};
zone "dou.com" IN {
type master;
file "dou.zheng";
allow-transfer { 192.168.200.112; };
};
zone "200.168.192.in-addr.arpa" IN {
type master ;
file "dou.fan";
allow-transfer { 192.168.200.112; };
};
[root@localhost named]# cat dou.zheng 修改正向解析文件
$TTL 86400
@ IN SOA dou.com. mail.dou.com. (
20190826
1D
1H
1W
3H
)
NS ns1.dou.com.
NS ns2.dou.com.
ns1 A 192.168.200.111
ns2 A 192.168.200.112
www A 192.168.200.113
[root@localhost named]# cat dou.fan ///修改反向解析文件
$TTL 86400
@ IN SOA dou.com. mail.dou.com. (
20190826
1D
1H
1W
3H
)
NS ns1.dou.com.
NS ns2.dou.com.
111 PTR ns1.dou.com.
112 PTR ns2.dou.com.
113 PTR www.dou.com.
[root@localhost named]# systemctl start named 开启服务
==============================================
从域名解析服务器安装
复制主服务器配置文件到本机
[root@localhost ~]# scp 192.168.200.111:/etc/named.conf
/etc/named.conf
[email protected]'s password:
named.conf 100% 248 299.9KB/s 00:00
[root@localhost ~]#
[root@localhost ~]# vim /etc/named.conf
[root@localhost ~]# cat /etc/named.conf ///修改主配置文件
type master;
file "dou.zheng";
allow-transfer { 192.168.200.112; };
};
zone "200.168.192.in-addr.arpa" IN {
type master ;
file "dou.fan";
allow-transfer { 192.168.200.112; };
};
[root@localhost named]# cat dou.zheng 修改正向解析文件
$TTL 86400
@ IN SOA dou.com. mail.dou.com. (
20190826
1D
1H
1W
3H
)
NS ns1.dou.com.
NS ns2.dou.com.
ns1 A 192.168.200.111
ns2 A 192.168.200.112
www A 192.168.200.113
[root@localhost named]# cat dou.fan ///修改反向解析文件
$TTL 86400
@ IN SOA dou.com. mail.dou.com. (
20190826
1D
1H
1W
3H
)
NS ns1.dou.com.
NS ns2.dou.com.
111 PTR ns1.dou.com.
112 PTR ns2.dou.com.
113 PTR www.dou.com.
[root@localhost named]# systemctl start named 开启服务
==============================================
从域名解析服务器安装
复制主服务器配置文件到本机
[root@localhost ~]# scp 192.168.200.111:/etc/named.conf
/etc/named.conf
[email protected]'s password:
named.conf 100% 248 299.9KB/s 00:00
[root@localhost ~]#
[root@localhost ~]# vim /etc/named.conf
[root@localhost ~]# cat /etc/named.conf ///修改主配置文件
options {
directory "/var/named";
directory "/var/named";
};
zone "dou.com" IN {
type slave;
file "slaves/dou.zheng";
masters { 192.168.200.111; };
};
zone "200.168.192.in-addr.arpa" IN {
type slave ;
file "slave/dou.fan";
masters { 192.168.200.111; };
};
[root@localhost ~]# vim /etc/hosts //修改hosts文件
[root@localhost ~]# vim /etc/resolv.conf //修改resolv.conf文件
[root@localhost ~]# cat /etc/hosts /etc/resolv.conf
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.200.111 ns1.dou.com
192.168.200.112 ns2.dou.com
# Generated by NetworkManager
nameserver 192.168.200.111
nameserver 192.168.200.112
[root@localhost ~]# systemctl start named //开启
type slave;
file "slaves/dou.zheng";
masters { 192.168.200.111; };
};
zone "200.168.192.in-addr.arpa" IN {
type slave ;
file "slave/dou.fan";
masters { 192.168.200.111; };
};
[root@localhost ~]# vim /etc/hosts //修改hosts文件
[root@localhost ~]# vim /etc/resolv.conf //修改resolv.conf文件
[root@localhost ~]# cat /etc/hosts /etc/resolv.conf
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.200.111 ns1.dou.com
192.168.200.112 ns2.dou.com
# Generated by NetworkManager
nameserver 192.168.200.111
nameserver 192.168.200.112
[root@localhost ~]# systemctl start named //开启