yum -y install ntp配置同步服务
内网环境安装NTP服务,一般有2种方式:
1、如果没有现成的时间同步服务器。一台主机A做为NTP服务器,其它主机B只安装ntpdate服务,B主机们通过ntpdate命令同步主机A的时间。
2、有现成的时间同步服务器。所有主机直接通过ntpdate命令,同步时间服务器的时间。
这里主要介绍的是第一种方式
修改前
修改后【主】
修改后【从】
主配置172.30.1.100# ntp配置文件 sudo vim /etc/ntp.conf # 当前节点IP地址 主 restrict 172.30.1.100 nomodify notrap nopeer noquery # 集群所在网段的网关(Gateway),子网掩码(Genmask) restrict 172.30.1.1 mask 255.255.255.0 nomodify notrap # 主服务器 并注释掉server 0 ~ n server 127.127.1.0 Fudge 127.127.1.0 stratum 1 # 主服务器开放123端口 firewall-cmd --permanent --add-port=123/udp firewall-cmd --reload从配置172.30.1.101
# ntp配置文件 sudo vim /etc/ntp.conf # 当前节点IP地址 从 restrict 172.30.1.101 nomodify notrap nopeer noquery # 集群所在网段的网关(Gateway),子网掩码(Genmask) restrict 172.30.1.1 mask 255.255.255.0 nomodify notrap # 从服务器 并注释掉server 0 ~ n server 172.30.1.100 Fudge 172.30.1.100 stratum 1启动等命令
# 查看 systemctl status sshd.service # 启动 systemctl start sshd.service # 重启 systemctl restart sshd.service # 自启 systemctl enable sshd.service



