分类: LINUX
2010-12-03 15:27:50
Bind基本配置
1、安装bind
下载bind-
#tar xvf bind-
#./configure –prefix=/app/named --disable-ipv6 --disable-openssl-version-check --enable-threads
#make
#make install
2、配置bind
生成rndc.conf文件
#/app/named/sbin/rndc-confgen > /app/named/etc/rndc.conf
生成named.conf文件
#tail -10 rndc.conf | head -9 | sed s/#\ //g > named.conf
创建/var/named,并且创建几个文件
第一:localhost.zone
$TTL 86400
$ORIGIN localhost.
@ 1D IN SOA @ root (
42 ; serial (d.
3H ; refresh
1W ; expiry
1D ) ; minimum
1D IN NS @
1D IN A 127.0.0.1
第二:named.local
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
第三:named.root
#/app/named/bin/dig > /var/named/named.root
第四:需要解析的域名test.zone
$ttl 1D
@ IN SOA test.com. root.test.com. (
1053891162
3H
1W
1D )
IN NS dns.test.com. #注意此处为dns服务器机器名
IN MX 5 dns.test.com. #注意此处为dns服务器机器名
www IN A 192.168.0.66
第五:域名的反向解析test.local
$TTL 86400
@ IN SOA test.com. root.test.com.(
20031001;
7200;
3600;
43200;
86400);
@ IN NS test.com.
第六:补充named.conf内容
options {
directory "/var/named"; #named区文件目录
pid-file "named.pid"; #进程id文件名
};
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 "test.com" IN {
type master;
file "test.zone";
allow-update { none; };
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "test.local";
allow-update { none; };
};
3、运行bind
#/app/named/sbin/named -gc /app/named/etc/named.conf
扩展一下,配置bind主从,很简单
在从dns服务器的named.conf中,相应的域名配置中
zone "test.com" IN {
type master;
file "test.zone";
allow-update { none; };
};
改为(红字部分)
zone "test.com" IN {
type slave;
file "test.zone";
allow-update { none; };
masters{主dns地址;};
};
更新主dns后,kill -1 bind进程,辅dns就会自动更新
chinaunix网友2010-12-05 15:15:39
很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com