服务器 频道

UNIX下DNS服务器之创建篇(上)

与DNS配置相关的文件

    主要包含/etc/defaultdomain、/etc/nsswitch.conf、/etc/resolv.conf 三个文件权限只需root可读即可。

    1) /etc/defaultdomain
    "/etc/defaultdomain"文件给出确省域名,该文件内容为域名名称,例如:
 study.js.cn
 表示缺省域名为" study.js.cn ",以后仅使用某个主机名时,系统假设为缺省域中的主机。例如,"ping www"将被理解为"ping www.study.js.cn "。

    2) /etc/nsswitch.conf
    如果使用DNS,则必须在该文件的"HOST"一项中给出"DNS"。缺省为使用文件,即"FILES",该选项可以保留。

# /etc/nsswitch.files:
#
# An example file that could be copied over to /etc/nsswitch.conf; it
# does not use any naming service.
#
# "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:      files   dns
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

hosts: files dns 表示:将使用/etc/inet/hosts文件解析主机,如果无法解析主机名将使用DNS。

    3) /etc/resolv.conf
    该文件给出域名和域名服务器地址。

; /etc/resolv.conf file
domain study.js.cn ;域名
nameserver 61.155.107.131 ;域名服务器地址
;域名服务器地址可以给出多个

    至此一个基本的UNIX主域名服务器就建立好了。但需要特别说明的是,在master file里,dns.study.js.cn.后面的.,这个. 表示这是一个完整的纪录,否则服务器就会自动给你加上当前域,例如:www表示www.study.js.cn,而www.study.js.cn就会变成www.study.js.cn.study.js.cn,正确的表示方法可以是www或www.study.js.cn. 如果不给这个.足够的重视,就很容易出错。

0
相关文章