configure, start ntpd service

A short few months ago I followed some instructions on configuring the ntpd service for High Sierra as follows:


Modify /etc/ntp.conf

sudo killall ntpd

sudo ntpd


I bought a new Mac Mini two days ago, with High Sierra, and tried the above. When I did 'systemsetup -getnetworktimeserver' before doing the above I got "Network Time Server: time.apple.com", as expected. That was the previous contents of /etc/ntp.conf. When I then did the above set of instructions for my new config, my killall came back with "No matching processes were found" ??? Then I ran the 'sudo ntpd', then did the systemsetup -getnetworktimeserver' and got "Network Time Server: (null)". On my other two High Sierra system that comes back as "Network Time Server: mail.hprs.local".


What am I doing wrong? My ntp.conf is:


server mail.hprs.local iburst prefer

server 0.pool.ntp.org iburst

server 1.pool.ntp.org iburst

server 127.127.1.0

fudge 127.127.1.0 stratum 10


driftfile /etc/ntp/drift


restrict default noquery nomodify

restrict 127.0.0.1


Mac mini Unibody no ODD

Posted on Dec 6, 2018 8:29 PM

Reply
Question marked as Top-ranking reply

Posted on Dec 20, 2018 9:19 AM

BDAqua: regarding "ignored", MrHoffman's understanding about the range skew with ntp is the same as mine. That's why I set the Mac to only 4 minutes off from the Domain Controller in my test of Dec 18, 2018 8:08 PM, posted above, since the default setting of Maximum Tolerance for Active Directory on Windows is 5 minutes.


BUT! ... none of that matters. The helpful folks and LinuxQuestions.org found the answer to this puzzle. Mac DOES NOT use ntpd. Since High Sierra Mac uses timed. Read all about it here https://eclecticlight.co/2017/10/27/has-anyone-got-the-time-how-high-sierra-has-changed-time-synchronisation/. Therefore, tools like ntpq and ntpdc won't work. There's nothing listening on the local host on the ports which these utilities use. Furthermore, this is a customized, stripped down version of timed, not the original, full-fledged version that runs on Unix. There are no parameters, commands or timedc program for interfacing. It does, however, use /etc/ntp.conf although I presume everything except the actual host name(s) is ignored.


Interestingly, that link author suggests taking "a careful look at" /var/db/timed/com.apple.timed.plist to investigate the state of timed, but I found that to be a binary file. If anyone knows how to look at that file, please advise.

Similar questions

15 replies
Question marked as Top-ranking reply

Dec 20, 2018 9:19 AM in response to BDAqua

BDAqua: regarding "ignored", MrHoffman's understanding about the range skew with ntp is the same as mine. That's why I set the Mac to only 4 minutes off from the Domain Controller in my test of Dec 18, 2018 8:08 PM, posted above, since the default setting of Maximum Tolerance for Active Directory on Windows is 5 minutes.


BUT! ... none of that matters. The helpful folks and LinuxQuestions.org found the answer to this puzzle. Mac DOES NOT use ntpd. Since High Sierra Mac uses timed. Read all about it here https://eclecticlight.co/2017/10/27/has-anyone-got-the-time-how-high-sierra-has-changed-time-synchronisation/. Therefore, tools like ntpq and ntpdc won't work. There's nothing listening on the local host on the ports which these utilities use. Furthermore, this is a customized, stripped down version of timed, not the original, full-fledged version that runs on Unix. There are no parameters, commands or timedc program for interfacing. It does, however, use /etc/ntp.conf although I presume everything except the actual host name(s) is ignored.


Interestingly, that link author suggests taking "a careful look at" /var/db/timed/com.apple.timed.plist to investigate the state of timed, but I found that to be a binary file. If anyone knows how to look at that file, please advise.

Dec 18, 2018 9:27 PM in response to markfoley

This should work for the ntp.conf manpage...

https://www.freebsd.org/cgi/man.cgi?query=ntp.conf&sektion=5&manpath=freebsd-release-ports


Ordinarily, ntpd reads the ntp.conf configuration file at startup time in order to determine the synchronization sources and operating modes. It is also possible to specify a working, although limited, configuration entirely on the command line, obviating the need for a configuration file. This may be particularly useful when the local host is to be configured as a broadcast/multicast client, with all peers being determined by listening to broadcasts at run time.

Usually, the configuration file is installed in the /etc directory, but could be installed elsewhere (see the -c conffile command line option). The file format is similar to other Unix configuration files - comments begin with a # character and extend to the end of the line; blank lines are ignored.

http://doc.ntp.org/4.1.0/ntpd.htm


Is it a bad idea to actually run ntpd?


I don't think so, but...

ntpd has gotten rather fat. While not huge, it has gotten larger than might be desirable for an elevated-priority ntpd running on a workstation, particularly since many of the fancy features which consume the space were designed more with a busy primary server, rather than a high stratum workstation in mind.


Dec 20, 2018 11:12 AM in response to BDAqua

Thanks... ignored how???


ntpd presented with an out-of-range time value ignores the data.


