在CentOS7.4上配置NTP客户端
1.检查是否连通NTP服务器
[[email protected] ~]# ntpdate 192.168.1.100
13 Dec 15:10:12 ntpdate[9146]: step time server 192.168.1.100 offset -2289.098141 sec
[[email protected] ~]# date
Fri Dec 13 15:10:19 CST 2019
2.设置NTP客户端
[[email protected] ~]# vi /etc/ntp.conf
server 192.168.1.100 iburst
3.配置NTP自动启动
[[email protected] ~]# systemctl enable ntpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to
/usr/lib/systemd/system/ntpd.service.
[[email protected] ~]# systemctl start ntpd.service
4.检查NTP运行情况
[[email protected] ~]# ntpstat
synchronised to NTP server (192.168.1.100) at stratum 4
time correct to within 996 ms
polling server every 64 s
[[email protected] ~]#
[[email protected] ~]# watch ntpq -p
Every 2.0s: ntpq -p Fri
Dec 13 15:15:25 2019
remote refid st t when poll reach delay offset jitter
==============================================================================
*192.168.1.100 120.25.115.20 3 u 57 64 3 0.173 2.650 0.234
<Ctrl+c>
[[email protected] ~]# ntpdate 192.168.1.100
13 Dec 15:17:27 ntpdate[9312]: the NTP socket is in use, exiting
[[email protected] ~]#
完成。
原文地址:https://blog.51cto.com/147655/2458826