Linux DNS服务实验报告
来源:岁月联盟
时间:2011-10-17
DNS实验报告
--杨冬
1. 实验的环境
服务器:Red Hat Enterprise Linux 5.3 (ip:192.168.0.20)
Red Hat Enterprise Linux 5.3 (ip:192.168.0.30)
客户端:Windows XP (ip:192.168.0.1)
2. 实验前期准备
注:主、副都要安装以下软件包。
yum install –y bind caching-nameserver
或
rpm -ihv /media/Server/bind-9.3.4-10.P1.el5.i386.rpm
rpm -ihv /media/Server/caching-nameserver-9.3.4-10.P1.el5.i386.rpm
3. 实验目标一:实现简单的正、反DNS解析.
配置正向解析与反向解析.
① vim /etc/named.caching-nameserver.conf
修改1:listen-on port 53 { 192.168.0.20; };//侦听端口的本机ip地址
修改2://listen-on-v6 port 53 { ::1; };
修改3://allow-query { localhost; }; //永许哪些客户端访问DNS服务
修改4://match-clients { localhost; };
修改5://match-destinations { localhost; };
② vim /etc/named.rfc1912.zones
在结尾处添加:
zone "yangdong.com" IN {
type master;
file "yangdong.zone";
// allow-update { none; };
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "yangdong.local";
// allow-update { none; };
};
③ cd /var/named
cp -rf localhost.zone yangdong.zone
cp -rf named.local yangdong.local
chown named:named yangdong.local yangdong.zone
④ 配置正向配置文件:
vim yangdong.zone
配置文件内容:
$TTL 86400
@ IN SOA yangdong.com. root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS yangdong.com.
IN A 192.168.0.20
www IN A 192.168.0.21
wap IN A 192.168.0.22
⑤ 配置反向配置文件:
vim yangdong.local
配置文件内容:
$TTL 86400
@ IN SOA yangdong.com. root.yangdong.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS yangdong.com.
20 IN PTR yangdong.com.
21 IN PTR www.yangdong.com.
22 IN PTR wap.yangdong.com.
⑥ vim /etc/resolv.conf
nameserver 192.168.0.20
service network restart
⑦ service named restart
⑧ [root@hello named]# host www.yangdong.com
⑨ www.yangdong.com has address 192.168.0.21
⑩ [root@hello named]# host 192.168.0.22
22.0.168.192.in-addr.arpa domain name pointer wap.yangdong.com.