Skip to main content

校時與時區設定

Chrony

Built-in on CentOS

Install

yum install chrony

Config: /etc/chrony.conf

# NTP Public Servers for Taiwan
server tw.pool.ntp.org
server time.stdtime.gov.tw
server clock.stdtime.gov.tw
server jp.pool.ntp.org

# Allow NTP client access from local network.
#allow 192.168.0.0/16

Starting

systemctl start chronyd

Verify

[root@localhost ~]# chronyc tracking
Reference ID    : 7A75FDF6 (static.home.twn.sciuridae.cloud)
Stratum         : 3
Ref time (UTC)  : Sun Aug 16 03:35:36 2020
System time     : 0.000073180 seconds slow of NTP time
Last offset     : -0.001259724 seconds
RMS offset      : 0.001259724 seconds
Frequency       : 21.057 ppm slow
Residual freq   : -0.000 ppm
Skew            : 28.166 ppm
Root delay      : 0.032856792 seconds
Root dispersion : 0.002069760 seconds
Update interval : 64.3 seconds
Leap status     : Normal

[root@tpemimtst99 ~]# timedatectl
               Local time: Tue 2021-05-25 09:09:09 CST
           Universal time: Tue 2021-05-25 01:09:09 UTC
                 RTC time: Tue 2021-05-25 01:09:09
                Time zone: Asia/Taipei (CST, +0800)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

[root@tpemimtst99 ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* 192.168.21.86                 3  10   377   754  +1543ns[+4123ns] +/-   63ms

systemd-timesyncd

Build-in on Ubuntu

timedatectl

# See the information of the datetime
timedatectl

# List timezones supported
timedatectl list-timezones

# Change the system’s timezone
sudo timedatectl set-timezone Asia/Taipei
ntpd

vi /etc/ntp.conf

server 192.168.21.86 prefer iburst

Restart the ntpd

# Ubuntu 16.04