DNS域名服务基础
实验目标
DNS域名服务基础
实验01:快速搭建一台DNS服务器
提供解析记录:
svr5.tarena.com --> 192.168.4.5
svr6.tarena.com --> 192.168.4.6
pc205.tarena.com --> 192.168.4.205
win7station.tarena.com -->192.168.4.110
实验步骤
服务器安装 bind、bind-chroot
[root@svr5~]# yum -y install bind bind-chroot
Loaded plugins:product-id, refresh-packagekit, security, subscription-manager
This system isnot registered to Red Hat Subscription Management. You can usesubscription-manager to register.
Repositoryrhel-source-beta is listed more than once in the configuration
Setting upInstall Process
Package32:bind-9.8.2-0.17.rc1.el6_4.6.x86_64 already installed and latest version
Package32:bind-chroot-9.8.2-0.17.rc1.el6_4.6.x86_64 already installed and latestversion
Nothing to do
You have new mailin /var/spool/mail/root
配置服务器的 named.conf
[root@svr5~]# mv /etc/named.conf /etc/named.conf.origin
[root@svr5~]# cd /var/named/chroot/etc/
[root@svr5etc]# vim named.conf
options{
directory "/var/named";
};
zone"tarena.com" IN{
type master;
file "tarena.com.zone";
};
配置解析数据库(区域文件)
[root@svr5~]# cd /var/named/chroot/var/named/
[root@svr5named]# vim tarena.com.zone
$TTL 86400
@ IN SOA tarena.com. root.tarena.com. (
2014091601 ;更新序列号
4H ;刷新时间
15M ;重试间隔
4H ;超时时间
1D ;无效记录的生存时间
)
@ IN NS svr5.tarena.com. ;本区域DNS服务器的主机名
svr5 IN A 192.168.4.5 ;本区域DNS服务器的IP地址
svr6 IN A 192.168.4.6 ;其他解析记录。。。
pc205 IN A 192.168.4.205
win7station IN A 192.168.4.110
[root@svr5named]# service named restart
停止 named:. [确定]
启动 named: [确定]
[root@svr5named]# netstat -anptu | grep named
tcp 0 0 192.168.4.5:53 0.0.0.0:* LISTEN 28422/named
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 28422/named
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 28422/named
tcp 0 0 ::1:953 :::* LISTEN 28422/named
udp 0 0 192.168.4.5:53 0.0.0.0:* 28422/named
udp 0 0 127.0.0.1:53 0.0.0.0:* 28422/named
客户机测试
[root@pc205桌面]# vim /etc/resolv.conf
...................
searchtarena.com
nameserver192.168.4.5
.......................
[root@pc205桌面]# host svr5.tarena.com
svr5.tarena.comhas address 192.168.4.5
[root@pc205桌面]# host win7station.tarena.com
win7station.tarena.comhas address 192.168.4.110
实验02:新增DNS区域 baidu.com
修改主配置,添加一个zone区域
[root@svr5named]# cd /var/named/chroot/etc/
You have new mailin /var/spool/mail/root
[root@svr5etc]# vim named.conf
................
zone"baidu.com" IN{
type master;
file "baidu.com.zone";
};
为新增的 baidu.com区域建立一个数据文件
[root@svr5~]# cd /var/named/chroot/var/named/
[root@svr5named]# cp tarena.com.zone baidu.com.zong
[root@svr5named]# vim baidu.com.zone
$TTL 86400
@ IN SOA baidu.com. root.baidu.com. (
2014091601 ;更新序列号
4H ;刷新时间
15M ;重试间隔
4H ;超时时间
1D ;无效记录的生存时间
)
@ IN NS svr5.tarena.com. ;本区域DNS服务器的主机名
@ IN A 192.168.4.5 ;本区域DNS服务器的IP地址
www IN A 192.168.4.6 ;其他解析记录。。。
music IN A 192.168.4.205
重启 named 服务
[root@svr5named]# cd ~
[root@svr5~]# service named restart
停止 named:. [确定]
启动 named: [确定]
客户机测试
[root@pc205桌面]# host baidu.com
baidu.com hasaddress 192.168.4.5
[root@pc205桌面]# host www.baidu.com
www.baidu.com hasaddress 192.168.4.6
[root@pc205桌面]# host music.baidu.com
music.baidu.comhas address 192.168.4.205