如何在 ubuntu 上將 Bind9 設定為名稱伺服器?

如何在 ubuntu 上將 Bind9 設定為名稱伺服器?

我想設定自己的 dns 伺服器 ns1.myhostingdomain.com 和 ns2.myhostingdomain.com
我有兩台單獨的伺服器可供使用,一台作為主伺服器,另一台則是從屬伺服器。我的目標是將其設定為網站託管設定。我希望能夠新增網域(區域),然後將新購買的(託管)網域指向 ns1.myhostingdomain.com 和 ns2.myhostingdomain.com

我想我會先從主設備開始,而不添加從設備,然後一旦主設備工作,我就會嘗試讓從設備工作。我在 ubuntu 9.10(業力)上安裝了bind9,
我猜它是部分配置的。到目前為止,我已經完成了以下操作:

修改:/etc/bind/named.conf.options - 將轉發器更改為位於我的ns1.myhostingdomain.com 伺服器之上的名稱伺服器(主機名稱實際上不是ns1 ,而是poseidon。

options {
    directory "/var/cache/bind";

    // If there is a firewall between you and nameservers you want
    // to talk to, you may need to fix the firewall to allow multiple
    // ports to talk.  See http://www.kb.cert.org/vuls/id/800113

    // If your ISP provided one or more IP addresses for stable
    // nameservers, you probably want to use them as forwarders.
    // Uncomment the following block, and insert the addresses replacing
    // the all-0's placeholder.

    forwarders {
            69.20.95.4;
            65.61.188.4;
    };

    auth-nxdomain no;    # conform to RFC1035
    listen-on-v6 { any; };
};


我向 /etc/bind/named.conf.local 新增了一個區域

#start_zone myhostingdomain.com
zone "myhostingdomain.com" {
        type master;
        file "/etc/bind/zones/myhostingdomain.com.db";
};

然後我建立了區域檔案 /etc/bind/zones/myhostingdomain.com.db

;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns1.myhostingdomain.com. dnsadmin.myhostingdomain.com. (
                        20100809001     ; Serial
                        1H              ; Refresh
                        15M             ; Retry
                        4W              ; Expire
                        1H              ; Negative Cache TTL
                        )
;
@       IN      NS      ns1.myhostingdomain.com.
@       IN      NS      ns2.myhostingdomain.com.
@       IN      A       184.106.207.45
ns1     IN      A       184.106.207.45
ns2     IN      A       184.106.229.136

我是否遺漏了什麼或我這樣做完全錯誤?

答案1

您的區域是否在註冊商層級指向您的 DNS 伺服器? Adig +trace ns1.myhostingdomain.com應該為您提供更多資訊以及輸出cat /etc/resolv.conf

答案2

重新啟動綁定,檢查系統日誌中是否有錯誤,然後就完成了。

作為保護系統的步驟,您可能應該將遞歸限制為僅您的位址空間。

options {
    ...
    // uncomment this section to limit recursion to internal hosts
    allow-recursion {
        localhost;
        10.0.0.0/8;
        172.16.0.0/12;
        192.168.0.0/16;
    };
    ...
};

相關內容