您的位置:首页 > 其它

RHEL5下搭建DNS服务器

2010-03-30 16:33 316 查看
搭建Linux 下的DNS服务器

系统平台:RedHat Enterprise Linux 5 update3

内核版本:2.6.18-128.el5

DNS 服务器IP :192.168.1.100

Web服务器A:www.neco123.com 192.168.1.101

Mail服务器B:mail.neco123.com 192.168.1.102

1、安装bind相关软件包

[root@server ~]# yum -y install bind* caching-nameserver

2、修改主配置文件

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

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

[root@server etc]# cp –p named.rfc1912.zones named.rfc1912.zones.bak

[root@server etc]# vi 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";

// Those options should be used carefully 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 { any; };

match-destinations { any; };

recursion yes;

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

};

[root@server etc]# vi 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 "0.0.127.in-addr.arpa" IN {

type master;

file " named.local";

allow-update { none; };

};

zone "neco123.com" IN {

type master;

file "neco123.com.zone";

allow-update { none; };

};

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

type master;

file "1.168.192.in-addr.local";

allow-update { none; };

}; # 模板2 复制并修改后的;

3、Zone配置文件

[root@server etc]# cd ../var/named/

[root@server named]# cp –p localdomain.zone chinaunix.net.zone

[root@server named]# cp –p localdomain.zone chinaunix.org.zone

[root@server named]# cp –p named.local 2.168.192.in-addr.local

[root@server named]# vi neco123.com.zone

$TTL 86400

@ IN SOA localhost root (

42 ;

3H ;

15M ;

1W ;

1D ) ;

IN NS neco123.com.

IN MX 10 mail.neco123.com.

www IN A 192.168.1.100

mail IN A 192.168.1.102

[root@server named]# vi 1.168.192.in-addr.local

$TTL 86400

@ IN SOA localhost. root.localhost. (

1997022700 ;

28800 ;

14400 ;

3600000 ;

86400 ) ;

IN NS neco123.com.

101 IN PTR www.neco123.com.

102 IN PTR mail.neco123.com.

4、测试

[root@server ~]# nslookup

Ø www.neco123.com

Server: 192.168.1.100

Address: 192.168.2.100#53

Name: www.neco123.com

Address: 192.168.1.101

Ø mail.neco123.com

Server: 192.168.1.100

Address: 192.168.1.100#53

Name: mail.neco123.comt

Address: 192.168.1.102

Ø 192.168.1.101

Server: 192.168.1.100

Address: 192.168.1.100#53

101.1.168.192.in-addr.arpa name = www.neco123.com.

Ø 192.168.1.102

Server: 192.168.1.100

Address: 192.168.1.100#53

102.1.168.192.in-addr.arpa name = mailneco123.com.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: