逆向解析
关闭防火墙和selinux,配置静态ip
[root@dns ~]# vim /etc/named.rfc1912.zones
[root@dns ~]# vim /etc/named.conf
[root@dns ~]# cd /var/named/
[root@dns named]# ls
data named.ca named.localhost slaves
dynamic named.empty named.loopback yuanyu.zhangmin.zone
[root@dns named]# cp -p named.localhost yuanyu.zhangmin2.zone^C
[root@dns named]# vim /etc/named.conf
[root@dns named]# vim /etc/named.rfc1912.zones
[root@dns named]# chgrp named yuanyu.zhangmin.zone
[root@dns named]# ls -l
总用量 20
drwxrwx---. 2 named named 23 7月 23 15:47 data
drwxrwx---. 2 named named 60 7月 23 17:53 dynamic
-rw-r-----. 1 root named 2253 4月 5 2018 named.ca
-rw-r-----. 1 root named 152 12月 15 2009 named.empty
-rw-r-----. 1 root named 152 6月 21 2007 named.localhost
-rw-r-----. 1 root named 168 12月 15 2009 named.loopback
drwxrwx---. 2 named named 6 6月 11 22:40 slaves
-rw-r-----. 1 root named 171 7月 23 16:52 yuanyu.zhangmin.zone
关闭动态IP
[root@dns named]# systemctl stop NetworkManager
[root@dns named]# systemctl disable NetworkManager
域名返回ip
[root@dns named]# vim /etc/named.rfc1912.zones
[root@dns named]# cp -p named.loopback 168.2.33.zone
[root@dns named]# vim 168.2.33.zone
[root@dns named]# named-checkconf /etc/named.rfc1912.zones
[root@dns named]# named-checkzone 168.2.33.zone 168.2.33.zone
zone 168.2.33.zone/IN: loaded serial 0
OK
[root@client ~]# echo "nameserver 192.168.2.32" > /etc/resolv.conf
[root@client ~]# nslookup www.yuanyu.zhangmin
Server: 192.168.2.32
Address: 192.168.2.32#53
Name: www.yuanyu.zhangmin
Address: 192.168.2.33
[root@client ~]# nslookup 192.168.2.33
33.2.168.192.in-addr.arpa name = www.yuanyu.zhangmin.2.168.192.in-addr.arpa.
33.2.168.192.in-addr.arpa name = www.chz.hz.2.168.192.in-addr.arpa.
33.2.168.192.in-addr.arpa name = www.chz.cc.2.168.192.in-addr.arpa.
ntp
修改时间
[root@client ~]# date -s "2009-7-20 12:34:56"
2009年 07月 20日 星期一 12:34:56 CST同步时间
[root@client ~]# yum -y install ntpdate
[root@client ~]# ntpdate cn.ntp.org.cn
24 Jul 14:29:24 ntpdate[6331]: step time server 120.197.116.202 offset 473737777.353671 sec
[root@client ~]# date
2024年 07月 24日 星期三 14:29:39 CST要求集群服务器主机的时间同步
不可能每一台主机都访问一次cn.ntp.org.cn 流量大,效率低
只放一台主机,做内网的ntp服务器,这台主机定时访问外网,集群内网中的机器和ntp服务器同步就可以
[root@ntp ~]# ntpdate cn.ntp.org.cn 跟世界时间对一下时间
24 Jul 15:06:43 ntpdate[1594]: adjust time server 120.197.116.202 offset 0.027252 sec
[root@ntp ~]# systemctl start ntpd
[root@ntp ~]# which ntpdate
/usr/sbin/ntpdate
[root@ntp ~]# crontab -e测试:
[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.2.34
[root@dns ~]# named-checkconf /etc/named.conf 检查是否有错
安装bind,因为sla服务器在需要主服务器下线的时候工作
[root@dns2 ~]# yum -y install bind
[root@dns2 ~]# vim /etc/named.conf
测试:两台服务器 都可以访问到
[root@client ~]# echo "nameserver 192.168.2.32" > /etc/resolv.conf
[root@client ~]# nslookup www.yuanyu.zhangmin
Server: 192.168.2.32
Address: 192.168.2.32#53
Name: www.yuanyu.zhangmin
Address: 192.168.2.33
[root@client ~]# echo "nameserver 192.168.2.35" > /etc/resolv.conf
[root@client ~]# nslookup www.yuanyu.zhangmin
Server: 192.168.2.35
Address: 192.168.2.35#53
Name: www.yuanyu.zhangmin
Address: 192.168.2.33
多域名访问
修改zones文件
[root@dns ~]# named-checkconf /etc/named.rfc1912.zones
[root@dns ~]# cd /var/named/
[root@dns named]# ls
192.168.2.zone data named.empty slaves
chz.cc.zone dynamic named.localhost yuanyu.zhangmin.zone
chz.hz.zone named.ca named.loopback
[root@dns named]# cp -p named.localhost yuanyu.zm.zone
[root@dns named]# cp -p named.localhost yuanyu.cc.zone
[root@dns named]# ls
192.168.2.zone dynamic named.loopback yuanyu.zm.zone
chz.cc.zone named.ca slaves
chz.hz.zone named.empty yuanyu.cc.zone
data named.localhost yuanyu.zhangmin.zone
[root@dns named]# named-checkzone yuanyu.zm.zone yuanyu.zm.zone
zone yuanyu.zm.zone/IN: loaded serial 0
OK
[root@dns named]# named-checkzone yuanyu.cc.zone yuanyu.cc.zone
zone yuanyu.cc.zone/IN: loaded serial 0
OK
[root@dns named]# systemctl restart named
在客户端访问域名,都可以访问到
[root@client ~]# echo "nameserver 192.168.2.32" > /etc/resolv.conf
[root@client ~]# nslookup co.yuanyu.cc
Server: 192.168.2.32
Address: 192.168.2.32#53
Name: co.yuanyu.cc
Address: 192.168.2.32
[root@client ~]# nslookup bbs.yuanyu.zm
Server: 192.168.2.32
Address: 192.168.2.32#53
Name: bbs.yuanyu.zm
Address: 192.168.2.32