温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

DNS服务器如何配置

发布时间:2021-11-16 16:39:32 来源:亿速云 阅读:144 作者:小新 栏目:云计算

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

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

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI