热门关键字:  ubuntu  分区  Fedora  linux系统进程  函数

DNS—bind安装与配置的关键技术揭秘

来源: 作者: 时间:2007-03-26 Tag: 点击:
一.、Bind 简介。

Bind 是一款开放源码的DNS服务器软件,Bind由美国加州大学Berkeley分校开发和维护的,全名为Berkeley Internet Name Domain它是目前世界上使用最为广泛的DNS服务器软件,支持各种unix平台和windows平台。本文将介绍它在Red hat Linux 9中最基本的安装和配置。

二.、软件的相关资源。

官方网站:http://www.bind.com/

源码软件包:Bind 是开源的软件,可以去其官方网站下载。http://www.isc.org/index.pl/sw/bind/ ,目前最新版本为bind-9.3.1。

帮助文档:http://www.isc.org/index.pl/sw/bind/ 有该软件比较全面的帮助文档。

FAQ:http://www.isc.org/index.pl/sw/bind/ 回答了该软件的常见问题。

配置文件样例:http://www.bind.com/bind.html 一些比较标准的配置文件样例。

三.、软件的安装。

1.安装

由其官方网站中下载其源码软件包bind-9.3.1. tar.gz。接下来我将对安装过程的一些重要步骤,给出其解释:

[root@localhost root]#tar xzvf bind-9.3.1. tar.gz
[root@localhost root]#cd bind-9.3.1
[root@localhost bind-9.3.1]#./configure 
[root@localhost bind-9.3.1]#make
[root@localhost bind-9.3.1]#make install


tar xzvf bind-9.3.1.tar.gz 解压缩软件包。

./configure 针对机器作安装的检查和设置,大部分的工作是由机器自动完成的,但是用户可以通过一些参数来完成一定的设置,其常用选项有:

./configure --help 察看参数设置帮助。

--prefix= 指定软件安装目录(默认/usr/local/)。

--enable-ipv6 支持ipv6。

可以设置的参数很多,可以通过 -help察看需要的,一般情况下,默认设置就可以了。



默认情况下,安装过程是不会建立配置文件和一些默认的域名解析的,不过并不妨碍,可以从下载一些标准的配置文件(http://www.bind.com/bind.html),也可以使用本文所提供的样例文件。



默认情况下,安装的deamon为/usr/local/sbin/named

默认的主配置文件,/etc/named.conf(须手动建立)。



2.启动:

[root@localhost root]# /usr/local/sbin/named -g


/usr/local/sbin/named默认情况是一个后台deamon ,-g选项表示前台运行,并将调试信息打印到标准输出,这在我们安装调试阶段是非常有帮助的。

如果建立了配置文件和域名解析文件(关于怎样建立将在下面的部分讲到),ps aux 应该可以查到named 的进程,或netstat -an 也可以看到53端口的服务已经起来了。(DNS默认端口为53)

如果要设置开机自启动DNS server,只需在/etc/rc.d/rc.local中加入一行

/usr/local/sbin/named

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local

/usr/local/sbin/named


四.软件的配置。

1.主配置文件

默认安装主配置文件的位置为

/etc/named.conf

下面逐步分析一个比较基础的配置文件:(注:named配置文件采用和c语言相同的注释符号)。

(1) log options















/*
 * log option
 */
logging { 
	channel default_syslog { syslog local2; severity error; };
	channel audit_log { file "/var/log/named.log"; severity error; print-time yes; };
	category default { default_syslog; }; 
	category general { default_syslog; }; 
	category security { audit_log; default_syslog; }; 
	category config { default_syslog; }; 
	category resolver { audit_log; }; 
	category xfer-in { audit_log; }; 
	category xfer-out { audit_log; }; 
	category notify { audit_log; }; 
	category client { audit_log; }; 
	category network { audit_log; }; 
	category update { audit_log; }; 
	category queries { audit_log; }; 
	category lame-servers { audit_log; };
};


这一部分是日志的设置,其中最主要的是

file "/var/log/named.log" 这一句指定了日志文件的位置,要正常启动named,必须要保证这一文件是存在的,并且named 进程对它有读写权限。

(2) options

options {
	directory "/etc/namedb";

    listen-on-v6 { any; };

// If you've got a DNS server around at your upstream provider, enter
// its IP address here, and enable the line below.  This will make you
// benefit from its cache, thus reduce overall DNS traffic in the Internet.

	forwarders {
		your.upper.DNS.address;
	};

	/*
	 * If there is a firewall between you and nameservers you want
	 * to talk to, you might need to uncomment the query-source
	 * directive below.  Previous versions of BIND always asked
	 * questions using port 53, but BIND 8.1 uses an unprivileged
	 * port by default.
	 */
	// query-source address * port 53;

	/*
	 * If running in a sandbox, you may have to specify a different
	 * location for the dumpfile.
	 */
	dump-file "/etc/named_dump.db";
};


这一部分是一些基本的配置项:

directory "/etc/namedb"; 指定域名解析等文件的存放目录(须手动建立);

listen-on-v6 { any; }; 支持ipv6的请求;

forwarders {

your.upper.DNS.address;

}; 指定前向DNS,当本机无法解析的域名,就会被转发至前向DNS进行解析。

dump-file "/etc/named_dump.db"; 指定named_dump.db文件的位置。

(3) 线索域和回环域

// Setting up secondaries is way easier and the rough picture for this
// is explained below.
//
// If you enable a local name server, don't forget to enter 127.0.0.1
// into your /etc/resolv.conf so this server will be queried first.
// Also, make sure to enable it in /etc/rc.conf.

zone "." {
	type hint;
	file "named.root";
};

zone "0.0.127.IN-ADDR.ARPA" {
	type master;
	file "localhost.rev";
};


指定线索域和本地回环域,这一部分使用一些标准的例子就可以。

file "named.root"; 指定该域的解析文件,其目录为options中directory "/etc/namedb";指定的。在本例中为/etc/namdb。



相关文章:
eG Citrix 监控器
Ethernet的帧格式和结构
华为(Quidway AR18-22-24)路由器配置实例
简单利用路由黑洞解决DDOS流量攻击
我的linux试验题目
如何在HMC上激活网络时间协议NTP
Resin泛解析 - 三级域名最优应用方案
Resin多域名绑定 + 泛解析
resin 负载均衡
linksys wap54g 设置注意事项
acegi RememberMe&退出&匿名登陆
vnd命令~
LINUX网卡绑定
TCP包首部
IP包首部格式
指纹锁也不靠谱 电脑“破解”六大事件!
linux配置网关
使用 SCTP 优化网络
IPv4/IPv6过渡技术和方案分析
用三个源码包libnet、libnids、libpcap轻松搭建Li
Extensible Messaging and Presence Protocol (XM
组建CISCO多层交换网络入门
CISCO多层交换机的初始配置和排错
实施和配置VLAN
理解和配置802.1Q/802.1S和802.1W生成树协议
理解和配置cisco特定的生成树协议特性和STP排错
配置第二层和第三层的特性
理解和配置VLAN间的路由选择
理解和配置多层交换
理解和配置cisco多层交换网络中的服务质量