Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

Please be gentle, I'm an ecologist - not a SYSADMIN.

share|improve this question
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 '13 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. –  Nate Lockwood Apr 21 '13 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 '13 at 17:47

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
    
@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. –  Nate Lockwood Apr 24 '13 at 17:46

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.

share|improve this answer
    
ntpdate is not needed; ntpd can set the time at startup. –  Martin Schröder Apr 21 '13 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? –  Nate Lockwood Apr 21 '13 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 '13 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? –  Nate Lockwood Apr 21 '13 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". –  Martin Schröder Apr 21 '13 at 21:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.