NTP Start at Boot

May 2018

This was created and tested using CentOS 7.x

Chrony is introduced as new NTP client to replace the ntp as the default time syncing package since RHEL7, so if you configure NTP during the installation process, it just enables the chronyd service, not ntpd service.

Even when you have enabled NTP to start on boot, it will not start when chrony
is enabled. So to enable NTP to start on boot, we have to disable the chrony service

In case you want to use NTP only, then below is the procedure to do so :

1. Disable chronyd service.
# systemctl stop chronyd
# systemctl disable chronyd
2. Install NTP
# yum install ntp (probably already installed)
3. Enable and Start NTPD Service
# systemctl enable ntpd.service
# systemctl start ntpd.service
4. Reboot and verify.
# systemctl status ntpd.service
● ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2018-05-11 08:31:47 UTC; 13min ago
Main PID: 1486 (ntpd)
CGroup: /system.slice/ntpd.service
└─1486 /usr/sbin/ntpd -u ntp:ntp -g
May 11 08:31:47 eri-4e-962955 systemd[1]: Starting Network Time Service...
May 11 08:31:47 eri-4e-962955 systemd[1]: Started Network Time Service.

In the /etc/ntp.conf file you can add your own NTP server source.

server x.x.x.x iburst

Once added, you can use the following commands to see the NTP status:

ntpstat
When you first run this you will probably see:
unsynchronised
polling server every 64 s
But after a while, it should chanage (15-30 minutes normally)
synchronised to NTP server (194.80.204.184) at stratum 2
time correct to within 41 ms
polling server every 64 s

systemctl status ntpd.service
● ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2018-06-28 15:21:49 BST; 25min ago
Main PID: 1501 (ntpd)
CGroup: /system.slice/ntpd.service
└─1501 /usr/sbin/ntpd -u ntp:ntp -g
Jun 28 15:43:58 eri-4e-963128 ntpd[1501]: Listen normally on 17 eth4 fe80::a6bf:1ff:fe3a:54ac UDP 123
Jun 28 15:43:58 eri-4e-963128 ntpd[1501]: Listen normally on 18 eth5 fe80::a6bf:1ff:fe3a:54ab UDP 123
Jun 28 15:43:58 eri-4e-963128 ntpd[1501]: new interface(s) found: waking up resolver
Jun 28 15:44:08 eri-4e-963128 ntpd[1501]: Deleting interface #18 eth5, fe80::a6bf:1ff:fe3a:54ab#1...secs
Jun 28 15:44:08 eri-4e-963128 ntpd[1501]: Deleting interface #17 eth4, fe80::a6bf:1ff:fe3a:54ac#1...secs
Jun 28 15:44:10 eri-4e-963128 ntpd[1501]: Listen normally on 19 eth5 fe80::a6bf:1ff:fe3a:54ab UDP 123
Jun 28 15:44:10 eri-4e-963128 ntpd[1501]: Listen normally on 20 eth4 fe80::a6bf:1ff:fe3a:54ac UDP 123
Jun 28 15:44:10 eri-4e-963128 ntpd[1501]: new interface(s) found: waking up resolver
Jun 28 15:44:41 eri-4e-963128 ntpd[1501]: Deleting interface #20 eth4, fe80::a6bf:1ff:fe3a:54ac#1...secs
Jun 28 15:44:41 eri-4e-963128 ntpd[1501]: Deleting interface #19 eth5, fe80::a6bf:1ff:fe3a:54ab#1...secs
Hint: Some lines were ellipsized, use -l to show in full.

ntpq -p
This will display the timeservers found and their statistics
remote refid st t when poll reach delay offset jitter
=============================================================================
ttvadc02.tandbe 137.58.65.3 5 u 29 64 377 0.457 30554.8 14.013
+www.bhay.org 85.199.214.98 2 u 6 64 377 5.135 30.351 11.382
+time.netweaver. 85.199.214.98 2 u 34 64 377 4.581 29.606 10.153
*194.80.204.184 .GPS. 1 u 2 64 377 14.476 30.789 13.018
+121.35.213.162. 17.253.34.253 2 u 46 64 377 5.657 29.604 16.346

Set the TimeZone
From your servers command line enter the following:

Date

You will see an output similar to the following:

Fri Apr 26 06:43:49 UTC 2019

If the Time Zone needs to be changed, use the following:

Original Post Herehttps://www.thegeekdiary.com/centos-rhel-7-enable-ntp-to-start-at-boot-after-fresh-install-disable-chrony/