分类:
2007-06-30 20:37:34
2. 相关文件
和DNS配置相关的文件包括:
· /etc/defaultdomain
· /etc/nsswitch.conf
· /etc/resolv.conf
· /etc/named.boot
· 以及和具体域名配置的"主机"、"本地网络"、"反向"、"Cache"等四个文件。
这里的四个文件的路径以及文件名均在文件"/etc/named.boot"中给出。
以下的示例中,路径使用"/var/named",四个文件分别为named.hosts,named.local,named.rev和named.ca。
以上文件权限只需root可读即可。
3. DNS具体配置说明
(1) /etc/defaultdomain "/etc/defaultdomain"文件给出确省域名,该文件内容为域名名称,例如: so.unis 表示缺省域名为"so.unis",以后仅使用某个主机名时,系统假设为缺省域中的主机。例如,"ping www"将被理解为"ping "。 (2) /etc/nsswitch.conf 如果使用DNS,则必须在该文件的"HOST"一项中给出"DNS"。缺省为使用文件,即"FILES",该选项可以保留。 例如: # /etc/nsswitch.files: … hosts: dns files …
(3) /etc/resolv.conf 该文件给出域名和域名服务器地址。 例如: ; /etc/resolv.conf file domain so.unis ;域名 nameserver 192.168.99.1 ;域名服务器地址 ;域名服务器地址可以给出多个
(4) /etc/named.boot 该文件指明DNS所需具体文件的路径和文件名。 例如: ; named.boot file directory /var/named ;文件所在路径,通常使用/var/named cache . named.ca ;dns cache file,其中点表示当前域 primary so.unis named.hosts ;dns host file secondary unis 192.168.0.1 ;另一个域"unis"的DNS地址 primary 0.0.127.in-addr.arpa named.local ;local dns file,127.0.0.0为本地子网 primary 99.168.192.in-addr.arpa named.rev ;named rev file,本子网为192.168.99.0
(5) /var/named/named.hosts 说明如下: ; named.hosts - dns file ; ; SOA rec so.unis. IN SOA dns.so.unis. root.dns.so.unis. ( ;SOA记录, ;dns.so.unis为DNS对应的主机 ;root.dns.so.unis为主机的管理员用户为root ;以上的域、主机及用户后均需要跟上点 1998120816 ;dns序列号,可以使用年月日时 10800 ;refresh after 3 hours 10800 ;retry after 3 hour 604800 ;expire after 1 week 86400) ;minimum TTL of 1 day so.unis. IN NS dns.so.unis. ;name server ;以下为主机/地址对应表 dns.so.unis. IN A 192.168.99.1 localhost IN A 127.0.0.1 dbserver.so.unis. IN A 192.168.99.2 . IN A 192.168.99.3 mail.so.unis. IN A 192.168.99.4 ftp.so.unis IN A 192.168.99.3 ;mail exchange so.unis IN MX 1 mail.so.unis.
(6) /var/named/named.local ; named.local - dns file ; ; SOA rec 0.0.127.in-addr.arpa. IN SOA dns.so.unis. root.dns.so.unis. ( 1998120816 ;serial number 10800 ;refresh after 3 hours 10800 ;retry after 3 hour 604800 ;expire after 1 week 86400) ;minimum TTL of 1 day ;name server 0.0.127.in-addr.arpa. IN NS dns.so.unis. 1.0.0.127.in-addr.arpa. IN PTR localhost
(7) /var/named/named.rev ; named.rev - dns file ; ; SOA rec 99.168.192.in-addr.arpa. IN SOA dns.so.unis. root.dns.so.unis. ( 19981208 ;serial number 10800 ;refresh after 3 hours 10800 ;retry after 3 hour 604800 ;expire after 1 week 86400) ;minimum TTL of 1 day ;name server 99.168.192.in-addr.arpa. IN NS dns.so.unis. 1.99.168.192.in-addr.arpa. IN PTR dns.so.unis.
(8) /var/named/named.ca ; named.ca - dns cache file ; @ IN SOA dns.so.unis. root.dns.so.unis. ( 1998120815 ;serial number 10800 ;refresh after 3 hours 3600 ;retry after 3 hour 604800 ;expire after 1 week 86400) ;minimum TTL of 1 day ; dns.so.unis. 999999 IN A 192.168.99.1 99.168.192.in-addr.arpa. IN NS so.unis. dns.so.unis. IN A 192.168.99.1 4. 配置文件示例 温州瓯海法院DNS配置: 域名为:oh.wz.zj,主子网为203.3.6.0,DNS地址为203.3.6.1,主机名为"ohfy"。 文件内容如下:
(1) /etc/defaultdomain oh.wz.zj
(2) /etc/nsswitch.conf # # /etc/nsswitch.files: # # "hosts:" and "services:" in this file are used only if the # /etc/netconfig file has a "-" for nametoaddr_libs of "inet" transports.
passwd: files group: files hosts: dns files networks: files protocols: files rpc: files ethers: files netmasks: files bootparams: files publickey: files # At present there isn't a 'files' backend for netgroup; the system will # figure it out pretty quickly, and won't use netgroups at all. netgroup: files automount: files aliases: files services: files sendmailvars: files (3) /etc/resolv.conf ; ; /etc/resolv.conf file for dnsmaster (E450) ; written in 1998-12-8, UNIS ;
domain oh.wz.zj ;This domain name nameserver 203.3.6.1 ;this domain name server
;nameserver 202.x.x.x ;parent dns server (4) /etc/named.boot ; ; /etc/named.boot file for dnsmaster (E450) ; written in 1998-12-8, UNIS ; directory /var/named cache . named.ca ;dns cache file primary oh.wz.zj named.hosts ;dns host file ;secondary wz.zj 202.x.x.x primary 0.0.127.in-addr.arpa named.local ;local dns file primary 6.3.203.in-addr.arpa named.rev ;named rev file (5) /var/named/named.ca ; ; named.ca - dns cache file ; written in 1998-12-8, tusc ;
@ IN SOA ohfy.oh.wz.zj. root.ohfy.oh.wz.zj. ( 1998120815 ;serial number 10800 ;refresh after 3 hours 3600 ; retry after 3 hour 604800 ; expire after 1 week 86400) ; minimum TTL of 1 day ; ohfy.oh.wz.zj. 999999 IN A 203.3.6.1 ; ;wz. IN NS oh.wz. 6.3.203.in-addr.arpa. IN NS oh.wz.zj. ohfy.oh.wz.zj. IN A 203.3.6.1 (6) /var/named/named.hosts ; ; db.oh - dns file ; written in 1998-12-8, tusc ;
; ; SOA rec oh.wz.zj. IN SOA ohfy.oh.wz.zj. root.ohfy.oh.wz.zj. ( 1998120816 ;serial number 10800 ;refresh after 3 hours 10800 ; retry after 3 hour 604800 ; expire after 1 week 86400) ; minimum TTL of 1 day ;name server oh.wz.zj. IN NS ohfy.oh.wz.zj.
;address ohfy.oh.wz.zj. IN A 203.3.6.1 localhost IN A 127.0.0.1 dbserver.oh.wz.zj. IN A 203.3.6.1
;wz.zj. IN A 202.x.x.x ;parent dns server
;mail exchange oh.wz.zj IN MX 1 mail.oh.wz.zj. (7) /var/named/named.local ; ; named.local - dns file ; written in 1998-12-8, tusc ;
; SOA rec 0.0.127.in-addr.arpa. IN SOA ohfy.oh.wz.zj. root.ohfy.oh.wz.zj. ( 1998120816 ;serial number 10800 ;refresh after 3 hours 10800 ;retry after 3 hour 604800 ;expire after 1 week 86400) ;minimum TTL of 1 day ;name server 0.0.127.in-addr.arpa. IN NS ohfy.oh.wz.zj. 1.0.0.127.in-addr.arpa. IN PTR localhost (8) /var/named/named.rev ; ; oh.rev - dns file ; written in 1998-12-8, tusc ;
; SOA rec 6.3.203.in-addr.arpa. IN SOA ohfy.oh.wz.zj. root.ohfy.oh.wz.zj. ( 19981208 ;serial number 10800 ;refresh after 3 hours 10800 ;retry after 3 hour 604800 ;expire after 1 week 86400) ;minimum TTL of 1 day ;name server 6.3.203.in-addr.arpa. IN NS ohfy.oh.wz.zj. 1.6.3.203.in-addr.arpa. IN PTR ohfy.oh.wz.zj.