时间同步配置

3 篇文章 0 订阅
2 篇文章 0 订阅

1、安装时间同步工具

dnf install chrony     # redhat8
yum install chrony     # redhat7 

2、启动服务并设置开机启动

 systemctl start chronyd
 systemctl enable chronyd

3、配置时间同步地址

将原有的地址注释掉

redhat 8注释掉:

        pool 2.pool.ntp.org iburst

redhat7注释掉以下行:

        #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 ntp.aliyun.com iburst
server cn.ntp.org.cn iburst

重启服务

systemctl restart chronyd

4、同步时间

[root@localhost ~]# chronyc sources -v
210 Number of sources = 2

  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^- 203.107.6.88                  2  10   377   964  -6620us[-7301us] +/-   28ms
^* 120.25.115.20                 2  10   377   358   -666us[-1416us] +/-   10ms

查看状态

[root@localhost ~]# timedatectl
      Local time: 四 2022-04-28 15:57:49 CST
  Universal time: 四 2022-04-28 07:57:49 UTC
        RTC time: 四 2022-04-28 07:57:49
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值