DNS服务器如何配置

85次阅读
没有评论

共计 3391 个字符,预计需要花费 9 分钟才能阅读完成。

这篇文章将为大家详细讲解有关 DNS 服务器如何配置,丸趣 TV 小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

BIND9(Solaris 10 中的 DNS 服务器是 BIND9)总共需要这些配置文件:

/etc/ 目录下的文件(这些文件的名字不可更改):

   /etc/named.conf———in.named daemon 的配置文件

   /etc/rndc.conf————BIND9 必须的配置文件

/etc/named/ 目录下的文件(这个目录名和文件名均可在 /etc/named.conf 文件中任意定义):

    named.root

    loop.back

   one.rzone

   one.zone

/*****************named.conf 文件的内容 ***********************/

// This is the /etc/named.boot (boot files) for the primary name server

// of the one.edu. domain.

//
首先定义配置文件的位置:

directory /etc/named

//
定义转发器,除了本机定义的域外其他所有请求都发向转发器 (非官方授权的 DNS 服务器基本上都要定义转发器)

forwarders {

     202.101.98.54;

     202.101.98.55;

     };

};

//
接下来指定根 DNS 服务器的配置文件,此文件可从网络下载:

zone . in {

     type hint;

     file named.root

};

//
本机负责解析的域的正向解析配置文件,此例中为 one.edu 域,配置文件为 one.zone

zone one.edu in {

     type master;

     file one.zone

};

//
本机负责解析的域的反向解析配置文件,此例中为 one.edu 域,配置文件为 one.zone

zone 1.168.192.in-addr.arpa in {

     type master;

     file one.rzone

};

// 环回反向解析配置文件

zone 0.0.127.in-addr.arpa in {

     type master;

     file loop.back

};

//
下面是 BIND9 专用的配置内容

// Use with the following in named.conf, adjusting the allow list as needed:

// See rndc-confgen command-manual

key rndc-key {

      algorithm hmac-md5;

      secret /cCelQY6sE40JIwQDtXf6g==

};

controls {

     inet * allow {any;} keys {rndc-key};

};

/*

controls {

      inet 127.0.0.1 port 953

           allow {127.0.0.1;} keys {rndc-key};

};*/

/*****************rndc.conf 文件的内容, 可用 rndc-confgen 命令生成所需内容 ******************/

key rndc-key {

     algorithm hmac-md5;

     secret /cCelQY6sE40JIwQDtXf6g==

};

options {

     default-key rndc-key

     default-server localhost;

     default-port 953;

};

server localhost {

     key rndc-key

};

/*****************/etc/named/ 目录中的文件 ****************************/


/********/etc/named/named.root**********/

这个文件内容从网络上下载,不看也罢


/********/etc/named/loop.back**********/

; /var/named/loop.back file for the primary name server.

;

; Start of Authority section

$ORIGIN 0.0.127.IN-ADDR.ARPA.

;

$TTL 8h

; The next line is very long, but is ONE line.

0.0.127.IN-ADDR.ARPA. IN SOA sys11.one.edu. root.sys11.one.edu. (

20011225 ; version number

10800 ; refresh (3hrs.)

3600 ; retry (1hr.)

432000 ; expire (5days)

86400 ) ; ttl (1day)

0.0.127.IN-ADDR.ARPA. IN NS sys11.one.edu.

1 IN PTR localhost.one.edu.

/********/ 关键是正向解析文件和反向解析文件 **********/
/********/etc/named/one.zone **********/


; /var/named/one.zone file for the one.edu. name server
; This file resolves hostnames to IP addresses in the one.edu. domain.
;
$ORIGIN one.edu.
; Time to live (post BIND 8.2) 8 hours
$TTL 8h
one.edu. IN SOA sys11.one.edu. root.sys11.one.edu. (
20011225 ; serial number
10800 ; refresh (3hrs)
3600 ; retry (1hr)
432000 ; expire (5days)
86400 ) ; ttl (1day)
;
; Domain Section
; 下面这条意思是 one.edu 这个域由 sys11.one.edu 这台主机负责解析
one.edu. IN NS sys11.one.edu.
;
; Host Information Section
; Example; sys12 IN A 192.168.1.2
; 下面就是主机和 IP 的对应关系了,sys11 IN A 192.168.1.1 就表示 sys11.one.edu 这个域名的 IP 为 192.168.1.1
sys11 IN A 192.168.1.1
sys12 IN A 192.168.1.2
sys13 IN A 192.168.1.3
sys17 IN A 192.168.1.17
gw IN A 192.168.1.254
xp IN A 192.168.1.11

/********/etc/named/one.rzone **********/

; /var/named/one.rzone file for the one.edu. primary name server
; This file resolves IP addresses to hostnames in the one.edu. domain.
;
$ORIGIN 1.168.192.IN-ADDR.ARPA.
; Time to live (post BIND 8.2) 8 hours
$TTL 8h
1.168.192.IN-ADDR.ARPA. IN SOA sys11.one.edu. root.sys11.one.edu. (
20011225 ; serial number
10800 ; refresh (3hrs)
3600 ; retry (1hr)
432000 ; expire (5days)
86400 ) ; ttl (1day)
1.168.192.IN-ADDR.ARPA. IN NS sys11.edu.
; In this section put ONLY the host portion of IP address for each
; host in the one.edu domain. ex. 1 IN PTR sys11.one.edu.
1 IN PTR sys11.one.edu.
2 IN PTR sys12.one.edu.
3 IN PTR sys13.one.edu.
17 IN PTR sys17.one.edu.
254 IN PTR gw.one.edu.

关于“DNS 服务器如何配置”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-08-25发表,共计3391字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)