2

I am trying to set up a local NTP server for our LAN. I am able run ntpdate server_ip to manually update the time. However, ntp daemon does not seem to be logging anything into syslog, and so I can't tell if any system ever synchronized.

# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
driftfile /var/lib/ntp/ntp.drift
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
logconfig =syncall +clockall
# Specify one or more NTP servers.
# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server  10.0.1.201 iburst minpoll 3 maxpoll 4
restrict -4 default kod notrap nomodify nopeer
restrict -6 default kod notrap nomodify nopeer
# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.
# Local users may interrogate the ntp server more closely.
#restrict 127.0.0.1
#restrict ::1
# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust

# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255
# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines.  Please do this only if you trust everybody on the network!
disable auth
#broadcastclient

What might I be missing?

3 Answers 3

2

NTP is normally very quiet/silent in syslog. Things are going wrong if it shows up. If your hardware clock is working, it shouldn't need to modify your clock during startup. With the right settings it can replace ntpdate to set the clock on startup if required.

The logs you want to look at are the loopstats and peerstats files. Once running NTP should not need to synchronize the clock. It will adjust the tick timing very slightly to keep the clock synchronized. loopstats file provides your local state, while peerstats shows your state relative to the servers you are using. See the NTP Troubleshooting Guide for details on these files.

2
  • Use "ntpq -p" when logged into the host to see which servers it has synchronized with. You can also use "ntpdc -c kerninfo" to see some other information.
    – tgharold
    Sep 28, 2013 at 3:49
  • @tgharold I was considering adding "ntpq -p" and "ntpdc -c peers" to my answer. Both will give you the current synchronization data. Add "-n" to the parameters of either command to skip the DNS lookup.
    – BillThor
    Sep 28, 2013 at 13:35
2

Just for confirming that the system is synchronized the following can be executed:

# ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 159.69.144.253  94.16.116.137    3 u   60   64   37    2.749   -2.464   0.066
*176.9.241.107   192.53.103.108   2 u   61   64   37    0.461    0.237   0.026
 193.175.73.20   .MRS.            1 u   62   64   37   19.189    1.786   0.072
 138.68.126.106  130.149.17.8     2 u   59   64   37    5.366    0.562   0.043

Where an * suffix for a record indicates that that peer is currently being used for synchronization.

In the other hand, for detailed monitoring/logging of clock synchronization events, I found the following to be quite helpful:

First, create the following folder if it doesn't exist and assign it ownership to the user running the NTP daemon:

# mkdir /var/NTP/
# chown ntp /var/NTP/

Now modify ntp.conf like this where the meaning of each one of these entries is explained in http://doc.ntp.org/4.2.6p3/monopt.html:

statsdir /var/NTP/
filegen clockstats file clockstats
filegen cryptostats file cryptostats
filegen loopstats file loopstats
filegen peerstats file peerstats
filegen protostats file protostats
filegen rawstats file rawstats
filegen sysstats file sysstat
filegen timingstats file timingstats

Then restart the NTP service and look at the /var/NTP/ folder.

Finally, for example, to determine the peers that has been used for synchronization as time goes, look for lines ending in sys_peer in /var/NTP/protostats, e.g.:

58827 80454.306 159.69.144.253 8014 84 reachable
58827 80647.304 176.9.241.107 901a 8a sys_peer
58827 80647.304 0.0.0.0 c615 05 clock_sync
58827 80842.323 193.175.73.20 901a 8a sys_peer

PS:

  • I'm not a NTP expert, so I could be wrong in some of the previous statements.
0

Sorry Guys I have a question. What would be a problem if syslog was configured to send accounting information without using NTP?

2
  • Post a question! Not an answer with a question in it.
    – Dagelf
    May 27, 2022 at 10:27
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
    – Dagelf
    May 27, 2022 at 10:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .