一、chronyd 服务
该服务是时间同步服务,类似与windows中的自动与网络时间同步的功能,在linux中这个时间同步是确定客户主机使用的时间同步服务的,在chronyd.service 服务中加载时间源地址,配置文件在/etc/chrony.conf
1.首先需要发送方编辑配置文件,第
第22行改为 allow 172.25.254.155/24
28行前的#去掉
然后重启该服务,并关闭防火墙
systemctl restart chronyd.service
systemctl stop firewalld
2.需要编辑接受端的配置
打开配置文件并在第7行添加
server 172.25.254.55 iburst
然后重启该服务,并关闭防火墙
systemctl restart chronyd.service
systemctl stop firewalld
经过上述操作,时间就同步成功了
3.如何查看同步成功与否
chronyc sources -v
二、timedatectl服务
timedatectl ##显示时间
Local time: Thu 2018-10-18 03:48:22 GMT
Universal time: Thu 2018-10-18 03:48:22 UTC
RTC time: Thu 2018-10-18 03:48:22
Time zone: Africa/Conakry (GMT, +0000)
NTP enabled: yes
NTP synchronized: no
RTC in local TZ: yes
DST active: n/a
timedatectl list-timezones ##查看当前时区
timedatectl set-timezone Africa/Conakry ##设置当前时区
timedatectl set-time 11:11:11 ##设置当前系统时间
timedatectl set-local-rtc 0 解决windows下时间错乱的问题,把时间设置为与伦敦时间保持一致
timedatectl set-time "yyyy-mm-dd hh:mm:ss" 设置时间