一、环境
1、系统版本
CentOS release 6.5 (Final)
2、软件版本
bind-libs-9.8.2-0.37.rc1.el6.x86_64bind-9.8.2-0.37.rc1.el6.x86_64 bind-utils-9.8.2-0.37.rc1.el6.x86_64
3、地址
10.10.66.121 主 10.10.66.122 从
二、安装配置
1、安装(主从一样)
yum -y install bind-libs bind-utils bind
2、建立相关目录
mkdir /data/named/ mkdir /data/log/named/ chown named:named /data/named/ -R chown named:named /data/log/named/ -R
2、配置
A、拷贝配置文件
cp -r /var/named/* /data/named/
B、撰写主配置文件/etc/named.conf(主、从)
acl wx { 10.57.66.0/24; }; acl zw { 10.10.2.0/24; }; options { listen-on port 53 { any; }; directory "/data/named"; dump-file "/data/named/data/cache_dump.db"; statistics-file "/data/named/data/named_stats.txt"; memstatistics-file "/data/named/data/named_mem_stats.txt"; dnssec-enable no; allow-query { wx;zw; }; allow-transfer { 10.10.66.122; }; #从库无需配置此参数 also-notify { 10.10.66.122; }; #从库无需配置此参数 recursion yes; notify yes; #从库无需配置此参数 tcp-clients 1000; }; controls{ inet 0.0.0.0 port 953 allow { localhost; } ; }; logging { category "default" { "normal"; }; category "general" { "normal"; }; category "database" { "normal"; }; category "security" { "normal"; }; category "config" { "normal"; }; category "resolver" { "normal"; }; category "xfer-in" { "normal"; }; category "xfer-out" { "normal"; }; category "notify" { "normal"; }; category "client" { "normal"; }; category "unmatched" { "normal"; }; category "network" { "normal"; }; category "update" { "normal"; }; category "queries" { "normal"; }; category "dispatch" { "normal"; }; category "dnssec" { "normal"; }; category "lame-servers" { "normal"; }; channel "normal" { file "/data/log/named/normal.log" versions 3 size 200m; severity debug 0; print-time yes; print-category yes; print-severity yes; }; }; zone "." IN { type hint; file "named.ca"; }; include "/etc/named.rfc1912.zones"; include "/etc/named.root.key";
C、在/etc/named.rfc1912.zones添加zone区域 (主)
zone "cmredis.com" { type master; file "cmredis.com.zone"; allow-update { none; }; };
D、在/etc/named.rfc1912.zones添加zone区域 (从)
zone "cmredis.com" { type slave; masters {10.10.66.121;}; file "slaves/cmredis.com.zone"; allow-update { none; }; };
E、撰写cmredis.com.zone文件(主)
vim /data/named/cmredis.com.zone $TTL 60 @ IN SOA cmredis.com. root ( 53 ; serial (d. adams) 3H ; refresh 15M ; retry 1W ; expiry 1D ) ; minimum IN NS ns.cmredis.com. @ IN NS dns2.cmredis.com. ns IN A 127.0.0.1 dns 1200 IN A 10.10.66.121 dns2 1200 IN A 10.10.66.122
三、检查配置文件、启动服务(主从)
1、检查配置
named-checkzone cmredis.com.zone /data/named/cmredis.com.zone /etc/init.d/named configtest
2、启动服务
/etc/init.d/named start chkconfig named on
PS:
在主库上添加删除A记录,从库没有同步过去,把从库的zone文件删掉,重启才重新拉取一份,原来是在master修改了记录时一定要修改serial! 只有master Serial大于slave时 slave才会同步
本文出自 “屌丝运维男” 博客,请务必保留此出处http://navyaijm.blog.51cto.com/4647068/1698305
原文地址:http://navyaijm.blog.51cto.com/4647068/1698305