主服务器(Centos 7 192.168.100.175)
1、构建yum仓库,用yum安装bind
2、关闭防火墙
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# iptables -F
[root@localhost ~]# setenforce 0
3、添加本机的IP地址
[root@localhost ~]# vim /etc/resolv.conf
nameserver 192.168.100.175
nameserver 192.168.100.170
4、修改hosts文件,添加域名跟IP地址
[root@localhost ~]# vim /etc/hosts
192.168.100.175 ns1.crushlinux.com
192.168.100.170 ns2.crushlinux.com
5、修改配置文件/etc/named.conf
[root@localhost ~]# vim /etc/named.conf
directory "/var/named";
type master;
file "crushlinux.zheng";
allow-transfer {192.168.100.170;};
};
zone "100.168.192.in-addr.arpa" IN {
type master;
file "crushlinux.fan";
allow-transfer {192.168.100.170;};
6、在/var/named/创建crushlinux.zheng
[root@localhost ~]# vim /var/named/crushlinux.zheng
$TTL 86400
@ IN SOA crushlinux.com. admin.crushlinux.com. (
20190817
3H
15M
1W
1D
)
IN NS ns1.crushlinux.com.
IN NS ns2.crushlinux.com.
IN MX 10 mail.crushlinux.com.
ns1 IN A 192.168.100.175
ns2 IN A 192.168.100.170
mail IN A 192.168.100.171
www IN A 192.168.100.172
study IN A 192.168.100.173
* IN A 192.168.100.175
ftp IN CNAME www
7、在/var/named/创建crushlinux.fan并进行编辑
[root@localhost ~]# vim /var/named/crushlinux.fan
$TTL 86400
@ IN SOA crushlinux.com. admin.crushlinux.com.(
20190817
3H
15M
1W
1D
)
IN NS ns1.crushlinux.com.
IN NS ns2.crushlinux.com.
IN MX 10 mail.crushlinux.com.
175 IN PTR ns1.crushlinux.com.
170 IN PTR ns2.crushlinux.com.
171 IN PTR mail.crushlinux.com.
172 IN PTR www.crushlinux.com.
173 IN PTR study.crushlinux.com.
175 IN PTR ns1.crushlinux.com.
8、更改文件的权限
[root@localhost ~]# chown :named /var/named/crushlinux.*
9、查看主配置文件是否正确
[root@localhost ~]# named-checkconf -z /etc/named.conf
zone crushlinux.com/IN: loaded serial 20190817
zone 100.168.192.in-addr.arpa/IN: loaded serial 20190817
10、查看正反区域数据文件是否正确
[root@localhost ~]# named-checkzone crushlinux.com /var/named/crushlinux.zheng
[root@localhost ~]# named-checkzone crushlinux.com /var/named/crushlinux.fan
11、重启服务,查看服务状态
[root@localhost ~]# systemctl restart named
[root@localhost ~]# systemctl status named
从服务器(Centos 6 192.168.100.170)
1、创建目录,挂载镜像
[root@localhost ~]# mkdir /media/cdrom
[root@localhost ~]# mount /dev/cdrom /media/cdrom
2、安装bind服务
[root@localhost ~]# rpm -ivh /media/cdrom/Packages/bind-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm
3、从主服务器复制文件到从服务器
[root@localhost ~]# scp /etc/named.conf 192.168.100.170:/etc/
3、
[root@localhost ~]# service iptables stop
[root@localhost ~]# service iptables status
4、修改配置文件
[root@localhost ~]# cat /etc/resolv.conf
nameserver 192.168.100.175
nameserver 192.168.100.170
[root@localhost ~]# vim /etc/hosts
192.168.100.175 ns1.crushlinux.com
192.168.100.170 ns2.crushlinux.com
[root@localhost ~]# vim /etc/named.conf
directory "/var/named";
type slave;
file "slaves/crushlinux.zheng";
masters { 192.168.100.175; };
};
zone "100.168.192.in-addr.arpa" IN {
type slave;
file "slaves/crushlinux.fan";
masters { 192.168.100.175; };