创建named文件夹:
# mkdir /opt/bind/var/named
进入named文件夹
# cd /opt/bind/var/named/
写入以下内容
# vi localhost.zone
写入以下内容:
$TTL 86400
$ORIGIN localhost.
@ 1D IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
1D IN NS @
1D IN A 127.0.0.1
将跟服务器的信息导入到/opt/bind/var/named/named.ca文件中
# dig -t NS . >/opt/bind/var/named/named.ca
创建文件named.local
#vi named.local
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.
创建linuxidc.zone
# vi linuxidc.zone
$TTL 86400
@ IN SOA linuxidc.com. root.linuxidc.com. (
57 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS dns.linuxidc.com.
IN MX 5 mail
dns IN A 121.101.211.72
dns1 IN A 121.101.211.72
dns2 IN A 121.101.211.74
www IN A 121.101.211.76
创建88181.zone
#vi 88181.zone
$TTL 86400
@ IN SOA 88181.com. root.88181.com. (
57 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS dns.88181.com.
IN MX 5 mail
dns IN A 121.101.211.72
dns1 IN A 121.101.211.72
dns2 IN A 121.101.211.74
www IN A 192.168.1.179
特别注意:bind的配置文档是区分大小写的。
下面就可以启动bind来测试安装是否成功了
# /opt/bind/sbin/named –gc /opt/bind/etc/named.conf &
加 –gc 参数,可以显示出启动日志,以便出错排查。
如果运行结果最后一行显示
Running
表明安装并启动成功。
测试rndc命令 /opt/bind/sbin/rndc status,正确的话应该有状态提示,我一般是直接编辑vim /root/.bashrc加进一个alias rndc9='/opt/bind/sbin/rndc'
把named 添加到启动项,随操作系统一起启动。
# cd /etc/rc.d
# vim rc.local
在最后添加以下内容
/opt/bind/sbin/named /opt/bind/etc/named.conf &
退出保存。
可以尝试重启服务器,然后用命令nslookup及dig测试,或用pa axu | grep named,结束此服务用命令killall named
附加从DNS配置文件:
key "rndc-key" {
algorithm hmac-md5;
secret "c97aVpbK9mWdlbefliG7qg==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
options {
directory "/opt/bind/var/named";
};
zone "." IN {
type hint;
file "named.ca";
};
zone "localhost" IN {
type master;
file "localhost.zone";
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
zone "linuxidc.com" IN {
type slave;
file "slaves/linuxidc.salve";
masters{192.168.1.179;};
};
zone "88181.com" IN {
type slave;
file "slaves/88181.salve";
masters{192.168.1.179;};
CentOS 5.2下安装Bind9.6(2)
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:http://www.heiqu.com/f7c9c198492ea2229dac0454210789ef.html