NTP时间服务器
- 1、NTP服务器监控端口 UDP 123
- 2、yum install -y ntp ntpdate
- 3、vim /etc/ntp.conf
restrict 192.168.2.0 mask 255.255.255.0 #配置可访问网段 - 4、systemctl restart ntpd && systemctl enable ntpd
- 5、ntpq -p
查看ntp连接信息 - 6、date
查看当前时间
NTP客户端
- 1、ntpdate pool.ntp.org
- 2、date
- 3、mkdir -p /var/log/crontab/ntpdate.log
- 4、crontab -e
00 21 * * * /usr/sbin/ntpdate 192.168.2.12 >> /var/log/crontab/ntpdate.log #每天晚上21点同步时间 - 5、cat /var/log/crontab/ntpdate.log
检查同步日志