- 论坛徽章:
- 0
|
最近,发现很多的朋友在问关于DNS的问题。所以,现在老话重提,再讲述一下关于DNS的设置过程。现在以操作系统为Solaris8做基础介绍,来说明DNS设置过程。8与2.6在DNS设置方面有些区别。8是用named.conf这个文件做为启动的,而2.6是用named.boot做为启动的。(现在8比较多就以8为例子进行介绍)8的DNS配置和9的差不多.但是,10的没有做过.
首先介绍一下辅助DNS的设置方法:
1、 在/etc目录下建议一个名字为named.conf这个文件,文件的内容如下:
# vi named.conf
options {
directory "/var/named";
forward only;
forwarders {
192.168.1.1;
};
transfers-in 10;
transfers-per-ns 2;
};
zone "happy.com.cn" {
type slave;
file "named.happy.com.cn";
masters {192.168.1.1;};
};
zone "0.0.127.in-addr.arpa." {
type master;
file "named.local.com.cn";
};
zone "0.168.192.in-addr.arpa" {
type slave;
file "named.rhappy.com.cn";
masters {192.168.1.1;};
};
zone "." in {
type hint;
file "named.ca";
};
由于在我现在的内网中已经存在一个DNS服务器192.168.1.1所以,我现在将这个服务器建立为从属内网服务器。
现在再介绍一下关于主DNS服务器的named.conf的设置内容:
# vi named.conf
options {
directory "/var/named";
forward only;
transfers-in 10;
transfers-per-ns 2;
};
zone "happy.com.cn" {
type master;
file "named.happy.com.cn";
};
zone "0.0.127.in-addr.arpa." {
type master;
file "named.local.com.cn";
};
zone "0.168.192.in-addr.arpa" {
type master;
file "named.rhappy.com.cn";
};
zone "." in {
type hint;
file "named.ca";
};
在建立一个named.conf文件的时候,最少要存在4个zone如上面的例子一样。如果,需要添加更多的域名只需要在named.conf中添加相应的zone就可以了。
2、 下面介绍一下在/var/named目录下建立的几个配置文件。named.happy.com.cn文件的配置:
# more named.happy.com.cn
$TTL 8h
happy.com.cn. IN SOA mail.happy.com.cn. root.mail.happy.com.cn. (
1 ;Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS mail.happy.com.cn.
IN MX 10 mail.happy.com.cn
www IN A 192.168.1.254
localhost. IN A 127.0.0.1
下面叙述一下关于named.local.com.cn文件的配置情况:
$TTL 8h
0.0.127.IN-ADDR.ARPA. IN SOA mail.happy.com.cn. root.mail.happy.com.cn. (
1 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
0.0.127.IN-ADDR.ARPA. IN NS mail.happy.com.cn.
1 IN PTR localhost.happy.com.cn
下面叙述一下关于named.rhappy.com.cn文件的配置。
# more named.rhappy.com.cn
$TTL 8h
0.168.192.IN-ADDR.ARPA. IN SOA mail.happy.com.cn. root.mail.happy.com.cn. (
1 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
0.168.192.IN-ADDR.ARPA. IN NS mail.happy.com.cn.
下面叙述一下named.ca文件的配置。
# more named.ca
. 9999999 IN NS mail.happy.com.cn
mail.happy.com.cn 9999999 IN A 192.168.1.254
关于named.ca这个文件可以在网上下载这个文件的摸板文件。
例如:
; This file holds the information on root name servers needed to
; initialize cache of Internet domain name servers
; (e.g. reference this file in the "cache . <file>;"
; configuration file of BIND domain name servers).
;
; This file is made available by InterNIC registration services
; under anonymous FTP as
; file /domain/named.root
; on server FTP.RS.INTERNIC.NET
; -OR- under Gopher at RS.INTERNIC.NET
; under menu InterNIC Registration Services (NSI)
; submenu InterNIC Registration Archives
; file named.root
;
; last update: Aug 22, 1997
; related version of root zone: 1997082200
;
;
; formerly NS.INTERNIC.NET
;
. 3600000 IN NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
;
; formerly NS1.ISI.EDU
;
. 3600000 NS B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET. 3600000 A 128.9.0.107
;
; formerly C.PSI.NET
;
. 3600000 NS C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12
;
; formerly TERP.UMD.EDU
;
. 3600000 NS D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90
;
; formerly NS.NASA.GOV
;
. 3600000 NS E.ROOT-SERVERS.NET.
E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10
;
; formerly NS.ISC.ORG
;
. 3600000 NS F.ROOT-SERVERS.NET.
F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241
;
; formerly NS.NIC.DDN.MIL
;
. 3600000 NS G.ROOT-SERVERS.NET.
G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4
;
; formerly AOS.ARL.ARMY.MIL
;
. 3600000 NS H.ROOT-SERVERS.NET.
H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53
;
; formerly NIC.NORDU.NET
;
. 3600000 NS I.ROOT-SERVERS.NET.
I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17
;
; temporarily housed at NSI (InterNIC)
;
. 3600000 NS J.ROOT-SERVERS.NET.
J.ROOT-SERVERS.NET. 3600000 A 198.41.0.10
;
; housed in LINX, operated by RIPE NCC
;
. 3600000 NS K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129
;
; temporarily housed at ISI (IANA)
;
. 3600000 NS L.ROOT-SERVERS.NET.
L.ROOT-SERVERS.NET. 3600000 A 198.32.64.12
;
; housed in Japan, operated by WIDE
;
. 3600000 NS M.ROOT-SERVERS.NET.
M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33
; End of File
如果,配置成功在启动named进程的时候可以在/var/adm/messages信息中看到:
Jul 11 09:29:24 happy named[583]: [ID 295310 daemon.notice] starting. in.named BIND 8.2.2-P5 Thu Jan 29 07:06:27 PST 2004
Jul 11 09:29:24 happy Generic Patch-5.8-January 2004
Jul 11 09:29:24 happy named[584]: [ID 295310 daemon.notice] Ready to answer queries.
如果,有故障信息出现请检查你的named.conf以及几个配置文件的是不是有问题。
[ 本帖最后由 风之幻想 于 2007-1-25 08:26 编辑 ] |
|