Linux网络服务之DNS(2)
Linux网络服务之DNS(2)
实验要求:
1、搭建父DNS(zhy.com)服务器,www.zhy.com --> 192.168.1.253
2、搭建子DNS(bj.zhy.com)服务器,www.bj.zhy.com --> 192.168.1.252
3、在父DNS服务器上配置子域授权
实验步骤:
1、搭建父DNS服务器
(1)安装软件包
略……
(2)修改主配置文件
[root@localhost ~]# cd /var/named/chroot/etc/
[root@localhost etc]# cat named.conf
options {
listen-on port 53 { 192.168.1.253; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
allow-query-cache { any; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
match-clients { any; };
match-destinations { any; };
recursion yes;
include "/etc/named.rfc1912.zones";
};
[root@localhost etc]# vim named.rfc1912.zones
……
zone "zhy.com" IN {
type master;
file "zhy.com.zone";
};
……
(3)修改解析文件
[root@localhost named]# cd /var/named/chroot/var/named/
[root@localhost named]# vim zhy.com.zone
$TTL 86400
@ IN SOA zhy.com. root.zhy.com. (
2014050201 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS dns1.zhy.com.
bj.zhy.com. IN NS dns1.bj.zhy.com. //指明子域dns
dns1.bj.zhy.com. IN A 192.168.1.252 //解析子域dns服务器地址
dns1 IN A 192.168.1.253
www IN A 192.168.1.253
2、搭建子DNS服务器
(1)安装软件包
略……
(2)修改主配置文件
[root@localhost ~]# cd /var/named/chroot/etc/
[root@localhost etc]# cat named.conf
……
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
allow-query-cache { any; };
forwarders { 192.168.1.253; };//可以向父域查询
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
match-clients { any; };
match-destinations { any; };
recursion yes;
include "/etc/named.rfc1912.zones";
};
[root@localhost etc]# cat named.rfc1912.zones
……
zone "bj.zhy.com" IN {
type master;
file "bj.zhy.com.zone";
};
(3)修改解析文件
[root@localhost named]# cat bj.zhy.com.zone
$TTL 86400
@ IN SOA bj.zhy.com. root.bj.zhy.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS dns1.bj.zhy.com.
252 IN A 192.168.1.252
www IN A 192.168.1.252
3、重启服务,设置服务开机自启
[root@localhost etc]# service named restart
停止 named: [确定]
启动 named: [确定]
[root@localhost etc]# chkconfig named on
4、验证
本文出自 “烟头网管” 博客,请务必保留此出处http://8838848.blog.51cto.com/8828848/1405789