Quoth the macOS ntpd documentation:


     -g, --panicgate


                 Allow the first adjustment to be Big.  This option may appear an unlimited number of times.


                 Normally, ntpd exits with a message to the system log if the offset exceeds the panic threshold, which is 1000 s by default. This option allows the time to be set to any value without restriction; however, this can happen only once. If the threshold is exceeded after that, ntpd will exit with a message to the system log. This option can be used with the -q and -x options.  See the tinker configuration file directive for other options.

Dec 18, 2018 5:59 PM in response to markfoley

More information ... I've stripped my /etc/ntp.conf file down to:


mail.hprs.local


although that doesn't seem to have made much difference. When I had the other servers and "iburst" and "prefer", etc. in there, the System Preferences > Date & Time > Set date and time automatically, showed all servers separated by commas, so perhaps my original conf file is no worse that this stripped down version.


I get the following results from the systemsetup command:


root# systemsetup -getusingnetworktime

Network Time: On

root# systemsetup -getnetworktimeserver

Network Time Server: mail.hprs.local


This seems to indicate the ntp is working, yet when I run 'ps ax | grep ntp' I get nothing. Is time still synchronizing or not?


if I run ntpd it does run and I can then see it in 'ps ax | grep ntp'. But it doesn't seem to make any difference. Does it not matter if this is actually running?


Also, I can do:


root# ntpq -np mail

remote refid st t when poll reach delay offset jitter

==============================================================================

127.127.1.0 .LOCL. 10 l 40h 64 0 0.000 0.000 0.000

*192.150.149.245 198.60.22.240 2 u 348 1024 377 65.560 1.922 0.869

+192.111.144.114 146.186.222.14 2 u 1039 1024 373 35.510 9.632 1.165


where 'mail' is the ntpd server specified in ntp.conf. This lists mail's peers. Again, inidicating ntpd is working, but why nothing in ps ax?


This doesn't work:


root# ntpq -np

localhost: timed out, nothing received

***Request timed out


That is, I cannot query peers for the localhost, so I can't get verify the server information for the localhost. This works on all non-Mac computers I've tried that use ntp. Why?


Feel free to jump in on this ... anyone ... really




Dec 18, 2018 8:08 PM in response to BDAqua

The time server is a local Active Directory / Domain Controller, and it has a default Maximum Tolerance policy of 5 minutes. What happens if the difference is more than 5 minutes I don't recall. Nevertheless, to be safe, I tried your idea but setting the clock difference to 4 minutes. I 'watch'ed the time on both the AD/DC and Mac workstation, then went away for an hour. When I returned, the times were back in sync. So, yes, they synchronize. Good suggestion!


Since nptd is NOT running on the Mac, do you have any idea what is doing the synchronization? Is it a bad idea to actually run ntpd? Do you know whether the other ntp.conf settings (iburst prefer, fudge, restrict, ...) do anything at all? iburst is mentioned in the ntpd manpage. The ntp.conf manpage doesn't exist on the mac despite its being referenced in the ntpd manpage. The driftfile definitely never gets created.


Finally, what about the 'ntpq -np localhost' not working? Any idea on that?

Dec 19, 2018 2:35 AM in response to BDAqua

I think I've got the ntp.conf syntax pretty well figured out. But I'm more confused ... The link you gave references ntpq and ntpdc, but neither work for the local host:


root# ntpq -np localhost

ntpq: read: Connection refused


root# ntpdc -l -n localhost

ntpdc: read: Connection refused


Why is the connection refused? The firewall is not running. Another posting said I needed 'restrict 127.0.0.1' or the ntpq wouldn't work for the localhost. I've tried that, but the results are shown above.


If ntpd is not doing the synchronizing, what is?


You opine that it's not necessary "bad" to run ntpd, but would than not interfere with whatever is already doing the synchronizing? Going ahead and running ntpd doesn't seem to help with the ntpq problem although it then doesn't say "connection refused"; it times out instead.


In the end, as long as the time gets synchronized I shouldn't care, but I'd like to understand what's doing the synchronization and why documented commands don't work.

Dec 20, 2018 12:08 PM in response to BDAqua

Well, how does it correct it when it's years off then?


To avoid this, most folks using ntpd will eventually learn to make a query to update the local time using ntpq (or ntpdate) before launching ntpd. Or launch ntpd with the -g option. Or the operating system can make that ntp query for the user, depending on the details of the ntp configuration within the local operating system configuration.


Or are we talking about the fudge value where the internal clock runs slow or fast?


That's the normal and expected outcome of a well-behaved ntp environment, and not related to an out-of-range time. When the ntp server is receiving time values from lower-stratum time servers and these within its expected range, the local system time update frequency will be drifted more quickly or more slowly, to bring the system time toward the received time without ever causing the system time to change backwards. System clocks have ticks, and ntp adds or removes a few ticks from the larger batch of ticks associated with each clock update to drift the current clock time toward the time values being acquired directly or indirectly from the ntp stratum-0 reference time clock(s) in use.


If you're interested in these sorts of details, see the documentation available at the ntp.org web site. That is the project site for one of the more common ntp servers in use on the 'net, though (per an earlier posting in this thread) High Sierra has gone its own way with its own timed service.


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

configure, start ntpd service

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.