关于DNS的一些问答

      FLASH 2005-5-30 13:06:00
Freesoft Linux FAQ -- 关于DNS的一些问答  
> 独立的局域网中,NAMED.CACHE应如何填写?按HOWTO的填,NSLOOKUP会等待很长时间,
> 然后报错;只填本机IP又会说找不到HOST。

如果只是本地网络的DNS, 可以不用做named.cache, 只要做本地ip和name的解析就可以了.

如果需要和internet连接, 可以在连接建立以后用 ' dig > named.cache ' 就可以了.

--
Zou Yu
 

>我在一台slackware主机中设LAN的关于俩个域的DNS,
>想在/etc/named.boot中俩个域如何设置。
>
>这样行吗:如两个域为: aaa.bbb.com 和 bbb.com
>         在named.boot中有:
>            primary  bbb.com    named.bbb
>            primary  aaa.bbb.com   named.aaa
>        即域 bbb.com 用named.bbb的区文件,而aaa.bbb.com子域
>         用named.aaa的区文件.
>  不知这样一来,有人试过否?
 
我做过一些,你说的方式可行,不过要在named.bbb中指向aaa.bbb.com子域.
具体方式是在named.bbb中加一条纪录:
aaa.bbb.com.    172800    IN    NS    DNS主机名
                (可不设)
 

>局域网中能否配置 DNS,DNS HOWTO 的方法似乎不行。
>

可以配置DNS。是的,DNS HOWTO中的东西有点“过时”,新鲜的内容可以在
www.dns.net/dnsrd 里找到,成堆的好文章可以参考,另外,在www.unixworld.com里
也有几篇文章可以参考,我就是参考这两处的文章,并在姚飞大侠的帮助下搞定DNS
的。
 

>> 还是作个DNS服务器吧,不麻烦,编写几个文件
>> (/etc/named.boot,/etc/host.conf,/etc/swwitch.conf,
>> /var/named.ca,/var/named.local,/var/named.hosts,/var/named.revhosts)而已,还
>> 可以依葫芦画瓢:-).
>>
 

>宿兄:
>首先谢谢你的关心,我老板要有你一半好我们公司的人就有福了。
>再一个,请你帮我看一下我的DNS,我把文件贴到后边了。我现在的情况是:
>运行nslookup时显示:
>*** Can't find server name for address 202.102.238.149:Non-existent host/domain
>*** Default servers are not available
>在Linux主机上ping
>ftp.kaifenginfo.net、news.kaifenginfo.net等都没问题,还可以ping
>到alex.kaifenginfo.net,而且还可以以ftp登录。但从其他机器ping不到上述地址。麻烦帮
>
>我看一下。那些HOWTO好象用处不大,是吧?  :-<
>
>
>Thanks
>                                                            alex wang
>
>

resolv.conf文件
search kaifenginfo.net
nameserver 202.102.238.149
-----------------------------------------------------
host.conf文件
order hosts,bind
multi on
-------------------------------------------------------
named.boot文件
;
; a caching only nameserver config
;
directory                              /var/named
cache           .                      named.ca
primary         0.0.127.in-addr.arpa   named.local
primary         238.102.202.in-addr.arpa  202.102.238
primary         kaifenginfo.net         kfinfo.net
-------------------------------------------------------------------------------------------
named.local文件
@       IN      SOA     kaifenginfo.net. root.kaifenginfo.net.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
                NS                    kaifenginfo.net.

1               PTR     localhost.
--------------------------------------------------------------------------------------------
202.102.238文件
@       IN      SOA     kaifenginfo.net. root.kaifenginfo.net.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
                NS                    kaifenginfo.net.

1        PTR                          kaifenginfo.net.
2        PTR                          alex.kaifenginfo.net.
----------------------------------------------------------------------------------------
kfinfo.net文件
@       IN      SOA     kaifenginfo.net. root.kaifenginfo.net.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
                NS                    kaifenginfo.net.
                MX                    10 kaifenginfo.net.

localhost         A                   127.0.0.1
kaifenginfo.net.  A                   202.102.238.149
ns              CNAME                 kaifenginfo.net.
ftp             CNAME                 kaifenginfo.net.
news            CNAME                 kaifenginfo.net.
mail            CNAME                 kaifenginfo.net.
alex              A                   202.102.238.148
-----------------------------------------------------------------------------------------
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
------------------------------------------------------------------------------------------
nsswitch.conf文件
#
# /etc/nsswitch.conf
#
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
#
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the
# next entry.
#
# Legal entries are:
#
# nisplus or nis+  Use NIS+ (NIS version 3)
# nis or yp  Use NIS (NIS version 2), also called YP
# dns   Use DNS (Domain Name Service)
# files   Use the local files
# [NOTFOUND=return] Stop searching if not found so far
#

passwd:     files nisplus nis
shadow:     files nisplus nis
group:      files nisplus nis

hosts:      files dns

services:   nisplus [NOTFOUND=return] files
networks:   nisplus [NOTFOUND=return] files
protocols:  nisplus [NOTFOUND=return] files
rpc:        nisplus [NOTFOUND=return] files
ethers:     nisplus [NOTFOUND=return] files
netmasks:   nisplus [NOTFOUND=return] files
bootparams: nisplus [NOTFOUND=return] files

netgroup:   nisplus

publickey:  nisplus

automount:  files nisplus
aliases:    files nisplus
-----------------------------------------------------------------------

我也感觉DNS-HOWTO讲的不清楚:-)

我看了一下你的几个配置文件,似乎有下面几个问题(我的理解也不一定准确,望各位
大侠批判!):

我认为你设定的域名是kaifenginfo.net.

1 我认为,SOA记录的格式是:
域名    IN     SOA    主机名    邮件地址(...)

容易搞错的地方是“主机名”。这里表示,DNS服务器位于那台机器上。

2 域名和主机名的界限不清晰。例如在kfinfo.net文件中:

ns              CNAME                 kaifenginfo.net.
ftp             CNAME                 kaifenginfo.net.
news            CNAME                 kaifenginfo.net.
mail            CNAME                 kaifenginfo.net.

我认为,kaifenginfo.net是域名,而这里应该写ns,ftp等服务器的名字,例如
ns.kaifenginfo.net,ftp.kaifenginfo.net等。
 

3 在各个文件中的NS记录似乎也有问题,也是主机名和域名混淆的问题。
                NS                    kaifenginfo.net.
                                         |
                                         ------这里填NS主机名

你可以到http://www.dns.net/dnsrd/docs 去看一下,那里有许多的好文章会帮助你,
比如;
DNS Database Files by Tom Yager
The Domain Name System by Tom Yager
Setting Up Your Own DNS by Gary Kessler
Style Guide for Zone Files by Paul Vixie

弄好了给大家说一下,大家好借鉴,先谢过你了!

Su Baochen
=====================================
Email: sbccyh@public.zbptt.sd.cn
homepage: http://www1.baoding.cn.net/~sbccyh
                   http://linux.acegroup.ml.org
 
 

本文转自中文Linux论坛

标签集:TAGS:
回复Comments() 点击Count()
喜欢就顶一下

回复Comments

{commentauthor}
{commentauthor}
{commenttime}
{commentnum}
{commentcontent}
作者:
{commentrecontent}