免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1144 | 回复: 0
打印 上一主题 下一主题

RHEL5.0 搭建DNS服务器 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-04-29 13:56 |只看该作者 |倒序浏览
RHEL5.0 搭建DNS服务器
实验环境: VM 6.0 ,RHEL5.0, 本地YUM源
次环境是把MAIL ,WWW等服务器与DNS 服务器放在一起
-、先检查系统是安装了bind.rpm 与caching-nameserver.rpm包
[root@ser ~]# rpm -qa bind*  caching-*
bind-chroot-9.3.3-7.el5
bind-libs-9.3.3-7.el5
bind-9.3.3-7.el5
bind-libbind-devel-9.3.3-7.el5
bind-utils-9.3.3-7.el5
bind-devel-9.3.3-7.el5
caching-nameserver-9.3.3-7.el5
bind-sdb-9.3.3-7.el5
[root@ser ~]#
若没有,就安装这些包
[root@ser ~]# yum -y install bind* caching-*


二、配置dns的正向和反向解析文件
[root@ser ~]# cd /var/named/chroot/etc/
[root@ser etc]# ll
total 24
-rw-r--r-- 1 root root   165 Apr 29 19:42 localtime
-rw-r----- 1 root named 1100 Jan 17  2007 named.caching-nameserver.conf
-rw-r----- 1 root named  614 Apr 30 13:04 named.rfc1912.zones
-rw-r--r-- 1 root named  113 Apr 29 03:36 rndc.key
[root@ser etc]# cp -p named-caching-nameserver.conf  naemed.conf
[root@ser etc]# vim named.rfc1912.zones

// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
zone "." IN {
        type hint;
        file "named.ca";
};

zone "yjw.com" IN {
        type master;
        file "yjw.com.zone";
        allow-update { none; };
};


zone "1.168.192.in-addr.arpa" IN {
        type master;
        file "192.168.1.local";
       allow-update {none;};

};
[root@ser etc]# vim named.conf
//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver package to configure the
// ISC BIND named(8) DNS server as a caching only nameserver
// (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
//
options {
        listen-on port 53 { any; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        query-source    port 53;
        query-source-v6 port 53;
        allow-query     { any; };
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
view localhost_resolver {
        match-clients      { any; };
        match-destinations { any; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};
       # 红色为修改部分

[root@ser etc]# cd ../var/named/
[root@ser etc]# cd ../var/named/
[root@ser named]# ll
total 44
drwxrwx--- 2 named named 4096 Apr 30 13:21 data
-rw-r----- 1 root  named  198 Jan 17  2007 localdomain.zone
-rw-r----- 1 root  named  195 Jan 17  2007 localhost.zone
-rw-r----- 1 root  named  427 Jan 17  2007 named.broadcast
-rw-r----- 1 root  named 2518 Jan 17  2007 named.ca
-rw-r----- 1 root  named  424 Jan 17  2007 named.ip6.local
-rw-r----- 1 root  named  426 Jan 17  2007 named.local
-rw-r----- 1 root  named  427 Jan 17  2007 named.zero
drwxrwx--- 2 named named 4096 Jul 27  2004 slaves
[root@ser named]# cp -p localdomain.zone yjw.com.zone
[root@ser named]# cp -p named.local 192.168.1.local
[root@ser named]# vim  192.168.1.local
$TTL    86400
@       IN      SOA     yjw.com. root.yjw.com.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
        IN      NS       yjw.com.
108      IN      PTR      

www.yjw.com
.
108    IN      PTR       mail.yjw.com.

[root@ser named]#vim yjw.com.zone
$TTL    86400
@               IN SOA  yjw.com.  root (
                                    42              ; serial (d. adams)
                                    3H              ; refresh
                                     15M             ; retry
                                     1W              ; expiry
                                    1D )            ; minimum
                         IN NS           ns.yjw.com.
                        IN MX 10     mail.yjw.com.
ns        IN  A        192.168.1.108
www       IN  CNAME        ns.yjw.com.
mail      IN A            192.168.1.108

三、启动DNS服务
[root@ser named]# service named restart
Stopping named:                                            [  OK  ]
Starting named:                                            [  OK  ]
[root@ser named]#
四、测试
[root@ser named]# nslookup
>>
www.163.com
Server:         127.0.0.1
Address:        127.0.0.1#53

Non-authoritative answer:
www.163.com
     canonical name =
www.cache.gslb.netease.com
.
Name:   
www.cache.gslb.netease.com
Address: 61.135.253.9
Name:   
www.cache.gslb.netease.com
Address: 61.135.253.10
Name:   
www.cache.gslb.netease.com
Address: 61.135.253.11
Name:   
www.cache.gslb.netease.com
Address: 61.135.253.12
Name:   
www.cache.gslb.netease.com
Address: 61.135.253.13
Name:   
www.cache.gslb.netease.com
Address: 61.135.253.14
Name:   
www.cache.gslb.netease.com
Address: 61.135.253.15
Name:   
www.cache.gslb.netease.com
Address: 61.135.253.16
Name:   
www.cache.gslb.netease.com
Address: 61.135.253.17
Name:   
www.cache.gslb.netease.com
Address: 61.135.253.18
> > 192.168.1.2
Server:         127.0.0.1
Address:        127.0.0.1#53

2.1.168.192.in-addr.arpa        name =
www.yjw.com
.
2.1.168.192.in-addr.arpa        name = mail.yjw.com.
五、结束,欢迎指正


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/90685/showart_1914122.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP