DNS服务

实验一:搭建DNS服务器

tarena.com

www.tarena.com192.168.10.11

bbs.tarena.com192.168.10.12

  blogbbs别名

1、 安装软件包

yum  配置完成

[root@localhost ~]# rpm -q bind bind-chroot caching-nameserver

package bind is not installed

package bind-chroot is not installed

package caching-nameserver is not installed

[root@localhostServer]#yum�Cy  install

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

rpmbind-chroot-9.3.6-20.P1.el5_8.5.x86_64.rpm caching-nameserver-9.3.6-20.P1.el5_8.5.x86_64.rpm

2、 修改主配置文件

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

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

[root@localhost etc]# vim named.conf

..

15         listen-on port 53 { 192.168.55.254; };

……

27         allow-query     { any; };

28         allow-query-cache { any; };

……

37         match-clients      { any; };

38         match-destinations { any; };

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

……

zone "tarena.com" IN {                     //定义正向区域

        type master;

        file "tarena.com.zone";

};

zone "55.168.192.in-addr.arpa" IN {          //定义反向区域

        type master;

         file "tarena.com.arpa";

};

[root@localhost etc]# named-checkconf named.conf     //检测语法  无输出,无错误

3、 修改数据库文件

[root@localhost named]# cp named.local tarena.com.zone

[root@localhost named]# cp named.local tarena.com.arpa

[root@localhost named]# vim tarena.com.zone

$TTL    86400

@       IN      SOA     localhost. root.localhost.  (

                                     1997022700 ; Serial

                                     28800      ; Refresh

                                     14400      ; Retry

                                     3600000    ; Expire

                                     86400 )    ; Minimum

       IN      NS      dns1.tarena.com.

dns1    IN      A      192.168.55.254

www   IN    A      192.168.55.253

bbs     IN      A      192.168.55.252

blog    IN     CNAME   bbs

[root@localhost named]# vim tarena.com.arpa

$TTL    86400

@       IN      SOA     localhost. root.localhost.  (

                                     1997022700 ; Serial

                                     28800      ; Refresh

                                     14400      ; Retry

                                     3600000    ; Expire

                                     86400 )    ; Minimum

       IN      NS     dhs1.tarena.com.

254     IN      PTR     dns1.tarena.com.

253     IN      PTR      www.tarena.com.

252     IN      PTR      bbs.tarena.com.

[root@localhostnamed]#named-checkzonetarena.com tarena.com.zone

zone tarena.com/IN: loaded serial 1997022700

OK

[root@localhostnamed]#named-checkzonetarena.com tarena.com.arpa

zone tarena.com/IN: loaded serial 1997022700

OK

4、 启动服务

[root@localhost named]# service named restart

[root@localhost named]# chkconfig named on

5、 客户机测试

nslookup

实验二:

       访问www.tarena.com时三分之二访问的地址是192.168.55.254,三分之一访问的是192.168.55.110,用户只要输入对的域名tarena.com就可以访问,用户只输入域名tarena.com也可以访问

1、 修改数据库文件

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

[root@localhost named]# vim tarena.com.zone

       IN      NS     dns1.tarena.com.

dns1    IN      A       192.168.55.254

www   IN     A        192.168.55.253

www    IN     A        192.168.55.253

www    IN     A        192.168.55.110

bbs     IN     A        192.168.55.252

blog    IN   CNAME      bbs

tarena.com IN A         192.168.55.110

//只要输对域名就可以访问

*          IN   A        192.168.55.110

//只输入域名也可以访问

$GENERATE  20-50  station$ IN A 192.168.55.$

2、 在另一台PC上安装httpd

[root@localhostslaves]#scp192.168.55.254:/etc/yum.repos.d/server.repo /etc/yum.repos.d/                               //yum

[root@localhost slaves]# yum -y install httpd

[root@localhost slaves]# vim /var/www/html/index.html

<html>

<head><title>this is www.tarena.com</title>

</head>

<body>

<h1>www.tarena.com</h1>

<hr></hr>

cocour=pink

welcome

</body>

</html>

3、 启动服务

[root@localhost slaves]# service httpd restart

[root@localhost named]# chkconfig  httpdon

[root@localhost named]# service named restart

[root@localhost named]# chkconfig named on

4、 客户端测试

host

浏览器输入tarena.com

实验三:搭建从DNS服务器

      给上面的主DNS搭建一个辅助DNS

1、安装软件包

[root@localhost ~]# rpm -q bind bind-chroot caching-nameserver

package bind is not installed

package bind-chroot is not installed

package caching-nameserver is not installed

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

2、修改从DNS的主配置文件

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

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

[root@localhost etc]# vim named.conf

...

15         listen-on port 53 { 192.168.55.254; };

...

27         allow-query     { any; };

28         allow-query-cache { any; };

...

37         match-clients      { any; };

38         match-destinations { any; };

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

...

51 zone "tarena.com" IN {

52         type slave;

53         file "slaves/tarena.com.zone";

54         masters { 192.168.55.110; };

55 };

56

57 zone "10.168.192.in-addr.arpa" IN {

58         type slave;

59         file "slaves/tarena.com.arpa";

60         masters { 192.168.55.110; };

61 };

[root@ser2 etc]# named-checkconf named.conf

3、修改主DNS的主配置文件,添加授权信息

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

[root@localhost etc]# vim named.conf    //添加21行内容

...

21         allow-transfer { 192.168.55.110; };

...

[root@localhost etc]# service named restart

4、启动从DNS服务器并验证

[root@localhost etc]# service named restart

[root@localhost etc]# chkconfig named on

[root@localhost etc]# ls /var/named/chroot/var/named/slaves/

tarena.com.zone tarena.com.arpa


你可能感兴趣的:(yum,dns,授权,辅助)