NTP服务时间同步
关闭防火墙和selinux或开启防火墙所有服务
[[email protected] ~]# firewall-cmd --set-default-zone=trusted
NTP服务
[[email protected] ~]# yum –y install ntp
[[email protected] ~]# cat /etc/ntp.conf //修改配置文件 //定义本机与自己同步时间
restrict 176.20.32.0 mask 255.255.255.0 nomodify //允许哪些主机同步时间
#server 0.rhel.pool.ntp.org iburst
#server 1.rhel.pool.ntp.org iburst
#server 2.rhel.pool.ntp.org iburst
#server 3.rhel.pool.ntp.org iburst
server 127.127.1.0 iburst //定义本机与自己同步时间
fudge 127.127.1.0 stratum 3
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor
客户端测试NTP服务
[[email protected] ~]# ntpdate 172.25.0.254
14 Jul 02:14:02 ntpdate[6052]: adjust time server 172.25.0.254 offset 0.031270 sec //表试成功
时间: 2024-11-05 23:13:05