此博文仅供学习之用,若文中有不足之处,请大家指正
例如我是搭建在集群上
master.chmei.com 192.168.0.50
slave1.chmei.com 192.168.0.51
slave2.chmei.com 192.168.0.52
slave3.chmei.com 192.168.0.53
slave4.chmei.com 192.168.0.54
做好虚拟机的初始化,保证网络可用
在主服务器(192.168.2.50)[我这里随机选一台机子做主服务器,我这里只是做个例子,也可建在这五台虚拟机以外的机子上]:
yum -y install bind-libs bind-utils bind
cd /etc/
mv named.conf named.conf.backup
vim named.conf
options {
listen-on port 53 { any; };
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; };
allow-recursion { 192.168.0.1/24; };
notify yes;
};
zone "." IN {
type hint;
file "named.ca";
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.loopback";
allow-transfer { none; };
};
zone "gzcd.com" IN {
type master;
file "chmei.com.zone";
allow-transfer { any; };
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "192.168.0.zone";
allow-transfer { any; };
};
chmod 640 named.conf
chown root:named named.conf
cd /var/named/
vim chmei.com.zone
$TTL 600
@INSOAmaster.chmei.com.admin.chmei.com. (
2015042701
2H
10M
7D
2D )
INNSmaster.chmei.com.
INNSslave1.chmei.com.
INNSslave2.chmei.com.
INNSslave3.chmei.com.
INNSslave4.chmei.com.
master.chmei.com.INA192.168.0.50
@INMX10www.chmei.com.
www.chmei.com.INA192.168.0.50
linux.chmei.com.INCNAMEwww.chmei.com.
slave1.chmei.com.INA192.168.0.51
slave2.chmei.com.INA192.168.0.52
slave3.chmei.com.INA192.168.0.53
slave4.chmei.com.INA192.168.0.54
chmod 640 chmei.com.zone
chown root:named chmei.com.zone
vim 117.21.226.zone
$TTL 600
@INSOAmaster.chmei.com.admin.chmei.com. (
2015042701
2H
10M
7D
2D )
INNSmaster.chmei.com.
INNSslave1.chmei.com.
INNSslave2.chmei.com.
INNSslave3.chmei.com.
INNSslave4.chmei.com.
$ORIGIN 0.168.192.in-addr.arpa.
50INPTRmaster.chmei.com.
50INPTRwww.chmei.com.
51INPTRslave1.chmei.com.
52INPTRslave2.chmei.com.
53INPTRslave3.chmei.com.
54INPTRslave4.chmei.com.
chmod 640 192.168.0.zone
chown root:named 192.168.0.zone
vim /etc/resolv.conf
nameserver 192.168.0.50
nameserver 192.168.0.1
四台从服务器
yum -y install bind-libs bind-utils bind
cd /etc/
mv named.conf named.conf.backup
vim named.conf
options {
listen-on port 53 { any; };
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;
};
zone "." IN {
type hint;
file "named.ca";
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.loopback";
};
zone "chmei.com" IN {
type slave;
file "slaves/chmei.com.zone";
masters { 192.168.0.50; };
};
zone "0.168.192.in-addr.arpa" IN {
type slave;
file "slaves/192.168.0.zone";
masters { 192.168.0.50; };
};
chmod 640 /etc/named.conf
chown root:named /etc/named.conf
vim /etc/resolv.conf
nameserver 192.168.0.51
nameserver 192.168.0.1
最后检查三台服务器的时间是否一致,防火墙是否允许互为通信,SELINUX最好处于关闭状态,最后三台服务器都启动named服务:service named start
chkconfig named on
chkconfig --list
使用host master.chmei.com host slave1.chmei.com host slave2.chmei.com等查看是否能反向解析成功,
能成功解析出IP地址即为配置成功。
关闭SELINUX:
setenforce 0 临时关闭,重启PC后失效
sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g‘ /etc/selinux/config 永久关闭
若不会设置防火墙,该PC也无机密,只是做练习之用,建议关闭防火墙:service iptables stop
本文出自 “我的小天堂” 博客,请务必保留此出处http://9918511.blog.51cto.com/9908511/1639349
原文:http://9918511.blog.51cto.com/9908511/1639349