options {
default-key "rndc-key";
default-server 127.0.0.1;
default-port 953;
};
# End of rndc.conf
# Use with the following in named.conf, adjusting the allow list as needed:
# key "rndc-key" {
# algorithm hmac-md5;
# secret "y9xvvfQjdWv9f/Fo7wquBg==";
# };
#
# controls {
# inet 127.0.0.1 port 953
# allow { 127.0.0.1; } keys { "rndc-key"; };
# };
# End of named.conf
10.创建rndc.key文件。将rndc.conf文件中注释部分拷贝生成如下文件:
# vi /etc/rndc.key
key "rndc-key" {
algorithm hmac-md5;
secret "y9xvvfQjdWv9f/Fo7wquBg==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
11.创建named.conf配置文件。
# vi /etc/named.conf
option{directory "/var/named";};
zone "." IN {
type hint;
file "named.root";
};
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
zone "dream.com" IN {
type master;
file "dream.com";
allow-update { none;};
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "192.168.0";
allow-update { none; };
};
include "/etc/rndc.key";
12.创建/var/named目录
# mkdir /var/named
# cd /var/named
13.匿名登录到ftp站点FTP.RS.INTERNIC.NET,获取/domain目录下的named.root文件,将该文件置于/var/named目录下。
14.创建localhost文件
# vi localhost.zone
$TTL 86400
$ORIGIN localhost.
@ 1D IN SOA @ root (
42 ;
3H ;
15M ;
1W ;
1D ) ;
1D IN NS @
1D IN A 127.0.0.1
15.创建named.local文件
# vi named.local
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ;
28800 ;
14400 ;
3600000 ;
86400 ) ;
IN NS localhost.
1 IN PTR localhost.
16.创建dream.com文件
# vi dream.com
$TTL 86400
@ IN SOA dream.com root. www.dream.com.(
2003061800 ;
28800 ;
14400 ;
3600000 ;
86400 ) ;
IN NS dream.com.
IN A 192.168.0.125
IN MX 1 dream.com.
www IN A 192.168.0.125
ftp IN A 192.168.0.125
mail IN A 192.168.0.125
17.创建192.168.0文件
# vi 192.168.0
$TTL 86400
@ IN SOA dream.com. root.dream.com. (
2003061800 ;
28800 ;
14400 ;
3600000 ;
86400 ) ;
IN NS dream.com.
125 IN PTR www.dream.com.
125 IN PTR ftp.dream.com.
125 IN PTR mail.dream.com.
启动脚本我没建立,先检测
hostname报告mail.dream.com ,
# /usr/local/sbin/named-checkconf 居然报告互连网上的dream.com的信息,而我想要的是内网的邮件服务器的信息
# /usr/local/sbin/named-checkzone
dream.com /var/named/dream.com则报告
zone dream.com/IN :has no NS records
到底这是怎么一会事?
怎么样才能说明dns确实配置好了?
若是dns是192.168.0.125,也就是装bind本机自己做dns
则报告;;connection timed out;no servers could be reached
named -g报告
starting bind9.2.4rc4 -g
using 1 cpu
loading configuration from '/etc/named.conf'
no IPV6 interfaces found
listening on IPv4 interface lo,127.0.0.1#253
listening on IPv4 interface eth0 ,192.168.0.125#53
/etc/named.conf:16:undefined ACL 'zone'
loading configuration:not found
exiting (due to fatal error)
似乎已经接近成功
named -g显示
no IPv6 interface found
listening on IPv4 interface lo,127.0.0.1#53
listening on IPv4 interface lo,192.168.0.125#53
command channel listening on 127.0.0.1#953
ignoring config file logging statement due to -g option
zone 0.0.127.in-addr.arpa/IN :has no NS records
zone 0.168.192.in-addr.arpa/IN :has no NS records
zone dream.com/IN :has no NS records
zone localhost/IN :has no NS records
running
重新开个终端发现ps xua|grep named
发现只有named -g 和grep named两个在运行
我现在停止修改脚本,请诸位现在重新看看我的文件内容!!
named -g后host -a mail
报告Host mail no found:3(NXdomain)
Receiving 97 bytes from 1923168.0.125#53 in 406ms
但是ping mail.dream.com后还是可以报告
找到192.168.0.125这个地址的
到底rndc是怎么用来启动bind呢?怎么样才算是bind正常了呢?