实验要求:
搭建主DNS服务器,,搭建从DNS服务器同步主DNS的数据
一.搭建主DNS服务器
1.安装软件包
[root@server ~]# yum -y install bind bind-chroot
2.修改主配置文件
[root@server ~]# vim /etc/named.conf
……
listen-on port 53 { 192.168.100.1; };
……
allow-query { any; };
……
allow-transfer { 192.168.100.2; }; //从DNS服务器地址
……
zone "jinjianjun.com" IN {
type master;
file "jinjianjun.com.zone";
};
zone "100.168.192.in-addr.arpa" IN {
type master;
file "192.168.100.arpa";
};
……
3.修改数据库文件
[root@server ~]# vim /var/named/jinjianjun.com.zone
$TTL 3H
@ IN SOA jinjianjun.com. root.jinjianjun.com. (
2014042101; serial
1D; refresh
1H; retry
1W; expire
3H ); minimum
NS dns1.jinjianjun.com.
MX 10 mail.jinjianjun.com.
IN A 192.168.100.1
dns1 IN A 192.168.100.1
www IN A 192.168.100.1
mail IN A 192.168.100.2
ftp IN CNAME mail //别名
* IN A 192.168.100.2 //泛域名解析
[root@server ~]# vim /var/named/192.168.100.arpa
$TTL 3H
@ IN SOA jinjianjun.com. root.jinjianjun.com. (
2014042101; serial
1D; refresh
1H; retry
1W; expire
3H ); minimum
NS dns1.jinjianjun.com.
MX 10 mail.jinjianjun.com.
1 IN PTR dns1.jinjianjun.com.
1 IN PTR www.jinjianjun.com.
2 IN PTR mail.jinjianjun.com.
2 IN PTR ftp.jinjianjun.com.
4.启动服务
[root@server named]# service named start
[root@server named]# chkconfig named on
二.搭建从DNS服务器
1.安装软件包
[root@client ~]# yum -y install bind bind-chroot
2.修改主配置文件
[root@client ~]# vim /etc/named.conf
……
zone "jinjianjun.com" IN {
type slave;
file "slaves/jinjianjun.com.zone"; //从DNS数据库正向解析文件位置
masters { 192.168.100.1; };
};
zone "100.168.192.in-addr.arpa" IN {
type slave;
file "slaves/192.168.100.arpa"; //从DNS数据库反向解析文件位置
masters { 192.168.100.1; };
};
……
3.启动服务并验证
[root@server ~]# service named start
[root@server ~]# chkconfig named on
[root@client ~]# cd /var/named/slaves/
[root@client slaves]# ls
192.168.100.arpa jinjianjun.com.zone //同步成功
4.客户端测试
先指定DNS服务器地址,再测试