Network Time Service

Published by

Posted on March 07, 2019

Network Time Service.

setting up a time server is pretty straight forward once you have some understanding. Being a linux user , it pretty hard to find a reliable public time server. Most of them are slow and hard to reach.  I decided to setup a private time server for my internal and external servers.  

Reference docs

There are two time clients you can use on Linux ,Chronyd and NTPD. There configuration is similar but i am sure there are some differences between the two. 

Client setup :: Chronyd

  • Very Chronyd is enabled and running

systemctl enable chronyd
systemctl start chronyd
systemctl status chronyd

  • Config file path /etc/chronyd.conf
  • Documentation pages
    info chronyd.conf
    man chronyd
  • Example commands

chronyc -a ‘burst 4/4’

if your system time is super behind. it can take some time for Chronyd to catch up. Use the command below to force it to update.
chronyc -a makestep

Other good commands.
chronyc -a ‘burst 4/4’
chronyc tracking
chronyc sources

Red hat Docs

Client setup :: NTPD

  • Very NTPD is enabled and running

systemctl enable ntpd
systemctl start ntpd
systemctl status ntpd

  • Config file path /etc/ntpd.conf
  • Documentation pages
    info ntpd.conf
    man ntpd
  • Example commands
ntpq -p
ntpdate -q

Allowing time queries from remote machines
Set the restriction
restrict 192.168.1.0 netmask 255.255.255.0 nomodify notrap

We developed a python/C program that forces the hwclock to be in sync with the SW Clock. The tool will also query the time server and ensure the sw clock is in sync. We wanted to make sure the time was in sync for application logging. I will post the code to our public github soon