在CentOS7.4上配置NTP客户端
1.检查是否连通NTP服务器
[root@TE21 ~]# ntpdate 192.168.1.100
13 Dec 15:10:12 ntpdate[9146]: step time server 192.168.1.100 offset -2289.098141 sec
[root@TE21 ~]# date
Fri Dec 13 15:10:19 CST 2019
2.设置NTP客户端
[root@TE21 ~]# vi /etc/ntp.conf
server 192.168.1.100 iburst
3.配置NTP自动启动
[root@TE21 ~]# systemctl enable ntpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to
/usr/lib/systemd/system/ntpd.service.
[root@TE21 ~]# systemctl start ntpd.service
4.检查NTP运行情况
[root@TE21 ~]# ntpstat
synchronised to NTP server (192.168.1.100) at stratum 4
time correct to within 996 ms
polling server every 64 s
[root@TE21 ~]#
[root@TE21 ~]# 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>
[root@TE21 ~]# ntpdate 192.168.1.100
13 Dec 15:17:27 ntpdate[9312]: the NTP socket is in use, exiting
[root@TE21 ~]#
完成。