Linux

Bind9 named.conf 文件中的錯誤。綁定不會開始

  • May 17, 2018

我正在嘗試在 Ubuntu Server 機器(10.04)上設置 DNS 伺服器。我在 named.conf.local 中配置了一個條目來測試它,但是在嘗試重新啟動 bind9 時出現以下錯誤:

* Starting domain name service... bind9                                 [fail]

所以我檢查了 syslog 的輸出,這就是我得到的。

May 20 18:11:13 empression-server1 named[4700]: starting BIND 9.7.0-P1 -u bind
May 20 18:11:13 empression-server1 named[4700]: built with '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--sysconfdir=/etc/bind' '--localstatedir=/var' '--enable-threads' '--enable-largefile' '--with-libtool' '--enable-shared' '--enable-static' '--with-openssl=/usr' '--with-gssapi=/usr' '--with-gnu-ld' '--with-dlz-postgres=no' '--with-dlz-mysql=no' '--with-dlz-bdb=yes' '--with-dlz-filesystem=yes' '--with-dlz-ldap=yes' '--with-dlz-stub=yes' '--with-geoip=/usr' '--enable-ipv6' 'CFLAGS=-fno-strict-aliasing -DDIG_SIGCHASE -O2' 'LDFLAGS=-Wl,-Bsymbolic-functions' 'CPPFLAGS='
May 20 18:11:13 empression-server1 named[4700]: adjusted limit on open files from 1024 to 1048576
May 20 18:11:13 empression-server1 named[4700]: found 4 CPUs, using 4 worker threads
May 20 18:11:13 empression-server1 named[4700]: using up to 4096 sockets
May 20 18:11:13 empression-server1 named[4700]: loading configuration from '/etc/bind/named.conf'
May 20 18:11:13 empression-server1 named[4700]: /etc/bind/named.conf:10: missing ';' before 'include'
May 20 18:11:13 empression-server1 named[4700]: loading configuration: failure
May 20 18:11:13 empression-server1 named[4700]: exiting (due to fatal error)

所以它認為我在預設的 named.conf 文件中有一個錯誤,這非常荒謬。我瀏覽了它並刪除了一個空白行,只是為了它的地獄,但我看不出它是如何認為那裡有錯誤的。請注意,在此之前,我在 named.conf.local 中確實有一個錯誤,但它在 syslog 中正確顯示並且我修復了它,因此它報告了正確的文件。這是named.conf的內容:

// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the 
// structure of BIND configuration files in Debian, *BEFORE* you customize 
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";

假設第 10 行是 的最後一行named.conf,則此錯誤可能是由於 中的最後一個選項缺少分號造成的named.conf.local

如果您在區域描述之後錯過了 named.conf.local 中的分號,則可能會發生這種情況。嘗試在這樣的括號後添加它 };

引用自:https://serverfault.com/questions/143924