root@client \~# systemctl stop NetworkManager
root@client \~# systemctl disable NetworkManager
一、配置反向解析
1、配置zone文件
root@dns named# vim /etc/named.rfc1912.zones
root@dns named# ls
root@dns named# cp -p named.loopback 192.168.8.zone
root@dns named# ls -lroot@dns named# vim 192.168.8.zone
2、检查配置文件
root@dns named# named-checkconf /etc/named.rfc1912.zones
root@dns named# named-checkzone 192.168.8.zone 192.168.8.zone
zone 192.168.8.zone/IN: loaded serial 0
OK
3、重启服务
root@dns named# systemctl restart named
4、临时更换
root@client \~# echo nameserver 192.168.8.135 > /etc/resolv.conf
5、客户端测试
root@client \~# yum -y install bind-utils.x86_64
5.1 域名返回IP
root@client \~# nslookup www.aaa.com
Server: 192.168.8.135
Address: 192.168.8.135#53Name: www.aaa.com
Address: 192.168.8.132
5.2 反向解析
root@client \~# nslookup 192.168.8.132
132.8.168.192.in-addr.arpa name = www.aaa.com.8.168.192.in-addr.arpa.
二、多域名解析
1、修改配置文件
root@dns named# vim /etc/named.rfc1912.zones
root@dns named# ls
root@dns named# cp -p named.localhost a.com.zone
root@dns named# cp -p named.localhost aa.com.zone
root@dns named# vim a.com.zone
root@dns named# vim aa.com.zone
root@dns named# systemctl restart named
2、客户端测试
root@client \~# echo nameserver 192.168.8.135 > /etc/resolv.conf
三、配置时间服务器
root@client \~# yum -y install ntpdate.x86_64
1、同步时间
root@client \~# ntpdate cn.ntp.org.cn
root@client \~# date
要求集群服务器主机的时间同步,不可能每一台主机都访问一次cn.ntp.org.cn 流量大,效率低,只有一台主机做内网的ntp服务,这台主机定时访问外网,集群内网中的机器和ntp服务器同步就可以了
2、搭建集群服务器
root@ntp \~# yum -y install ntp
root@ntp \~# vim /etc/ntp.conf 15行
root@ntp \~# ntpdate cn.ntp.org.cn
root@ntp \~# systemctl start ntpd
3、创建计划任务
root@ntp \~# crontab -e 每天四点同步时间
4、客户端同步时间
root@client \~# ntpdate 192.168.8.128
root@client \~# date -s "2009-7-30 12:34:56"
2009年 07月 30日 星期四 12:34:56 CST
root@client \~# date
2009年 07月 30日 星期四 12:35:01 CST
root@client \~# ntpdate 192.168.8.128
24 Jul 15:12:47 ntpdate3305: step time server 192.168.8.128 offset 472876652.819090 sec
root@client \~# date
2024年 07月 24日 星期三 15:12:50 CST
四、搭建主从架构
主服务 dns 192.168.8.135
从服务 slv 192.168.8.136
1、主从服务器和ntp服务器同步时间
root@slv \~# yum -y install ntpdate
root@slv \~# ntpdate 192.168.8.128
root@dns \~# yum -y install ntpdate
root@dns \~# ntpdate 192.168.8.128
2、下载dns依赖组件
root@slv \~# yum -y install bind
3、设置允许从服务器同步文件
root@dns \~# vim /etc/named.conf //16行
root@dns \~# named-checkconf /etc/named.conf
root@dns \~# systemctl restart named
4、从服务器设置允许访问
root@slv \~# vim /etc/named.conf
5、从服务器修改区域文件 zone
root@slv \~# vim /etc/named.rfc1912.zones //添加
root@slv \~# named-checkconf /etc/named.rfc1912.zones
root@slv \~# systemctl restart named
6、客户端测试
root@client \~# echo "nameserver 192.168.8.135" > /etc/resolv.conf
root@client \~# nslookup www.aaa.com
Server: 192.168.8.135
Address: 192.168.8.135#53Name: www.aaa.com
Address: 192.168.8.132root@client \~# echo "nameserver 192.168.8.136" > /etc/resolv.conf
root@client \~# nslookup www.aaa.com
Server: 192.168.8.136
Address: 192.168.8.136#53Name: www.aaa.com
Address: 192.168.8.132














