6

I have 4 computers on a LAN that need to have their system clocks closely synchronized within a ms or so if possible. I have just installed a GPS based time server (ESE-104A) on the LAN. At this point the LAN is connected to a router and the internet but the router will not be connected to the internet when operational.

In operation the whole system will be started when power is applied to the machines, NTP server, and router.

  1. How can I set Ubuntu to sync every so many minutes and calculate what the period should be?

  2. How can I get an idea of how long it takes to settle down and what the quality of the time keeping is?

  3. I found a reference, from around 2000 perhaps, that suggests that the hwclock should be synched from the system time only at shut down. Should I do this and how?

  4. What log files should I keep?

Here's the results of "ntpq -

    remote   refid       st t when poll reach   delay   offset  jitter
    *nts   .M-@M-(^AM-R.  1 u  29  128   377    38.912  -7.739   7.195

Here's my ntp.conf (I use IPv4 only)

    driftfile /etc/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

    server 192.168.1.210

    restrict -4 default kod notrap nomodify nopeer noquery
    restrict -6 default kod notrap nomodify nopeer noquery

    restrict 127.0.0.1
    restrict ::1
3
  • 1
    Welcome to SE, your question is very well thought out and asked, based on that there's no way you could be a SYSADMIN 8-).
    – slm
    Apr 20, 2013 at 22:16
  • By saying I have a NTP server on the LAN I do not mean that it is a computer acting as a NTP server. It's an appliance that gets its time from GPS and makes it available to NTP requests through the NTP port. Apr 21, 2013 at 17:40
  • Thanks for the clarification. Given that I'd think either mine or Martin's answer would work OK for you. Probably would lean towards Martin's answer as the way to go if I was you.
    – slm
    Apr 21, 2013 at 17:47

2 Answers 2

3

Run ntpd on all machines. Set the server so that it gets its time from the gps receiver and point the other machines to the server. With iburst the clients will sync fast enough for your purposes.

1
  • @sim I fell back to this solution but first I needed to disable apparmor in Ubuntu. It was restricting ntpd access to the drif file. Today the drift files appear to be up to date and the jitter is reasonable if not a bit higher that I'd like. Using tcpdump I see traffic on the LAN that I really don't understand but will work on that question later. Apr 24, 2013 at 17:46
1

I've usually setup systems so that as part of their power up routine that they'd initially run ntpdate and get their time bootstrapped from the local time server just so they aren't initially wildly off. Then just start up ntpd using it's default options.

For example, at the end of the file: /etc/rc.local add the following line:

/etc/init.d/ntpd stop
ntpdate <local time server>
/etc/init.d/ntpd start

It's hacky but does the job. I found this thread on Server fault that discusses reasons for not turning NTP into Frankenstein's monster by making it do something it was never meant to do, mainly keep precise time.

If you're really bent on getting precise time I think you'd be better off with this: Precise Time Protocol. There is an open source project that has implemented the PTP protocol, aptly named The Linux PTP Project.

5
  • ntpdate is not needed; ntpd can set the time at startup. Apr 21, 2013 at 13:06
  • @Martin For about two minutes after start up the NTP appliance will not have a "lock" on a GPS satellite and will give its best estimate from its battery powered clock. Will I need to compensate for this? Apr 21, 2013 at 17:47
  • 1
    If you look at the iburst link that @Martin provided the first paragraph covers your question. ... "The iburst option does several checks quickly as soon as the daemon is started and whenever the server is unreachable if you have that in your configuration. The burst option does several checks quickly whenever the server is reachable."
    – slm
    Apr 21, 2013 at 17:51
  • @MartinSchröder Between the two of you and a 10 year old Linux guide I'm starting to get a handle on this. Where, that is, what file starts ntpd on boot and is that the spot that ntpd is told how often to check the ntp server? Apr 21, 2013 at 20:59
  • @NateLockwood: ntpd checks the server as often as needed: You don't have to tell it the interval. Please read the FAQ. The startup of ntpd is handled by your OS - typically it should "just work". Apr 21, 2013 at 21:45

You must log in to answer this question.

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