CentOS 7 编译安装DNS服务器bind

网上大部分教程使用yum安装,但是我这边用该方法安装后启动不起来,具体原因不详。目前是使用源码安装,使用的版本是bind-9.9.9-P6

root@localhost:opt$ wget ftp://ftp.isc.org/isc/bind9/9.9.9-P6/bind-9.9.9-P6.tar.gz
root@localhost:opt$ tar -zvxf bind-9.9.9-P6.tar.gz 
root@localhost:opt$ cd bind-9.9.9-P6/
root@localhost:bind-9.9.9-P6$ ./configure
root@localhost:bind-9.9.9-P6$ make
root@localhost:bind-9.9.9-P6$ make install

添加/etc/named.conf

root@localhost:bind-9.9.9-P6$ cat /etc/named.conf
options {
        directory "/var/named";
        listen-on port 53 { 10.8.227.205; };
        listen-on-v6 port 53 {  2002:9ba:b4e:6:250:56ff:fe92:299c; };
        #allow-query { any; };
    allow-query-cache { any; };
//  allow-transfer { none; };
    forwarders {};
};

zone "163.com" IN {
    type master;
    file "163.com.zone";
};

zone "lipltest.com" IN {
    type master;
    file "lipltest.com.zone";
};
root@localhost:bind-9.9.9-P6$ 

这里配置了两个域名。

创建/var/named目录,新增163.com.zone lipltest.com.zone两个文件。

root@localhost:named$ cat 163.com.zone 
$TTL   86400
@   IN SOA  @ root (
42  ; serial (d. adams)
3H  ; refresh
15M ; retry
1W  ; expiry
1D )    ; minimum

    IN NS   @
;   IN A 127.0.0.1
    IN AAAA ::1
*   IN A 36.250.74.155
*       IN A 36.250.74.156
*       IN A 223.94.95.135
*       IN A 223.94.95.136
root@localhost:named$ cat lipltest.com.zone 
$TTL   86400
@   IN SOA  @ root (
42  ; serial (d. adams)
3H  ; refresh
15M ; retry
1W  ; expiry
1D )    ; minimum

    IN NS   @
    IN AAAA 2002:9ba:b4e:6:250:56ff:fe92:777e
    IN A 10.8.227.205
root@localhost:named$ 

启动测试:

named -g

在10.8.227.80设置dns服务器为10.8.227.205。 然后再10.8.227.80执行:

root@ubuntu:test# dig lipltest.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> lipltest.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1762
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;lipltest.com.          IN  A

;; ANSWER SECTION:
lipltest.com.       86400   IN  A   10.8.227.205

;; AUTHORITY SECTION:
lipltest.com.       86400   IN  NS  lipltest.com.

;; ADDITIONAL SECTION:
lipltest.com.       86400   IN  AAAA    2002:9ba:b4e:6:250:56ff:fe92:777e

;; Query time: 2 msec
;; SERVER: 10.8.227.205#53(10.8.227.205)
;; WHEN: Wed Feb 28 15:58:10 2018
;; MSG SIZE  rcvd: 88

你可能感兴趣的:(工具与环境)