Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

Chapter 25Name in the book: Configuring Time Services

Keep the system time right

Correct time matters: logs from many servers must line up, TLS certificates and Kerberos fail with a wrong clock, and scheduled jobs run at the wrong moment. This chapter explains hardware and system time, time zones, and how to sync the clock with NTP using chrony.

  • 10 Lessons
  • 8 Commands
  • 1 Labs

$ run as a normal user# run as root (or with sudo)

Exam objectives in this chapter

  • Set up time service clients

25.1

Understand local time

A computer has two clocks. The hardware clock (RTC) runs on the mainboard battery also when the machine is off. The system clock is kept by the kernel while Linux runs; it starts from the hardware clock at boot.

ClockWhereTool
Hardware clock (RTC)Mainboard, batteryhwclock
System clockKerneldate, timedatectl
  • Linux keeps the system clock in UTC and shows it in your time zone.
  • The hardware clock should also be UTC (RTC in local TZ: no).

25.2

Use network time

NTP (Network Time Protocol) syncs the clock with time servers. RHEL uses chrony (chronyd) as NTP client and server. Servers are ordered in strata: stratum 1 has a real reference clock (GPS, atomic); stratum 2 syncs from stratum 1, and so on.

systemctl status chronyd
chronyc sources -v
chronyc tracking

25.3

Show and set the time with date

date shows the system time in any format, and root can set it (better: let NTP do it).

date
Sun Oct 25 11:42:10 CET 2026
date +%F_%H%M
2026-10-25_1142
date -u
date -d '+3 days'
date -d @1761389000
date -s "2026-10-25 12:00:00"
FormatGives
%F2026-10-25
%T11:42:10
%sSeconds since 1970 (epoch)
%A, %BDay and month name

Commands in this lesson

25.4

Use hwclock

hwclock reads and sets the hardware clock, and copies time between the two clocks.

hwclock
hwclock --systohc
hwclock --hctosys

Note

chronyd keeps the hardware clock in sync by itself when rtcsync is in /etc/chrony.conf (RHEL default).

25.5

Use timedatectl

timedatectl shows all time settings at once and changes time, time zone and NTP use.

timedatectl
               Local time: Sun 2026-10-25 11:42:10 CET
           Universal time: Sun 2026-10-25 10:42:10 UTC
                 RTC time: Sun 2026-10-25 10:42:10
                Time zone: Europe/Amsterdam (CET, +0100)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
timedatectl set-ntp true
timedatectl set-ntp false
timedatectl set-time "2026-10-25 12:00:00"

Watch out

set-time only works when NTP is off. With NTP on, chrony corrects the clock anyway.

25.6

Manage the time zone

The time zone is the link /etc/localtime → a file in /usr/share/zoneinfo/. Change it with timedatectl set-timezone.

timedatectl list-timezones | grep -i riyadh
Asia/Riyadh
timedatectl set-timezone Asia/Riyadh
ls -l /etc/localtime
TZ=America/New_York date
tzselect

Note

tzselect only helps you find the name (with questions); it does not change the system.

25.7

Configure time service clients

Tell chrony which time servers to use in /etc/chrony.conf, restart it, and check the sources.

  1. Set the server (replace the pool line or add a server line).
    /etc/chrony.conf (part)
    # pool 2.rhel.pool.ntp.org iburst
    server 192.168.122.1 iburst
    driftfile /var/lib/chrony/drift
    makestep 1.0 3
    rtcsync
  2. Restart chrony and open the firewall only if this host is a time server for others.
    systemctl restart chronyd
    chronyc sources -v
    chronyc tracking
  3. Make the clock step at once if it is far off.
    chronyc makestep
chronyc outputMeaning
^*The source chrony uses now
^+A good source that is combined
^? / ^xNot reachable / falseticker (wrong time)
Leap status: Normal (tracking)Synchronized

Exam tip

"Configure the system as an NTP client of classroom.example.com" = a server classroom.example.com iburst line in /etc/chrony.conf, systemctl restart chronyd, then check chronyc sources shows ^*.

At work

To make a server an NTP server for your network, add allow 192.168.122.0/24 to chrony.conf and open the firewall service ntp.

25.8

Remember the main points

The most important facts of this chapter, in short.

25.9

Learn the key terms

The words of this chapter in simple English.

TermMeaning
Hardware clock (RTC)The clock on the mainboard that runs when the computer is off.
System clockThe clock of the running kernel.
UTCCoordinated Universal Time: the base time without time zones.
Time zoneThe local time rule of a place, like Asia/Riyadh.
NTPNetwork Time Protocol: sync the clock over the network.
chronydThe NTP service of RHEL.
StratumHow far a time server is from a real reference clock.
iburstSend the first requests fast to sync quickly.

25.10

Check what you learned

Think about the answer first, then open it.

1How do you set the time zone to Europe/Amsterdam?
2How do you find the exact name of a time zone?
3Make this system an NTP client of classroom.example.com.

Add server classroom.example.com iburst to /etc/chrony.conf, systemctl restart chronyd, check chronyc sources.

4In chronyc sources, what does ^* mean?

That is the source chrony uses now.

5How do you turn on time sync with timedatectl?
6Why can timedatectl set-time fail?

It does not work while NTP sync is on.

7How do you show the date as 2026-10-25?
8How do you copy the system time to the hardware clock?

Practice

All commands in this chapter