操作环境:
Centos7系统两台
主DNS: 192.168.80.100
从DNS: 192.168.80.101
1、关闭防火墙和SElinux(两台虚拟机都要关闭)systemctl stop firewalld
setenforce 0
2、使用YUM安装ntp时间同步服务(两台虚拟机都要安装)yum install ntp -y
3、配置ntp服务vi /etc/ntp.conf
提示:在配置文件中添加以下内容
restrict 192.168.80.0 mask 255.255.255.0 nomodify notrap
server 127.127.1.0
fudge 127.127.1.0 stratum 8
4、实现主从时间同步systemctl start ntpd --启动时间同步服务
提示:从服务区器的时间同步服务不要启动,在从服务器上同步时间
ntpdate 192.168.80.100
5、使用YUM安装DNS服务(两台虚拟机都要安装)yum install bind -y
6、主服务器修改DNS配置文件
在主服务器上操作:vi /etc/named.conf
修改以下内容:
listen-on port 53 { any; };
allow-query { any; };
vi /etc/named.rfc1912.zones
提示:在末尾添以下内容
zone "hello.com" IN {
type master;
file "hello.com.zone";
allow-update { 192.168.80.101; };
also-notify { 192.168.80.101; };
};
zone "80.168.192.in-addr.arpa" IN {
type master;
file "hello.com.local";
allow-update { 192.168.80.101; };
also-notify { 192.168.80.101; };
};
cd /var/named
cp -p named.localhost hello.com.zone
--复制一个配置文件模板vi hello.com.zone
$TTL 1D
@ IN SOA hello.com. 18013882536.qq.com (
1 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.hello.com.
dns IN A 192.168.80.100
www IN A 192.168.80.101
ftp IN A 192.168.80.102
cp -p hello.com.zone hello.com.local
vi hello.com.local
named-checkconf --检查配置文件语法错误
systemctl start named --启动服务
netstat -anpt | grep named
7、从服务器修改配置文件vi /etc/named.conf
修改以下内容:
listen-on port 53 { any; };
allow-query { any; };
vi /etc/named.rfc1912.zones
zone "hello.com" IN {
type slave;
masters { 192.168.80.100; };
file "slaves/hello.com.zone";
};
zone "80.168.192.in-addr.arpa" IN {
type slave;
masters { 192.168.80.100; };
file "slaves/hello.com.local";
};
systemctl start named
原文地址:http://blog.51cto.com/13701082/2346769