1.同步网络时间到系统时间ntpdate命令

[root@localhost test1]# date

Tue Sep  6 07:12:03 CST 2016

[root@localhost test1]#  ntpdate  cn.pool.ntp.org 

 6 Sep 09:18:23 ntpdate[13047]: step time server 120.25.108.11 offset 7566.199829 sec

[root@localhost test1]# date

Tue Sep  6 09:18:25 CST 2016

 cn.pool.ntp.org  (中国国家授时中心的官方时间同步服务器IP域名)

同步网络时间到系统时间后,就可以用hwclock -w将系统时间同步到硬件时间。


2.自己搭建时间同步服务器

时间同步服务器设置:

        systemctl stop firewalld

        vim  /etc/chrony.conf

             allow 172.25.254.0/24

             local stratum 10 

        systemctl restart chrony


3.如何自动同步系统时间(同步服务器时间) 

chronyc  sources  -v查看与谁同步着。


1.确定时间源地址(同步谁的时间)

172.25.254.254

2.确定客户主机使用的时间同步服务

chronyd.service

3.在chronyd.service服务中加载时间源地址

vim /etc/chrony.conf

server172.25.254.254 iburst

#systemctl restart chronyd.service