一.实验工作原理
1.关闭防火墙
2.关闭seLinux机制
3.挂载光盘
4.构建yum仓库
5.安装bind,bind-utils,bind-libs,bind-chroot
6.主域名服务器配置
1)全局配置
2)建立正向解析域
3)建立反向解析域
7.建立正向区域文件
8.建立反向区域文件
9.启动从域名服务器
10.DNS服务器测试
二.操作步骤
service iptables stop
chkconfig iptables off
setenforce 0
sed -i '7 s/enforcing/disabled/'/etc/selinux/config
mkdir -p /media/cdrom/
mount /dev/sr0 /media/cdrom/
cd /etc/yum.r*/
mkdir yun/
mv C* yun/
cp yun/*M* ./
sed -i '20 s/0/1/' C*
yum -y install all
cd
yum makecache
[root@yunduo ~]# rpm -qa |grep bind
samba-winbind-clients-3.6.9-164.el6.x86_64 bind-utils-9.8.2-0.17.rc1.el6_4.6.x86_64
samba-winbind-3.6.9-164.el6.x86_64 PackageKit-device-rebind-0.5.8-21.el6.x86_64
rpcbind-0.2.0-11.el6.x86_64 bind-libs-9.8.2-0.17.rc1.el6_4.6.x86_64
ypbind-1.20.4-30.el6.x86_64
[root@yunduo ~]# umount /dev/sr0
[root@yunduo ~]# mount /dev/sr0/media/cdrom/
mount: block device /dev/sr0 iswrite-protected, mounting read-only
[root@yunduo ~]# yum -y install bindbind-chroot
Loaded plugins: fastestmirror,refresh-packagekit, security
Loading mirror speeds from cached hostfile......
Installing:32:bind-9.8.2-0.17.rc1.el6_4.6.x86_64 1/2
Installing:32:bind-chroot-9.8.2-0.17.rc1.el6_4.6.x86_64 2/2
Verifying:32:bind-9.8.2-0.17.rc1.el6_4.6.x86_64 1/2
Verifying:32:bind-chroot-9.8.2-0.17.rc1.el6_4.6.x86_64 2/2
Installed: bind.x86_6432:9.8.2-0.17.rc1.el6_4.6 bind-chroot.x86_64 32:9.8.2-0.17.rc1.el6_4.6
Complete!
[root@yunduo ~]# rpm -qa |grep -w bind
bind-utils-9.8.2-0.17.rc1.el6_4.6.x86_64
bind-libs-9.8.2-0.17.rc1.el6_4.6.x86_64
bind-9.8.2-0.17.rc1.el6_4.6.x86_64
bind-chroot-9.8.2-0.17.rc1.el6_4.6.x86_64
[root@yunduo ~]# cd /etc/
[root@yunduo etc]# vim named.conf
[root@yunduo etc]# mv named.conf named.conf.bak
[root@yunduo etc]# vim named.conf
options { (全局配置)
directory "/var/named";
};
zone benet.com IN { (建立正向解析域--本地域)
type master;
file "benet.com.zone";
};
zone 16.168.192.in-addr.arpa IN { (建立反向解析域)
type master;
file "192.168.16.arpa";
};
[root@yunduo etc]# cd /var/named
[root@yunduo named]# vim benet.com.zone (建立正向区域文件)
$TTL 1D
@ IN SOA benet.com. root.benet.com. (
2017121501
3H
15M
1W
1D )
@ IN NS ns1.benet.com.
ns1 IN A 192.168.16.80
www IN A 192.168.16.88
[root@yunduo named]# vim 192.168.16.arpa (建立反向区域文件)
$TTL 1D
@ IN SOA benet.com. root.benet.com. (
2017121501
3H
15M
1W
1D )
@ IN NS ns1.benet.com.
80 IN PTR ns1.benet.com.
88 IN PTR www.benet.com.
(DNS服务器测试)
[root@yunduo named]# named-checkconf/etc/named.conf
[root@yunduo named]# named-checkzone16.168.192.in-addr.arpa 192.168.16.arpa
zone 16.168.192.in-addr.arpa/IN: loadedserial 2017121501
OK
[root@yunduo named]# service namedrestart (启动从域名服务器)
停止 named: [确定]
Generating /etc/rndc.key: [确定]
启动 named: [确定]
[root@yunduo named]# vim /etc/solv.conf
nameserver 192.168.16.80
nameserver 192.168.16.88
[root@yunduo named]# nslookup (DNS服务器测试)
> www.benet.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: www.benet.com
Address: 192.168.16.88
> ns1.benet.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: ns1.benet.com
Address: 192.168.16.80
> 192.168.16.88
Server: 127.0.0.1
Address: 127.0.0.1#53
88.16.168.192.in-addr.arpa name = www.benet.com.
> exit
You have mail in /var/spool/mail/root