1.服务端安装ntpd服务
yum install ntp
2.修改配置文件,配置文件在/etc/ntpd.conf
注释或者删除以下四行 server 0.centos.pool.ntp.org iburst server 1.centos.pool.ntp.org iburst server 2.centos.pool.ntp.org iburst server 3.centos.pool.ntp.org iburst添加一行server 127.127.1.0
3.启动ntp
systemctl restart ntpd
4.查看ntp状态
ntpq -p[[email protected] yum.repos.d]# ntpq -p remote refid st t when poll reach delay offset jitter==============================================================================*LOCAL(1) .LOCL. 5 l 13 64 377 0.000 0.000 0.000
服务端
1。安装ntp
2.修改配置文件
注释或者删除以下四行 server 0.centos.pool.ntp.org iburst server 1.centos.pool.ntp.org iburst server 2.centos.pool.ntp.org iburst server 3.centos.pool.ntp.org iburst 添加一行 server 127.127.1.0 iburst
3.启动ntp
4.查看是否同步
ntpq -p[[email protected] yum.repos.d]# ntpq -p remote refid st t when poll reach delay offset jitter==============================================================================*master LOCAL(1) 6 u 1 64 1 0.848 -0.130 0.126
备注:
centos7中设置时间
[[email protected] yum.repos.d]# date -s "2017-5-2 10:36:00"
把时间同步到硬件时钟
[[email protected] yum.repos.d]# hwclock -w
时间: 2024-10-24 04:24:26