Lab 25: Configure Time Services

Objective Focus
Deploy, configure, and maintain systems
Configure time service clients

Official RHCSA EX200 Exam Objectives


What is meant by time services?

In order understand to time services, we have to explain what NTP, or Network Time Protocol, is first. NTP is a networking protocol that that is used over the wire to synchronize the system clocks of computers with a remote source. NTP uses UDP port 123.

Even now, your computer is communicating with a time source to get an accurate clock. A time source can be on local network, over the internet, and radio clock. We mostly see devices connected to time sources over the internet. I recommend looking up atomic clocks, stratum levels and checking out https://ntp.org.


How does NTP work in RHEL?

In RHEL, NTP is handled by Chrony under Chronyd.service.

$ systemctl status chronyd.service
  • Run the above command to check that chronyd is running.
  • What time source is being used?

What file is used to manage the chrony service?
$ /etc/chrony.conf

$ man chrony.conf

In the chrony.conf file, important directives, or keywords, are the pool and server. The pool keyword points to a group or “pool” of servers. Chronyd binds itself to one of the servers and if one fails it will switch over automatically. The server directive lets you use a hostname or IP address of a single server.

Working with Chronyd
$ man chronyc
  • chronyc is a tool to help manage chronyd

First lets check the status

$ systemctl status chronyd.service

Make sure it is started, not already

$ systemctl start chronyd.service

Make sure it pertists after a reboot

$ systemctl enable chronyd.service

Making a change

Lets edit chrony.conf

$ vim /etc/chrony.conf
  • add time.google.com and comment out pool line
server time.google.com iburst

Restart the service

$ systemctl restart chronyd.service

More on Chronyc

Using chronyc, we’ll check if the new source is picked up

$ chronyc sources 

Additionally, we can see clock stats

$ chronyc tracking

Addtional commands for managing time
$ man date
  • print or set the system date and time
$ date --set "2004-02-29 16:00:00"
  • Example in the man page setting the time to February 29, 2004 at 4 PM
  • This change does not persist.
  • Great for scripting.
$ man timedatectl
  • timedatectl - Control the system time and date
  • Running the command without options will output a summary of the time settings.
$ timedatectl list-timezones 
$ timedatectl set-timezone America/New_York
  • Reboot and see if it persists!

Thats all for Time related services! And Check your that your firewall configuration is allowing port 123!!