centos5.3 搭建DNS多域名解析服务器的教程

2020-01-30 13:13:15于丽

10、本地DNS服务器解析出www.exmaple.com.cn的IP 地址,并传回给客户机。
四、搭建centos5.3下的DNS多域解析服务器
系统平台:centos5.3 内核版本:2.6.18-128.2.1.el5
DNS 服务器IP :192.168.2.210
Web 服务器A:www.chinaunix.net 192.168.2.181
Mail服务器B:mail.chinaunix.net 192.168.2.182
Web 服务器C:www.chinaunix.org 192.168.2.183
Mail服务器D:mail.chinaunix.org 192.168.2.185
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
备注:cp 参数-p 除复制源文件的内容外,还将把其修改时间和访问权限也复制到新文件中。
这里大多数配置文件的属主是root,组为named,如果只是cp,启动named 服务时会报
错。
[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";
}; # 根DNS服务器配置文件;
zone " localdomain" IN {
type master;
file " localdomain.zone";