yum install bind bind-chroot bind-utils
现在主要来实现主、从域名服务器,智能解析-分离解析功能。还有 域名应用实例 主要特例:基于域名解析的负载均衡,泛域名解析,子域授权。
二 环境拓扑
三 主从复制过程
master DNS服务器更新完配置后,首先会向slave DNS服务器发送notify消息。随后slave DNS服务器向master DNS服务器发送SOA查询请求,主DNS服务器返回结果给从DNS服务器,slave DNS服务器会对比其serial,如果小于自己的serial就结束同步过程。如果返回的查询结果中的serial号比自己的大,向master DNS服务器发送zone transfer请求,master DNS响应后会发送结果,slave DNS服务器接收数据,完成更新。
四 bind配置过程
1.将主从DNS服务器的域名设置成自己的ipaddress
master的/etc/reslov.conf加入:nameserver 192.168.4.44
slave的/etc/reslov.conf加入:nameserver 192.168.4.70
2.配置master DNS服务器
2.1 其/etc/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 {any;}; //监听ip,192.168.4.44 172.16.100.80
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 { any; };
recursion yes;
forwarders {221.130.13.133;}; 转发给上级DNS
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;
};
};
//172.16.100.0/24模拟内网,192.168.4.0/24模拟外网。
key "lan" {
algorithm hmac-md5 ;
secret "1Zgap+bwH5Yjtj0mo+Bj9g==";
};
key "wan"{
algorithm hmac-md5;
secret "1TK0ThAdgiQ8IrJBm+SQZA==";
};
view "lan" {
match-clients { 172.16.100.0/24; }; //匹配客户端
server 172.16.100.70 {keys "lan";}; //slave服务器地址
allow-transfer {key lan;};
include "/etc/named/lan.conf"; //zone配置文件
};
view "wan"{
match-clients { any; };
server 192.168.4.70 {keys wan;};
allow-transfer {key wan;};
include "/etc/named/wan.conf";
};