实验一

实验名称:搭建从dns服务器

步骤1:基本环境

两台dns服务器,一主一从,一台客户机做测试同一网段能够ping

步骤2:安装软件包

由于我的主dns服务器已经打好了,参考上一实验,这里直接开始搭建从dns服务器,首先安装软件包

[root@localhost ~]# yum -y install  bind bind-chroot caching-nameserver

Installed:

bind.x86_64 30:9.3.6-20.P1.el5_8.5                                            

bind-chroot.x86_64 30:9.3.6-20.P1.el5_8.5                                    

caching-nameserver.x86_64 30:9.3.6-20.P1.el5_8.5            


Complete!

步骤2:改主配置文件

[root@localhost ~]# cd  /var/named/chroot/etc/

[root@localhost etc]# ls

localtime named.caching-nameserver.conf named.rfc1912.zones  rndc.key

[root@localhost etc]# cp -pnamed.caching-nameserver.conf named.conf

[root@localhost etc]# vim named.conf


作如下配置

options {

      listen-on port 53 { 192.168.4.252; };

27        allow-query     { any; };

28        allow-query-cache { any; };

36view localhost_resolver {

37        match-clients      { any; };

38        match-destinations { any; };

存退进入include所调用的主配置文件

做如下配置

zone "tarena.com" IN {

      type slave;

      file "slaves/tarena.com.zone";

      masters { 192.168.4.253; };

};

zone "4.168.192.in-addr.arpa" IN{

      type slave;

      file "slaves/tarena.com.arpa";

      masters { 192.168.4.253; };

};

语法检测没有问题

[root@localhost etc]# vim named.rfc1912.zones

[root@localhost etc]# named-checkconfnamed.conf

[root@localhost etc]#

进入下一步,修改主dns配置文件,为从dns服务器添加授权信息

[root@dc ~]# cd /var/named/chroot/etc/

[root@dc etc]# vim named.conf

21        allow-transfer { 192.168.4.252; };

步骤3:测试

存退重启服务

启动从dns服务,验证之

[root@localhost named]# cd slaves/

[root@localhost slaves]# ls

tarena.com.arpa  tarena.com.zone

[root@localhost slaves]# vimtarena.com.zone

[root@localhost slaves]# cattarena.com.zone

$ORIGIN .

$TTL 86400      ; 1 day

tarena.com              IN SOA  tarena.com. root.tarena.com. (

                               2014041802 ;serial

                               28800      ; refresh (8 hours)

                               14400      ; retry (4 hours)

                               3600000    ; expire (5 weeks 6 days 16 hours)

                               86400      ; minimum (1 day)

                               )

                       NS      dns1tarena.com.

                       A       192.168.4.253

$ORIGIN tarena.com.

bbs                     A       192.168.4.5

bss                     A       192.168.4.6

dns1                   A       192.168.4.253

www                     A       192.168.4.252

                       A       192.168.4.253

[root@localhost slaves]#

验证发现dns数据库信息已经更新过来了,,

客户端测试没有问题

实验结束


实验二:dns的负载均衡和泛域名解析如下图配置

9 dns1      IN      A     192.168.4.253

10tarena.com.       IN      A    192.168.4.253

11www        IN      A    192.168.4.253

12www        IN      A    192.168.4.252

13bbs        IN      A    192.168.4.5

14bss        IN      A    192.168.4.6

15*          IN      A    192.168.4.253

10行和11行为负载均衡设置

15行为泛域名解析

同时dns还可以为指定主机分配指定IP,见一个实验