In this post we’ll look at NTP configuration by using chrony, which is installed by default on newer RedHat systems.
Ensure that the chronyd service is started and let’s take a look at the current time setttings:
123456789
timedatectl
Local time: Thu 2018-02-15 02:15:51 JST
Universal time: Wed 2018-02-14 17:15:51 UTC
RTC time: Wed 2018-02-14 17:15:52
Time zone: Asia/Tokyo (JST, +0900)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
Now look inside chrony’s config file, which is /etc/chrony.conf:
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.rhel.pool.ntp.org iburst
server 1.rhel.pool.ntp.org iburst
server 2.rhel.pool.ntp.org iburst
server 3.rhel.pool.ntp.org iburst
# Ignore stratum in source selection.
stratumweight 0
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift
# Enable kernel RTC synchronization.
rtcsync
# In first three updates step the system clock instead of slew
# if the adjustment is larger than 10 seconds.
makestep 10 3
# Allow NTP client access from local network.
#allow 192.168/16
# Listen for commands only on localhost.
bindcmdaddress 127.0.0.1
bindcmdaddress ::1
# Serve time even if not synchronized to any NTP server.
#local stratum 10
keyfile /etc/chrony.keys
# Specify the key used as password for chronyc.
commandkey 1
# Generate command key if missing.
generatecommandkey
# Disable logging of client accesses.
noclientlog
# Send a message to syslog if a clock adjustment is larger than 0.5 seconds.
logchange 0.5
logdir /var/log/chrony
#log measurements statistics tracking
There is a set of default servers configured, but you can add your own. You can also allow NTP client access in the local network by uncommenting or adding the allow directive with a range.
In the previous timedatectl output we saw that NTP and synchronization weren’t enabled, so let’s enable them:
We still have to manage the NTP synchronization. In the config file we have some server pools enabled, but we want to know exact names for the servers:
________________________________________
/ Give thought to your reputation. \
| Consider changing name and moving to a |
\ new town. /
----------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||