BIND9 – 关于如何连接到主域的Noob问题

我很确定我正在做一些愚蠢的事情,但我们仍然要问。

我试图在我的LAN机器上创build“主机名”(例如,当你ping“克里斯”,克里斯的机器 – IP 12.34.56.78 – 回应)。 我通过一个带有bind9的Debian(lenny)服务器来执行此操作,并将此服务器用作LAN的主DNS服务器。

问题:我可以从其他机器ping whatever.chris chris ,但不能 chris 。 我究竟做错了什么?

我按照这些说明来设置bind9: http : //www.cahilig.net/2008/07/05/how-setup-lan-dns-server-using-bind9-under-debian-etch-and-ubuntu-804

文件:

在/ etc /主机名

 chris 

/ etc / hosts文件

 127.0.0.1 localhost 192.168.1.3 chris.chris chris # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts 

在/etc/resolv.conf

 Didn't touch this one, as resolvconf overwrites it 

/etc/bind/name.conf.local

 zone "chris" { type master; file "db.chris"; }; zone "1.168.192.in-addr.arpa" { type master; file "db.192.168.1"; }; 

/var/cache/bind/db.chris

 $TTL 604800 @ IN SOA main.chris. admin.chris. ( 2012051610 ;serial 04800 ;refresh 86400 ;retry 60 ;expire 604800 ;negative cache TTL ) @ IN NS main.chris. @ IN A 192.168.1.3 www IN A 192.168.1.3 main IN A 192.168.1.3 

/var/cache/bind/db.192.168.1

 $TTL 604800 @ IN SOA main.chris. admin.chris. ( 2012051606 ;serial 604800 ;refresh 86400 ;retry 60 ;expire 604800 ;negative cache TTL ) @ IN NS main.chris. 1 IN PTR chris. 

/etc/bind/named.conf.options

 options { directory "/var/cache/bind"; forwarders { 192.168.1.1; }; auth-nxdomain no; # conform to RFC1035 listen-on-v6 { any; }; }; 

我build议你把所有这些放在一个区域,让我们称之为“本地”,然后把主机添加到本地,如chris.local,john.local。 然后,你希望这些机器中的每一个最终search local在他们的/etc/resolv.conf ,这将使chris.local他们ping chris chris.local会自动尝试find一个IP地址为chris.local如果chris不是find。

通常你会让你的dhcp服务器向它们发送这个search指令,但是也可以使用resolvconf来configuration它

确保您的区域文件的权限是正确的。 我相信它需要chmod 644,或者是744.一旦你做了更改,你做:“/etc/init.d/named restart”另外,对于其他问题的任何提示检查你的/ var / log /消息的任何指针。

你的区域文件应该是这样的。

http://pastebin.com/cB9SCJH0

如果你想通过短名称(即不是完全合格的域名)进行dns查询,那么你在/etc/resolv.conf和“search”参数中。

searchchris

man 5 resolv.conf的细节