种地 发表于 2024-8-16 16:42:48

2024.7.24(反向解析、时间同步、主从架构)

# systemctl stop NetworkManager
# systemctl disable NetworkManager
一、设置反向解析

1、设置zone文件

   # vim /etc/named.rfc1912.zones
https://i-blog.csdnimg.cn/direct/f7233e304ae642499511b39b44715f97.png
# ls
# cp -p named.loopback 192.168.8.zone
# ls -l
https://i-blog.csdnimg.cn/direct/e8c4e6d795054cf9bc9f2345d7959dd0.png
# vim 192.168.8.zone
https://i-blog.csdnimg.cn/direct/d719148e98ac4d35afea296e6af14dad.png
2、检查设置文件

   # named-checkconf /etc/named.rfc1912.zones
# named-checkzone 192.168.8.zone 192.168.8.zone
zone 192.168.8.zone/IN: loaded serial 0
OK
3、重启服务

   # systemctl restart named
4、临时更换

   # echo nameserver  192.168.8.135 > /etc/resolv.conf
5、客户端测试

   # yum -y install bind-utils.x86_64
5.1 域名返回IP

   # nslookup www.aaa.com     
Server:        192.168.8.135
Address:    192.168.8.135#53
Name:    www.aaa.com
Address: 192.168.8.132
5.2 反向解析

   # nslookup 192.168.8.132
132.8.168.192.in-addr.arpa    name = www.aaa.com.8.168.192.in-addr.arpa.
https://i-blog.csdnimg.cn/direct/56aec0dde898426bb8aef3ea5fad5876.png
二、多域名解析

1、修改设置文件

   # vim /etc/named.rfc1912.zones
https://i-blog.csdnimg.cn/direct/0b8348b1c48f4367802cc80e9cdbfec6.png
# ls
# cp -p named.localhost a.com.zone
# cp -p named.localhost aa.com.zone
# vim a.com.zone
https://i-blog.csdnimg.cn/direct/b4fdbe3317834b70934197f8356cdfa5.png
# vim aa.com.zone
https://i-blog.csdnimg.cn/direct/bdb65ca1964346fca61e8c2b9c902ecd.png
# systemctl restart named
2、客户端测试

   # echo nameserver  192.168.8.135 > /etc/resolv.conf
https://i-blog.csdnimg.cn/direct/20801a7d470d433cbec64cd486a0a4de.png
https://i-blog.csdnimg.cn/direct/85be7f6be76845f0832b466603d6a3ce.png
三、设置时间服务器

   # yum -y install ntpdate.x86_64
1、同步时间

   # ntpdate cn.ntp.org.cn
# date
要求集群服务器主机的时间同步,不大概每一台主机都访问一次cn.ntp.org.cn 流量大,效率低,只有一台主机做内网的ntp服务,这台主机定时访问外网,集群内网中的机器和ntp服务器同步就可以了 
2、搭建集群服务器

   # yum -y install ntp
# vim /etc/ntp.conf    15行
https://i-blog.csdnimg.cn/direct/24b217ff31ff43eaa997cb8dcabf9742.png
# ntpdate cn.ntp.org.cn
# systemctl start ntpd
3、创建筹划任务

   # crontab -e    每天四点同步时间
https://i-blog.csdnimg.cn/direct/89753e77be004b9789052b30a18173bd.png
4、客户端同步时间

   # ntpdate 192.168.8.128
# date -s "2009-7-30 12:34:56"
2009年 07月 30日 星期四 12:34:56 CST
# date
2009年 07月 30日 星期四 12:35:01 CST
# ntpdate 192.168.8.128
24 Jul 15:12:47 ntpdate: step time server 192.168.8.128 offset 472876652.819090 sec
# date
2024年 07月 24日 星期三 15:12:50 CST
四、搭建主从架构

主服务   dns   192.168.8.135
从服务   slv   192.168.8.136 
1、主从服务器和ntp服务器同步时间

   # yum -y install ntpdate
# ntpdate 192.168.8.128
# yum -y install ntpdate
# ntpdate 192.168.8.128
2、下载dns依赖组件

   # yum -y install bind 
3、设置允许从服务器同步文件

   # vim /etc/named.conf      //16行
https://i-blog.csdnimg.cn/direct/4ed5b017bc9d4d69823c845c6f51bd4e.png
# named-checkconf /etc/named.conf
# systemctl restart named
4、从服务器设置允许访问

   # vim /etc/named.conf 
https://i-blog.csdnimg.cn/direct/0a8dc6aeaaa94c7394ee739f37e714ef.png
https://i-blog.csdnimg.cn/direct/ac71d56d57074fed9de1122cb0ad0b40.png
5、从服务器修改区域文件  zone

   # vim /etc/named.rfc1912.zones    //添加
https://i-blog.csdnimg.cn/direct/e7a4fa86a39946aea1ea638ca6ec5ef6.png
# named-checkconf /etc/named.rfc1912.zones 
# systemctl restart named
6、客户端测试

   # echo "nameserver 192.168.8.135" > /etc/resolv.conf
# nslookup www.aaa.com
Server:        192.168.8.135
Address:    192.168.8.135#53
Name:    www.aaa.com
Address: 192.168.8.132
# echo "nameserver 192.168.8.136" > /etc/resolv.conf
# nslookup www.aaa.com
Server:        192.168.8.136
Address:    192.168.8.136#53
Name:    www.aaa.com
Address: 192.168.8.132


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: 2024.7.24(反向解析、时间同步、主从架构)