RH124-10 时间同步NTP

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RH124-10 时间同步NTP相关的知识,希望对你有一定的参考价值。

[[email protected] Desktop]$ timedatectl

      Local time: Sat 2017-06-03 21:58:12 CST

  Universal time: Sat 2017-06-03 13:58:12 UTC

        Timezone: Asia/Shanghai (CST, +0800)

     NTP enabled: yes

NTP synchronized: no

 RTC in local TZ: no

      DST active: n/a

[[email protected] Desktop]$ 


对时间设定需要root


远程到server0

[[email protected] ~]# timedatectl list-timezones  查看支持的时区

Africa/Abidjan

Africa/Accra

Africa/Addis_Ababa

Africa/Algiers



[[email protected] ~]# timedatectl set-timezone "America/New_York"

[[email protected] ~]# timedatectl 

      Local time: Sat 2017-06-03 10:09:02 EDT

  Universal time: Sat 2017-06-03 14:09:02 UTC

        RTC time: Sat 2017-06-03 22:09:02

        Timezone: America/New_York (EDT, -0400)

     NTP enabled: yes

NTP synchronized: no

 RTC in local TZ: no

      DST active: yes

 Last DST change: DST began at

                  Sun 2017-03-12 01:59:59 EST

                  Sun 2017-03-12 03:00:00 EDT

 Next DST change: DST ends (the clock jumps one hour backwards) at

                  Sun 2017-11-05 01:59:59 EDT

                  Sun 2017-11-05 01:00:00 EST

[[email protected] ~]# 




[[email protected] ~]# timedatectl set-time 22:25:00  设置 时间



[[email protected] ~]# timedatectl set-ntp true

[[email protected] ~]# timedatectl 

      Local time: Sat 2017-06-03 22:27:06 EDT

  Universal time: Sun 2017-06-04 02:27:06 UTC

        RTC time: Sun 2017-06-04 02:27:07

        Timezone: America/New_York (EDT, -0400)

     NTP enabled: yes

NTP synchronized: no

 RTC in local TZ: no

      DST active: yes

 Last DST change: DST began at

                  Sun 2017-03-12 01:59:59 EST

                  Sun 2017-03-12 03:00:00 EDT

 Next DST change: DST ends (the clock jumps one hour backwards) at

                  Sun 2017-11-05 01:59:59 EDT

                  Sun 2017-11-05 01:00:00 EST


[[email protected] ~]# vim /etc/chrony.conf

 写入 

server content.example.com iburst 目的是  让系统知道从哪里同步NTP时间

[[email protected] ~]# systemctl enable chronyd

[[email protected] ~]# systemctl restart chronyd

[[email protected] ~]# 

大约需要五分钟才可以同步


检验:

[[email protected] ~]# timedatectl     命令1

      Local time: Sat 2017-06-03 10:22:59 EDT

  Universal time: Sat 2017-06-03 14:22:59 UTC

        RTC time: Sat 2017-06-03 14:22:59

        Timezone: America/New_York (EDT, -0400)

     NTP enabled: yes   看这里

NTP synchronized: yes   看这里

 RTC in local TZ: no

      DST active: yes

 Last DST change: DST began at

                  Sun 2017-03-12 01:59:59 EST

                  Sun 2017-03-12 03:00:00 EDT

 Next DST change: DST ends (the clock jumps one hour backwards) at

                  Sun 2017-11-05 01:59:59 EDT

                  Sun 2017-11-05 01:00:00 EST

[[email protected] ~]# chronyc sources -v   命令2

210 Number of sources = 1


  .-- 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

||                                                /   xxxx = adjusted offset,

||         Log2(Polling interval) -.             |    yyyy = measured offset,

||                                  \            |    zzzz = estimated error.

||                                   |           |                         

MS Name/IP address         Stratum Poll Reach LastRx Last sample

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

^* classroom.example.com         8   6    37    28   +230ns[ +164us] +/- 1082us

[[email protected] ~]# chro

chronyc  chronyd  chroot   

[[email protected] ~]# chronyc   命令3

chrony version 1.29.1

Copyright (C) 1997-2003, 2007, 2009-2013 Richard P. Curnow and others

chrony comes with ABSOLUTELY NO WARRANTY.  This is free software, and

you are welcome to redistribute it under certain conditions.  See the

GNU General Public License version 2 for details.


chronyc> waitsync   命令4

try: 1, refid: 172.25.254.254, correction: 0.000006130, skew: 1.482

chronyc> 


本文出自 “HCIE_38xx” 博客,谢绝转载!

以上是关于RH124-10 时间同步NTP的主要内容,如果未能解决你的问题,请参考以下文章

时间同步 ntp

NTP时间同步服务器(频率同步)包含帧同步载波同步位同步

linux设置ntp时间同步

linux设置ntp时间同步

NTP时间同步

ntp时间同步