redhat5.3 DNS服务器配置

1、检查bind包

[root@ocmdb named]# rpm -qa|grep bind

bind-utils-9.3.4-10.P1.el5
bind-libs-9.3.4-10.P1.el5
ypbind-1.19-11.el5


2、挂载光盘

 mount/dev/cdrom /mnt

mount: block device /dev/cdrom is write-protected, mounting read-only

3.配置YUM

vi /etc/yum.repos.d/update.repo

[update] 

name=update 

baseurl=file:///mnt/Server 

gpgcheck=0 

enabled =1

 

 4.安装bind包

yum install bind

yum install bind-chroot

yum install caching-nameserver


 5.检查bind包

[root@ocmdb named]# rpm -qa|grep bind
bind-libs-9.3.4-10.P1.el5
bind-utils-9.3.4-10.P1.el5
bind-chroot-9.3.4-10.P1.el5
ypbind-1.19-11.el5
bind-9.3.4-10.P1.el5


6.查看named服务状态

service named status

rndc:connect failed: 127.0.0.1#953: connection refused

namedis stopped

说明DNS没有配好,接下来就开始配置DNS

 

7.拷贝named.caching-nameserver.conf 到 /var/named/chroot/etc/named.conf

cp /etc/named.caching-nameserver.conf    /var/named/chroot/etc/named.conf

8.修改权限:chown .named named.conf

 [root@ocmdb etc]# ls -l
total 40
-rw-r--r-- 1 root root  3519 Sep 13 08:18 localtime
-rw-r----- 1 root named 1185 Jan  9 01:31 named.caching-nameserver.conf
-rw-r----- 1 root named 1185 Jan  9 01:45 named.conf
-rw-r----- 1 root named 1148 Jan  9 01:35 named.rfc1912.zones
-rw-r----- 1 root named  113 Jan  9 01:23 rndc.key


9.编辑named.conf文件

[root@ocmdb etc]# more named.conf

//

//named.caching-nameserver.conf

//

// Provided by Red Hatcaching-nameserver package to configure the

// ISC BIND named(8) DNS server as a caching only nameserver

// (as a localhost DNSresolver 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-nameserverpackage upgrade.

//

options {

        listen-on port53 { 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";

 

        // Those options should be usedcarefully because they disable port

        // randomization

        // 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      { localhost; };

        match-destinations { localhost; };

        recursion yes;

        include "/etc/named.rfc1912.zones";

};

 

10.编辑named.rfc1912.zones文件,在named.rfc1912.zones中添加

zone"baidu.com" IN {

        type master;

        file "baidu.com.zone";

        allow-update { none; };

};

 

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

        type master;

        file "192.168.49.local";

        allow-update { none; };

};

 

11.在/var/named/chroot/var/named/var/named中创建

baidu.com.zone(正向解析分解)  192.168.49.local(反向解析文件)  两个文件

可以拷贝模板

[root@ocmdb named]# cp  localhost.zone baidu.com.zone
[root@ocmdb named]# cp  named.local  192.168.49.local

12.赋权限

[root@ocmdb named]# chown root:named 192.168.49.local 

[root@ocmdb named]# chown root:named baidu.com.zone 

[root@ocmdb named]# ls -l
total 88
-rw-r----- 1 root  named  426 Jan  9 01:37 192.168.49.local
-rw-r----- 1 root  named  195 Jan  9 01:36 baidu.com.zone

drwxrwx--- 2 named named 4096 Aug 25  2004 data
-rw-r----- 1 root  named  198 Jan  6  2009 localdomain.zone
-rw-r----- 1 root  named  195 Jan  6  2009 localhost.zone
-rw-r----- 1 root  named  427 Jan  6  2009 named.broadcast
-rw-r----- 1 root  named 1892 Jan  6  2009 named.ca
-rw-r----- 1 root  named  424 Jan  6  2009 named.ip6.local
-rw-r----- 1 root  named  426 Jan  6  2009 named.local
-rw-r----- 1 root  named  427 Jan  6  2009 named.zero
drwxrwx--- 2 named named 4096 Jul 27  2004 slaves

13.编辑baidu.com ,其中ocmdb为hostname,baidu.com为域名;

 [root@ocmdb named]# vi baidu.com.zone 


$TTL    86400
@               IN SOA  ocmdb.baidu.com.       root.ocmdb.baidu.com. (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum


@               IN NS           ocmdb.baidu.com.
www             IN A            192.168.49.11
mail            IN A            192.168.49.12

14.编辑192.168.49.local文件

[root@ocmdb named]# vi 192.168.49.local 


$TTL    86400
@       IN      SOA     baidu.com. root.baidu.com.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
@        IN      NS      ocmdb.baidu.com.
11       IN      PTR     www.baidu.com.
12       IN      PTR     mail.baidu.com. 

15.配置完成,重启named服务

[root@ocmdb named]# service named restart
Stopping named: [  OK  ]
Starting named: [  OK  ]

16.通过nslookup解析域名

[root@ocmdb named]# nslookup
> www.baidu.com
Server:         192.168.49.131
Address:        192.168.49.131#53


Name:   www.baidu.com
Address: 192.168.49.11
> mail.baidu.com
Server:         192.168.49.131
Address:        192.168.49.131#53


Name:   mail.baidu.com
Address: 192.168.49.12
> 192.168.49.11
Server:         192.168.49.131
Address:        192.168.49.131#53


11.49.168.192.in-addr.arpa      name = www.baidu.com.
> 192.168.49.12
Server:         192.168.49.131
Address:        192.168.49.131#53


12.49.168.192.in-addr.arpa      name = mail.baidu.com.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值