
我是 Bind 9 的新手。
named.conf.local :
//
// Do any local configuration here
//
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
zone "ejemplo.com" {
type master;
file "/var/lib/bind/db.ejemplo.com.hosts";
};
db.ejemplo.com.hosts :
;
; BIND Database file for ejemplo.com zone
;
@ IN SOA ejemplo.com. hostmaster.ejemplo.com. (
2011091601 ; serial number
3600 ; refresh
600 ; retry
1209600 ; expire
3600 ) ; default TTL
;
IN NS ns.ejemplo.com.
IN MX 10 mail.ejemplo.com.
IN TXT ( "v=spf1 mx ~all" )
;
localhost A 127.0.0.1
ns A 192.168.200.250
mail A 192.168.200.251
www A 192.168.200.252
這是我的resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
當我嘗試這樣做時,host ejemplo.com
結果是:
Host ejemplo.com not found: 2(SERVFAIL)
答案1
首先,你的文件db.ejemplo.com.hosts
沒有.它確實有該名稱的、、 和記錄,但由於您不帶參數運行,因此它會搜尋該記錄。您需要新增該記錄(或新增到您的主機命令)。A
ejemplo.com
MX
NS
TXT
host
A
A
-t mx
其次,SERVFAIL
主機輸出中的消息意味著您的配置有問題。你的帖子不包含日誌,所以我不能說什麼。檢查您的系統日誌,看看是否找到來自以下位置的任何日誌條目named
:如果您無法弄清楚它們,請將它們發佈在這裡。
答案2
在沒有看到或了解更多設定的情況下,我會進行一些猜測:]
檢查中的選項named.conf.local
options {
// listen-on is the IP of the server that is
// accessible to the network. This allows all
// machines on the 192.168.200.* network to use
// "this" DNS.
listen-on { 192.168.200.250; };
// forwarders allows this DNS to perform domain
// name look-ups for domains not managed by bind
forwarders { 127.0.0.1; };
}
用於db.ejemplo.com.hosts
新增一筆A
記錄。您的設定與我所做的略有不同,因此這可能會略有錯誤。
ejemplo.com IN A 192.168.200.250
或者可能:
@ IN A 192.168.200.250
在 中/etc/resolv.conf
,首先為您的伺服器設定 IP,然後新增您的 ISP DNS,以便 Bind 可以找到它不管理的網域。
nameserver 192.168.200.250
nameserver IP.OF.YOUR.ISP.DNS
nameserver ANOTHER.ISP.DNS
您還需要重新啟動綁定才能看到這些變更。
之後,您的伺服器(運行有bind的機器)應該能夠找到ejemplo.com
.如果您在 LAN 上的電腦上設定主 DNS,192.168.200.250
它們也將能夠找到ejemplo.com
,它們也應該能夠看到 LAN 之外的每個人。