Ubuntu14.04 bind9配置

apt-get install bind9

配置域名: cn.archive.ubuntu.com
对应IP: 10.60.233.244

vim  /etc/bind/name.conf.default-zones 
在文件后面添加:
zone "archive.ubuntu.com" {
        type master;
        file "/etc/bind/db.archive.ubuntu.com";
};

zone "233.60.10.in-addr.arpa" {
        type master;
        file "/etc/bind/db.10";
};

1、添加正向解析:
vim /etc/bind/db.archive.ubuntu.com
创建文件并添加:
;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns.archive.ubuntu.com. root.archive.ubuntu.com. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      ns.archive.ubuntu.com.
@       IN      A       10.60.233.244
ns      IN      A       10.60.233.244
cn      IN      A       10.60.233.244

2、添加反向解析:
vim /etc/bind/db.10
创建文件并添加:
;
; BIND reverse data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns.archive.ubuntu.com. root.archive.ubuntu.com. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      archive.ubuntu.com.
1.0.0   IN      PTR     cn.archive.ubuntu.com.
244     IN      PTR     archive.ubuntu.com.
244     IN      PTR     www.archive.ubuntu.com.
244     IN      PTR     dns.archive.ubuntu.com.
244     IN      PTR     cn.archive.ubuntu.com.

修改 /etc/bind/named.conf.options :
如下设置:
        forwarders {
                8.8.8.8;
                8.8.4.4;
        };

        allow-query { any; };

OK, 重启服务 service bind9 restart  

测试:
root@trait:/etc/bind# nslookup cn.archive.ubuntu.com
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   cn.archive.ubuntu.com
Address: 10.60.233.244

或者:

root@trait:/etc/bind# host cn.archive.ubuntu.com 10.60.235.100
Using domain server:
Name: 10.60.235.100
Address: 10.60.235.100#53
Aliases: 

cn.archive.ubuntu.com has address 10.60.233.244
posted @ 2016-12-15 08:35  丹西  阅读(4029)  评论(1编辑  收藏  举报