本文共 3043 字,大约阅读时间需要 10 分钟。
一、环境
1、系统版本
1 | CentOS release 6.5 (Final) |
2、软件版本
1 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、地址
1 2 | 10.10.66.121 主 10.10.66.122 从 |
二、安装配置
1、安装(主从一样)
1 | yum -y install bind-libs bind-utils bind |
2、建立相关目录
1 2 3 4 | mkdir /data/named/ mkdir /data/log/named/ chown named:named /data/named/ -R chown named:named /data/log/named/ -R |
2、配置
A、拷贝配置文件
1 | cp -r /var/named/ * /data/named/ |
B、撰写主配置文件/etc/named.conf(主、从)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 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区域 (主)
1 2 3 4 5 | zone "cmredis.com" { type master; file "cmredis.com.zone" ; allow-update { none; }; }; |
D、在/etc/named.rfc1912.zones添加zone区域 (从)
1 2 3 4 5 6 | zone "cmredis.com" { type slave; masters {10.10.66.121;}; file "slaves/cmredis.com.zone" ; allow-update { none; }; }; |
E、撰写cmredis.com.zone文件(主)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 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、检查配置
1 2 | named-checkzone cmredis.com.zone /data/named/cmredis .com.zone /etc/init .d /named configtest |
2、启动服务
1 2 | /etc/init .d /named start chkconfig named on |
PS:
在主库上添加删除A记录,从库没有同步过去,把从库的zone文件删掉,重启才重新拉取一份,原来是在master修改了记录时一定要修改serial! 只有master Serial大于slave时 slave才会同步
本文出自 “” 博客,请务必保留此出处