中国网管论坛's Archiver

死神司令 发表于 2008-4-19 08:46

DNS域名服务

[align=center][align=center][color=#000000][font=Times New Roman]DNS[/font][font=宋体]域名服务[/font][/color][/align][/align][font=Times New Roman][color=#000000]1、
[/color][/font][font=宋体][color=#000000]安装域名服务[/color][/font]
[color=#000000][font=Times New Roman]RHEL4[/font][font=宋体]系统中默认没有安装[/font][font=Times New Roman]bind[/font][font=宋体]服务器软件包,而只安装了名为[/font][font=Times New Roman]bind-libs[/font][font=宋体]和[/font][font=Times New Roman]bind-utils[/font][font=宋体]的两个域名解析相关的软件包:[/font][/color]
[font=Times New Roman][color=#000000]#rpm –qa | grep bind[/color][/font]
[font=Times New Roman][color=#000000]bind-libs-9.2.4-2[/color][/font]
[font=Times New Roman][color=#000000]ypbind-1.17.2-3[/color][/font]
[font=Times New Roman][color=#000000]bind-utils-9.2.4-2[/color][/font]
[color=#000000][font=Times New Roman]RHEL4[/font][font=宋体]系统中提供了[/font][font=Times New Roman]RPM[/font][font=宋体]格式的[/font][font=Times New Roman]bind[/font][font=宋体]服务器软件包,安装文件名称是[/font][font=Times New Roman]bind-9.2.4-2.i386.rpm[/font][font=宋体]的软件包:[/font][/color]
[font=Times New Roman][color=#000000]#rpm -ivh bind-9.2.4-2.i386.rpm[/color][/font]
[color=#000000][font=Times New Roman]BIND[/font][font=宋体]服务器的服务程序(脚本)名称是[/font][font=Times New Roman]named[/font][font=宋体],该服务程序在[/font][font=Times New Roman]BIND[/font][font=宋体]服务器安装后默认不自动启动,需要使用[/font][font=Times New Roman]chkconfig[/font][font=宋体]命令进行手动设置在运行级别[/font][font=Times New Roman]2[/font][font=宋体]、[/font][font=Times New Roman]3[/font][font=宋体]、[/font][font=Times New Roman]4[/font][font=宋体]、[/font][font=Times New Roman]5[/font][font=宋体]为启动状态。[/font][/color]
[font=Times New Roman][color=#000000]#rpm –ql bind |grep init.d[/color][/font]
[font=Times New Roman][color=#000000]/etc/rc.d/init.d/named[/color][/font]
[font=Times New Roman][color=#000000]#chkconfig - - list named[/color][/font]
[color=#000000][font=Times New Roman]named
0[/font][font=宋体]:[/font][font=Times New Roman]off
1[/font][font=宋体]:[/font][font=Times New Roman]off
2[/font][font=宋体]:[/font][font=Times New Roman]off
3[/font][font=宋体]:[/font][font=Times New Roman]off
4[/font][font=宋体]:[/font][font=Times New Roman]off
5[/font][font=宋体]:[/font][font=Times New Roman]off
6[/font][font=宋体]:[/font][font=Times New Roman]off[/font][/color]
[font=Times New Roman][color=#000000]#chkconfig - - level 2345 named on[/color][/font]
[font=Times New Roman][color=#000000]#chkconfig - - list named[/color][/font]
[color=#000000][font=Times New Roman]named
0[/font][font=宋体]:[/font][font=Times New Roman]off
1[/font][font=宋体]:[/font][font=Times New Roman]off
2[/font][font=宋体]:[/font][font=Times New Roman]on
3[/font][font=宋体]:[/font][font=Times New Roman]on
4[/font][font=宋体]:[/font][font=Times New Roman]on
5[/font][font=宋体]:[/font][font=Times New Roman]on
6[/font][font=宋体]:[/font][font=Times New Roman]off[/font][/color]
[font=Times New Roman][color=#000000]2、
[/color][color=#000000]BIND[/color][/font][font=宋体][color=#000000]服务器的基本配置[/color][/font]
[color=#000000][font=宋体](1)
[/font][font=Times New Roman]named.conf[/font][font=宋体]配置文件[/font][/color]
[color=#000000][font=Times New Roman]BIND[/font][font=宋体]服务器的主配置文件是[/font][font=Times New Roman]named.conf[/font][font=宋体],保存在“[/font][font=Times New Roman]/etc[/font][font=宋体]”目录中,该文件是安装[/font][font=Times New Roman]bind[/font][font=宋体]软件包时生成的,而不是包括在该软件包中的。[/font][/color]
[font=Times New Roman][color=#000000]#cat /etc/named.conf[/color][/font]
[color=#000000][font=宋体](2)
[/font][font=Times New Roman]BIND[/font][font=宋体]服务器的工作目录[/font][/color]
[color=#000000][font=Times New Roman]BIND[/font][font=宋体]服务器中的域名区域文件需要保存在工作目录“[/font][font=Times New Roman]/var/named/[/font][font=宋体]”中,[/font][font=Times New Roman]bind[/font][font=宋体]软件包安装后,该目录中包括两个空的子目录,管理员需要在该工作目录中保存[/font][font=Times New Roman]DNS[/font][font=宋体]服务器的区域文件。[/font][/color]
[font=Times New Roman][color=#000000]#ls /var/named/[/color][/font]
[font=Times New Roman][color=#000000]data
slaves[/color][/font]
[color=#000000][font=宋体](3)
[/font][font=Times New Roman]BIND[/font][font=宋体]服务器的启动与停止[/font][/color]
[color=#000000][font=Times New Roman]BIND[/font][font=宋体]服务器的启动脚本名称是[/font][font=Times New Roman]named[/font][font=宋体],可以使用[/font][font=Times New Roman]service[/font][font=宋体]命令调用该脚本启动和停止[/font][font=Times New Roman]BIND[/font][font=宋体]服务器,或查询服务器的运行状态。[/font][/color]
[font=Times New Roman][color=#000000]#service named restart[/color][/font]
[color=#000000][font=Times New Roman]BIND[/font][font=宋体]服务器安装到[/font][font=Times New Roman]RHEL4[/font][font=宋体]系统后,在没有经过任何配置是可以正常启动,但是不能完成任何域名解析的工作,因此需要对[/font][font=Times New Roman]BIND[/font][font=宋体]服务器做进一步的配置。[/font][/color]
[color=#000000][font=宋体](4)
[/font][font=Times New Roman]DNS[/font][font=宋体]服务器有[/font][font=Times New Roman]3[/font][font=宋体]种类型[/font][/color]
[color=#000000][font=Wingdings]l
[/font][font=宋体]缓存域名服务器,或又称为“惟高速缓存服务器”,其主要功能是提供域名解析的缓存[/font][/color]
[color=#000000][font=Wingdings]l
[/font][font=宋体]主域名服务器的特定域或所有信息的权威信息源,对于某个指定域,主域名服务器是唯一存在的。主域名服务器中保存了指定域的区域文件。[/font][/color]
[color=#000000][font=Wingdings]l
[/font][font=宋体]从域名服务器中不进行特定域信息(区域文件)的权威设置,而是从该域的主域服务器中获取相应的文件并进行保存[/font][/color]
[font=Times New Roman][color=#000000]3、
[/color][/font][font=宋体][color=#000000]构建缓存域名服务器[/color][/font]
[color=#000000][font=宋体]([/font][font=Times New Roman]1[/font][font=宋体])构建缓存域名服务器,我们什么都不需要配置,在[/font][font=Times New Roman]RHEL4[/font][font=宋体]系统为配置缓存域名服务器专门提供了名为[/font][font=Times New Roman]caching-nameserver[/font][font=宋体]的软件包,只需使用[/font][font=Times New Roman]rpm[/font][font=宋体]命令手动安装就可以了。[/font][/color]
[font=Times New Roman][color=#000000]#rpm –ivh caching-nameserver-7.3-3.noarch.rpm[/color][/font]
[color=#000000][font=Times New Roman]caching-nameserver[/font][font=宋体]软件包安装时将对[/font][font=Times New Roman]BIND[/font][font=宋体]服务器的配置文件[/font][font=Times New Roman]named.conf[/font][font=宋体]的内容进行更改,原有文件中的内容被保存在文件“[/font][font=Times New Roman]/etc/named.conf.rpmorig[/font][font=宋体]”中。[/font][/color]
[color=#000000][font=宋体]([/font][font=Times New Roman]2[/font][font=宋体])[/font][font=Times New Roman]named.conf[/font][font=宋体]配置文件[/font][/color]
[color=#000000][font=宋体]在系统中安装了[/font][font=Times New Roman]caching-nameserver[/font][font=宋体]软件包后,缓存域名服务器的配置文件已经保存在[/font][font=Times New Roman]named.conf[/font][font=宋体]配置文件中。[/font][/color]
[color=#000000][font=宋体]([/font][font=Times New Roman]3[/font][font=宋体])[/font][font=Times New Roman]named.conf[/font][font=宋体]中的全局设置[/font][/color]
[color=#000000][font=宋体]在[/font][font=Times New Roman]named.conf[/font][font=宋体]配置文件中使用[/font][font=Times New Roman]options[/font][font=宋体]配置语句进行[/font][font=Times New Roman]BIND[/font][font=宋体]服务器的全局属性配置。[/font][/color]
[font=Times New Roman][color=#000000]options{[/color][/font]
[color=#000000][font=Times New Roman]
directory
“/var/named/”;[/font][/color]
[color=#000000][font=Times New Roman]

dump-file “/var/named/data/cache_dump.db”;[/font][/color]
[font=Times New Roman][color=#000000]

statistics-file
“/var/named/data/named_stats.txt”;[/color][/font]
[color=#000000][font=Times New Roman]}[/font][font=宋体];[/font][/color]
[color=#000000][font=宋体]在[/font][font=Times New Roman]options[/font][font=宋体]配置语句中包括的主要配置项含义如下:[/font][/color]
[color=#000000][font=Wingdings]l
[/font][font=Times New Roman]directory[/font][font=宋体]用于设置[/font][font=Times New Roman]BIND[/font][font=宋体]服务器的工作目录,即域名区域文件保存的目录,设置的默认值为“[/font][font=Times New Roman]/var/named[/font][font=宋体]”。[/font][/color]
[color=#000000][font=Wingdings]l
[/font][font=Times New Roman]dump-file[/font][font=宋体]用于设置域名缓存文件的保存位置和文件名。[/font][/color]
[color=#000000][font=宋体]([/font][font=Times New Roman]4[/font][font=宋体])跟区域设置及跟区域文件[/font][/color]
[color=#000000][font=宋体]跟区域是互联网中所有域名的开始,使用句点([/font][font=Times New Roman].[/font][font=宋体])表示,缓存服务器只有能够访问[/font][font=Times New Roman]DNS[/font][font=宋体]跟服务器才能提供正常的域名解析服务[/font][/color]
[color=#000000][font=宋体](5)
[/font][font=Times New Roman]localhost[/font][font=宋体]正向解析[/font][/color]
[color=#000000][font=宋体]在缓存域名服务器的[/font][font=Times New Roman]named.conf[/font][font=宋体]配置文件中,除了包括跟区域的配置以外,还包括了对[/font][font=Times New Roman]localhost[/font][font=宋体]区域的正向解析和反向解析。[/font][/color]
[color=#000000][font=Times New Roman]localhost[/font][font=宋体]区域的作用是对主机名称[/font][font=Times New Roman]localhost[/font][font=宋体]和环回地址[/font][font=Times New Roman]127.0.0.1[/font][font=宋体]之间进行解析,因此[/font][font=Times New Roman]localhost[/font][font=宋体]总是代表本机。[/font][/color]
[font=Times New Roman][color=#000000]zone
“localhost” IN {[/color][/font]
[color=#000000][font=Times New Roman]
type master;[/font][/color]
[color=#000000][font=Times New Roman]
file “localhost.zone”;[/font][/color]
[color=#000000][font=Times New Roman]

allow-update{none};[/font][/color]
[font=Times New Roman][color=#000000]};[/color][/font]
[color=#000000][font=宋体]在[/font][font=Times New Roman]localhost[/font][font=宋体]的正向解析区域配置中,配置项的含义如下:[/font][/color]
[color=#000000][font=Wingdings]l
[/font][font=Times New Roman]type[/font][font=宋体]设置为[/font][font=Times New Roman]master[/font][font=宋体]表示区域的类型为主服务器[/font][/color]
[color=#000000][font=Wingdings]l
[/font][font=Times New Roman]file[/font][font=宋体]设置[/font][font=Times New Roman]localhost[/font][font=宋体]域的区域文件名为[/font][font=Times New Roman]localhost.zone[/font][/color]
[color=#000000][font=Times New Roman]localhost.zone[/font][font=宋体]区域文件位于“[/font][font=Times New Roman]/var/named/[/font][font=宋体]”目录中,是安装[/font][font=Times New Roman]caching-nameserver[/font][font=宋体]软件包时自动安装的[/font][/color]
[color=#000000][font=宋体](6)
[/font][font=Times New Roman]localhost[/font][font=宋体]反向解析[/font][/color]
[color=#000000][font=宋体]在[/font][font=Times New Roman]DNS[/font][font=宋体]系统中,每个区域的正向解析必然有对应的反向解析区域,反向解析区域的作用是将[/font][font=Times New Roman]IP[/font][font=宋体]地址转换为对应的域名。[/font][/color]
[color=#000000][font=宋体]在[/font][font=Times New Roman]named.conf[/font][font=宋体]配置文件中,[/font][font=Times New Roman]localhost[/font][font=宋体]区域的反向解析区域的设置内容如下:[/font][/color]
[font=Times New Roman][color=#000000]zone
“0.0.127.in-addr.arpa” IN {[/color][/font]
[color=#000000][font=Times New Roman]

type master;[/font][/color]
[color=#000000][font=Times New Roman]

file
“named.local”;[/font][/color]
[color=#000000][font=Times New Roman]

allow-update {none};[/font][/color]
[font=Times New Roman][color=#000000]};[/color][/font]
[color=#000000][font=Times New Roman]Localhost[/font][font=宋体]的反向解析区域的名称是[/font][font=Times New Roman]0.0.127.in-addr.arpa[/font][font=宋体],名称后缀为“[/font][font=Times New Roman]in-addr.arpa[/font][font=宋体]”的区域都是反向解析区域,名称中[/font][font=Times New Roman]0.0.127[/font][font=宋体]是[/font][font=Times New Roman]IP[/font][font=宋体]地址[/font][font=Times New Roman]127.0.0[/font][font=宋体]的倒置,这样的反向解析区域名称是[/font][font=Times New Roman]named.conf[/font][font=宋体]配置文件中的约定。[/font][/color]
[color=#000000][font=Times New Roman]0.0.127.in-addr.arpa[/font][font=宋体]区域的类型是[/font][font=Times New Roman]master[/font][font=宋体],即主服务器。区域文件的名称是[/font][font=Times New Roman]named.local[/font][font=宋体]。[/font][/color]
[color=#000000][font=宋体]([/font][font=Times New Roman]7[/font][font=宋体])缓存域名服务器的启动和测试[/font][/color]
[color=#000000][font=Times New Roman]1>[/font][font=宋体]测试[/font][font=Times New Roman]named.conf[/font][font=宋体]主配置文件[/font][/color]
[font=Times New Roman][color=#000000]#named-checkconf[/color][/font]
[color=#000000][font=宋体]如果[/font][font=Times New Roman]named.conf[/font][font=宋体]文件中不存在语法错误,[/font][font=Times New Roman]named-checkconf[/font][font=宋体]命令将不显示任何信息,如果有错误文件,屏幕将显示发现的错误内容[/font][/color]
[color=#000000][font=Times New Roman]2>[/font][font=宋体]测试区域文件[/font][/color]
[color=#000000][font=Times New Roman]#named-checkzone
[/font][font=宋体]区域名称[/font][font=Times New Roman]
/var/named/[/font][font=宋体]区域文件的名称[/font][/color]
[color=#000000][font=Times New Roman]named-checkzone[/font][font=宋体]命令如果在指定的区域文件中发现了语法错误,将显示错误的内容,如果文件中没有任何错误将显示[/font][font=Times New Roman]OK[/font][font=宋体]。[/font][/color]
[color=#000000][font=Times New Roman]3>[/font][font=宋体]启动[/font][font=Times New Roman]named[/font][font=宋体]服务器程序[/font][/color]
[font=Times New Roman][color=#000000]#service named restart[/color][/font]
[color=#000000][font=Times New Roman] [/font][/color]
[color=#000000][font=Times New Roman] [/font][/color]
[font=宋体][color=#000000]写的不好,请朋友们多多指教啊!如有不对之处或不了解之处,请朋友们尽管指出[/color][/font]

iamshiyu 发表于 2008-4-19 09:24

现收藏以后需要再看

页: [1]

Powered by Discuz! Archiver 6.1.0  © 1999-2008 bbs.bitsCN.com