Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1694423
  • 博文数量: 163
  • 博客积分: 10591
  • 博客等级: 上将
  • 技术积分: 1980
  • 用 户 组: 普通用户
  • 注册时间: 2006-08-08 18:17
文章分类

全部博文(163)

文章存档

2018年(1)

2012年(1)

2011年(47)

2010年(58)

2009年(21)

2008年(35)

分类: LINUX

2009-06-15 15:36:44

Cenos5.2 +DNS

 

这里只将具体实现过程,写一下,原理性的东西,自己其google上搜吧~~

 

前提:

hostname grid1.hrwang.com

ip:   192.168.254.142

 

 

1.  安装如下的包:

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

bind-9.3.4-6.P1.el5

bind-libs-9.3.4-6.P1.el5

ypbind-1.19-8.el5

bind-sdb-9.3.4-6.P1.el5

bind-utils-9.3.4-6.P1.el5

bind-devel-9.3.4-6.P1.el5

bind-chroot-9.3.4-6.P1.el5

bind-libbind-devel-9.3.4-6.P1.el5

 

 

2.  删除了/etc/下的

named.caching-nameserver.conf

named.rfc1912.zones

 

3. 更改/var/named/chroot/etc下的named.caching-nameserver.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";

};

 

4.      更改/var/named/chroot/etc下的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 "localdomain" IN {

        type master;

        file "localdomain.zone";

        allow-update { none; };

};

 

zone "localhost" IN {

        type master;

        file "localhost.zone";

        allow-update { none; };

};

 

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

        type master;

        file "named.local";

        allow-update { none; };

};

 

zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {

        type master;

        file "named.ip6.local";

        allow-update { none; };

};

 

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

        type master;

        file "named.broadcast";

        allow-update { none; };

};

 

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

        type master;

        file "named.zero";

        allow-update { none; };

};

 

zone "hrwang.com" IN {

  type master;

  file "hrwang.com.db";

  allow-update { none; };

};

 

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

  type master;

  file "254.168.192.db";

  allow-update { none; };

};

 

5.      /var/named/chroot/var/named下创建 hrwang.com.db文件,用于正向解析。内容如下:

 

$TTL 86400

@       IN SOA grid1.hrwang.com  root (

                20090506        ;serial

                28800           ;refresh

                7200            ;retry

                604800          ;expiry

                86400 )         ;minimum

 

        IN   NS   grid1.hrwang.com

 

grid1      IN   A   192.168.254.142

grid2      IN   A   192.168.254.143

grid3      IN   A   192.168.254.200

 

 

 

 

6.      /var/named/chroot/var/named下创建254.168.192.db,内容如下:

 

$TTL 86400

@       IN SOA grid1.hrwang.com.  root.grid1.hrwang.com. (

                20090506        ;serial

                28800           ;refresh

                7200            ;retry

                604800          ;expiry

                86400 )          ;minimum

 

        IN   NS   hrwang.com.

 

142     IN   PTR  grid1.hrwang.com.

143     IN   PTR  grid2.hrwang.com.

200     IN   PTR  grid3.hrwang.com.

 

 

 

7.      权限设置

-rw-r--r-- 1 root  named  400 May  7 01:41 254.168.192.db

-rw-r--r-- 1 root  named  272 May  7 01:42 hrwang.com.db

 

8.配置

/etc/resolve.conf文件中添加如下一行

nameserver  192.168.254.142

 

 

9 启动

/etc/init.d/named start

 

 

10.  检测

 

[root@grid1 named]# nslookup 192.168.254.142

Server:         192.168.254.142

Address:        192.168.254.142#53

 

142.254.168.192.in-addr.arpa    name = grid1.hrwang.com.

 

 

[root@grid1 named]# nslookup 192.168.254.143

Server:         192.168.254.142

Address:        192.168.254.142#53

 

143.254.168.192.in-addr.arpa    name = grid2.hrwang.com.

阅读(1161) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~