RHEL5+bind9简单快速搭建DNS服务器

服务器IP:192.168.191.3

测试域名:

2,软件包(用的安装盘自带的RPM包安装):

#rpm -ivh bind-libs-9.3.6-4.P1.el5.rpm
#rpm -ivh bind-utils-9.3.6-4.P1.el5.rpm
#rpm -ivh bind-9.3.6-4.P1.el5.rpm

3,建立bind用到的zone file目录

#mkdir /var/bind

4,安装好程序之后,生成rndc.conf和rndc.key文件

#/usr/sbin/rndc-confgen > /etc/rndc.conf

#cat /etc/rndc.conf
# Start of rndc.conf
key "rndckey" {
        algorithm hmac-md5;
        secret "kViQTHXyvhfaP8nZsb8kcg==";
};

options {
        default-key "rndckey";
        default-server 127.0.0.1;
        default-port 953;
};
# End of rndc.conf


#cat /etc/rndc.conf > /etc/rndc.key

(然后把之前rndc.conf中没有注释的几行删掉,再把下面的有注释的留下,并取消注释)
#cat /etc/rndc.key

# Start of rndc.conf

# Use with the following in named.conf, adjusting the allow list as needed:
 key "rndckey" {
        algorithm hmac-md5;
        secret "kViQTHXyvhfaP8nZsb8kcg==";
 };

controls {
        inet 127.0.0.1 port 953
                allow { 127.0.0.1; } keys { "rndckey"; };
 };
# End of named.conf

5,建立/etc/named.conf文件

#cat /etc/named.conf

options{
        directory "/var/bind";
        allow-query{any;};
};

zone "."{
        type hint;
        file "named.ca";
};

zone "baidu.org.tw"{
        type master;
        file "named.baidu.org.tw";
        allow-update {none;};
};

zone "191.168.192.in-addr.arpa"{
        type master;
        file "named.192.168.191";
};

include "/etc/rndc.key";


6,建立DNS根查询地址文件

#dig > /var/bind/named.ca

#cat /var/bind/named.ca

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5 <<>> -t NS
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19763
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 15

;; QUESTION SECTION:
;.                              IN      NS

;; ANSWER SECTION:
.                       59186   IN      NS      c.root-servers.net.
.                       59186   IN      NS      m.root-servers.net.
.                       59186   IN      NS      f.root-servers.net.
.                       59186   IN      NS      d.root-servers.net.
.                       59186   IN      NS      a.root-servers.net.
.                       59186   IN      NS      e.root-servers.net.
.                       59186   IN      NS      g.root-servers.net.
.                       59186   IN      NS      l.root-servers.net.
.                       59186   IN      NS      j.root-servers.net.
.                       59186   IN      NS      b.root-servers.net.
.                       59186   IN      NS      k.root-servers.net.
.                       59186   IN      NS      i.root-servers.net.
.                       59186   IN      NS      h.root-servers.net.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wygygj.html