一,需求
两台虚拟机centos7 (server) redhat6.7 ,搭建DNS服务器并进行测试
二,centos7(server)
1. 安装 # yum -y install bind
2. 查询 # rpm -qa | grep bind-chroot
3. 配置DNS主配置文件
# vim /etc/named.conf
options {
directory "/var/named";
};
zone "birdteam.net" IN {
type master;
file "birdteam.net.zone";
};
4. 配置ZONE区文件
# cp -p /var/named/named.localhost /var/named/birdteam.net.zone
# vim /var/named/birdteam.net.zone
birdteam.net. IN SOA birdteam.net. rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS birdteam.net.
A 192.168.1.1
5. 启动服务
# systemctl start named
二 客户端redhat6.7
6. 测试服务
# vim /etc/resolv.conf
nameserver 192.168.31.130
# nslookup birdteam.net
注意: 1. bind-chroot的作用,增强系统的安全性,一般对外的DNS服务器会安装
2. 在复制模板文件时,需要注意原文件的权限属性
3. 在区文件中@代表本机域名
4. 输入域名时需要加根域
5. 区文件中,SOA记录的前4项是针对从服务器
扩展:
(redhat6.7)客户端安装DNS,搭建好本地yum源:挂载光盘,使网络yum源失效,其他步骤和centos7一样
DNS主辅服务器同步
(1) options {
directory "/var/named";
};
zone "birdteam.net" IN {
type slave;
masters {
192.168.31.130;
};
file "slaves/birdteam.net.zone";
};
(2)重启服务器 service named start
(3)测试:在服务器端改两个值 1 serial; A 192.19.168.10 在客户端删除birdteam.net.zone文件,重启服务,就会在客户端看到系统又创建了birdteam.net.zone,并且内容和服务器一样
DNS转发服务器
1. 完全转发
options {
directory "/var/named";
forwarders {
192.168.31.130;
};
};
2. 条件转发
options {
directory "/var/named";
};
zone "birdteam.net" IN {
type forward;
forwarders {
192.168.31.130;
};
};
zone "7bu.top" IN {
type master;
file "7bu.top.zone";
};
阅读(789) | 评论(0) | 转发(0) |