基于centos的bind安装配置
基于centos6.3 minimal版本
安装bind:
yum install bind*
www.2cto.com
修改named.conf文件
配置dns转发
vi /etc/named.conf
加入
forwarders {
8.8.8.8;
202.96.128.68;
};
www.2cto.com
配置区域文件
vi /etc/named.conf
加入
zone "test.com" in {
type slave;
file "test.com.zone";
masters {192.168.100.2;};
};
zone "100.168.192.in-addr.arpa" in {
type slave;
file "192.168.100.zone";
masters {192.168.100.2;};
};
这里配置是slave,所有不要手工建立解析区域文件,只要执行以下命令:
chown named:named /var/named
重启named服务后会自动在/var/named下建立区域文件
重启named服务
service named restart
www.2cto.com
我的named.conf文件内容
//
// named.conf
//
// provided by red hat bind package to configure the isc bind named(8) dns
// server as a caching only nameserver (as a localhost dns resolver only).
//
// see /usr/share/doc/bind*/sample/ for example named configuration files.
//
options {
listen-on port 53 { 127.0.0.1; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { localhost; };
recursion yes;
forwarders {
8.8.8.8;
202.96.128.68;
};
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* path to isc dlv key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." in {
type hint;
file "named.ca";
};
zone "test.com" in {
type slave;
file "test.com.zone";
masters {192.168.100.2;};
};
zone "100.168.192.in-addr.arpa" in {
type slave;
file "192.168.100.zone";
masters {192.168.100.2;};
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
同步后的查看解析区域文件/var/named/test.com.zone和/var/named/192.168.100.zone
test.com.zone文件内容:
$origin .
$ttl 3600 ; 1 hour
test.com in soa dns-wins. hostmaster. (
135 ; serial
900 ; refresh (15 minutes)
600 ; retry (10 minutes)
86400 ; expire (1 day)
3600 ; minimum (1 hour)
)
ns nms.test.com.
ns testdns.test.com.
ns dns-wins.test.com.
$origin gzluogang.edu.cn.
* a 192.168.100.18
127 a 192.168.100.31
2xia a 192.168.100.55
aedd a 192.168.100.56
dns-wins a 192.168.100.11
eaa a 192.168.100.54
fendd a 192.168.100.31
yontu cname lgjk.com
www.2cto.com
192.168.100.zone文件内容:
$origin .
$ttl 3600 ; 1 hour
100.168.192.in-addr.arpa in soa dns-wins. hostmaster. (
132 ; serial
900 ; refresh (15 minutes)
600 ; retry (10 minutes)
86400 ; expire (1 day)
3600 ; minimum (1 hour)
)
ns na.test.com.
ns dns-wins.test.com.
ns testdns.test.com.
$origin 100.168.192.in-addr.arpa.
11 ptr dns-wins.test.com.
123 ptr naou.test.com.
15 ptr db.test.com.
18 ptr yunzunx.test.com.
ptr jybb.test.com.
ptr www1.test.com.
19 ptr kse.test.com.
31 ptr xkw.test.com.
$origin test.com.
dns-wins a 192.168.100.11
na a 192.168.100.123
testdns a 192.168.100.69
www.2cto.com
若是配置的master,需手工建立正向解析区域文件和反向解析区域文件
cd /var/named
touch test.com.zone
touch 192.168.100.zone
查看同步日志:
more /var/log/messages
more /var/named/data/name.run
.syntaxhighlighter{padding-top:20px;padding-bottom:20px;}
申明:本教程内容由威凡网编辑整理并提供IT程序员分享学习,如文中有侵权行为,请与站长联系(QQ:254677821)!