sudo apt-get install bind9修改/etc/bind/named.conf.local
sudo vi /etc/bind/named.conf.local
在裏面加入以下內容(注意把domainname替換面你想要的),
zone "domainname.com" {
type master;
file "/etc/bind/zones/domainname.com.db";
};
zone "0.168.192.in-addr.arpa" {
type master;
file "/etc/bind/zones/rev.0.168.192.in-addr.arpa";
};
接下來編輯文件/etc/bind/named.conf.options, shell
sudo vi /etc/bind/named.conf.options在裏面加入如下內容,
sudo mkdir /etc/bind/zones
sudo vi /etc/bind/zones/domainname.com.db
domainname.com. IN SOA dns.domainname.com. admin.domainname.com. (sudo vi /etc/bind/zones/rev.0.168.192.in-addr.arpa在裏面輸入如下內容
修改/etc/resolv.conf
less
sudo vi /etc/resolv.conf在裏面輸入,
search domainname.com
nameserver 192.168.0.104
注:以上修改會在機器重啓後被覆蓋,
若是重啓機器後這次修改繼續生效的話,須要在文件
/etc/resolvconf/resolv.conf.d/base裏輸入以上內容,而且須要爲該機器設置靜態IP地址
如今能夠測試你的配置啦,
dom
dig example.com host dns host 192.168.0.102重啓DNS服務
sudo /etc/init.d/bind9 restart查看DNS系統日誌
cat /var/log/syslog|grep named|less