1、检查是否已安装ntp

[root@localhost ~]# rpm -qa ntp

2、安装ntp以及ntpdate

yum -y install ntp ntpdate

3、修改ntp配置文件

vim /etc/ntp.conf

#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

restrict 192.168.1.0/24 mask 255.255.255.0 nomodify notrap

加入的这行允许哪些client能够与ntp服务器进行时间同步


server ntp1.jst.mfeed.ad.jp iburst加入此行,多一条时间同步服务器


4、启动ntp服务器

service ntpd start

chkconfig ntpd on

[root@RS2 tmp]# ntpq -p

     remote           refid      st t when poll reach   delay   offset  jitter

==============================================================================

*dns1.synet.edu. 202.118.1.47     2 u   78   64  376   38.169   38.259  33.424

+ntp1.jst.mfeed. 133.243.236.17   2 u   67   64  377   37.098   32.521  19.811


client:

只需要安装ntpdate即可

操作:

ntpdate 192.168.1.11


参考:https://www.server-world.info/en/note?os=CentOS_6&p=ntp&f=1