bind9 在ubuntu上的簡單配置

1.安裝bind9python

sudo apt-get install bind9

2.編輯文件服務器

sudo vi /etc/bind/named.conf.local

加入字段:網絡

其中example是要配置的域名,第二個節爲反響映射ide

zone "example.com" {  
        type master;
        file "/etc/bind/zones/example.com.db";
        };

# This is the zone definition for reverse DNS. replace 0.168.192 with your network address in reverse notation - e.g my network address is 192.168.0
zone "0.168.192.in-addr.arpa" {
     type master;
     file "/etc/bind/zones/rev.0.168.192.in-addr.arpa";
};


3.編輯文件rest

配置網絡提供商的dns服務器
日誌

sudo vi /etc/bind/named.conf.options

forwarders {
      # Replace the address below with the address of your provider's DNS server
      123.123.123.123;
};

4.編輯example域名配置的文件code

sudo vi /etc/bind/zones/example.com.db

內容:
server

example.com.      IN      SOA     ns1.example.com. admin.example.com. (                                                                                                  
        2006081401
        28800
        3600
        604800
        38400
        )
example.com.      IN      NS              ns1.example.com.
example.com.      IN      MX     10       mta.example.com.
                 IN      A       192.168.37.160 
www              IN      A       192.168.37.160
mta              IN      A       192.168.37.3
ns1              IN      A       192.168.37.1
sudo vi /etc/bind/zones/rev.0.168.192.in-addr.arpa

@ IN SOA ns1.example.com. admin.example.com. (
                        2006081401;
                        28800; 
                        604800;
                        604800;
                        86400 
)

                     IN    NS     ns1.example.com.
1                    IN    PTR    example.com


5.編輯文件dns

sudo vi /etc/resolv.conf

search example.com
nameserver 192.168.0.1

6. 重啓bind9服務get

/etc/init.d/bind9 restart 生效

7.重啓後能夠查看系統日誌/var/log/syslog 是否出錯。

相關文章
相關標籤/搜索