I started to read *The NTP FAQ and HOWTO: Understanding and using the Network Time Protocol (A first try on a non-technical Mini-HOWTO and FAQ on NTP)* ¹ because my computer clock is off by more than ten minutes, and I haven’t had that problem in ages. New hardware, no ntp installed (I think?)...
As root, you can run *ntpdate pool.ntp.org* – or you can use certain subdomains like *europe* or (in my case) *ch*:
root@confusibombus:/etc# date; ntpdate ch.pool.ntp.org; date Sat Nov 27 20:41:30 CET 2004 Looking for host ch.pool.ntp.org and service ntp host found : armagnac.ifi.unizh.ch 27 Nov 20:41:30 ntpdate[1274]: step time server 130.60.75.72 offset -0.577247 sec Sat Nov 27 20:41:30 CET 2004
So from time to time, I will just run the ntpdate command with a server on the command-line. Comments on 2004-11-26 Software also talks about the info in the _etc_ntp.conf file and how to use the ISP’s ntp server.
Comments on 2004-11-26 Software
#Software
(Please contact me if you want to remove your comment.)
⁂
i’m still on 9.1:
$ slacklist.sh ntp -rw-r--r-- 1 root root 12733 Oct 10 11:21 ntp-4.1.2-i486-2 ~ $ cat ~/bin/ntpdate.sh #! /bin/sh echo `date` sudo /usr/sbin/ntpdate -b -s 128.194.254.9 echo `date`
comments:
i used to have it set up to poll the ntp server every 12 hours, but that is overkill (i don’t like to overburden any resource).
now i just run the script every week or so, and see how much the clock has drifted since the last time i synced.
– GregScott 2004-11-26 22:52 UTC
---
Hm. Specifying the server on the command line works.
I was trying to use the following _etc_ntp.conf file from the NTP wiki:
server pool.ntp.org server pool.ntp.org server pool.ntp.org server pool.ntp.org restrict default noquery notrust nomodify # restrict 127.0.0.1 # restrict 80.218.0.0 mask 255.255.248.0 # fudge 127.127.1.0 stratum 3 # server 127.127.1.0 driftfile /etc/ntp.drift logfile /var/log/ntp.log
But it doesn’t work as expected:
root@confusibombus:/home/alex# ntpdate 27 Nov 09:37:25 ntpdate[1252]: no servers can be used, exiting
And furthermore:
root@confusibombus:/home/alex# ntpq -np ntpq: read: Connection refused
On the command-line it works. Strange.
root@confusibombus:/home/alex# date; ntpdate ch.pool.ntp.org; date Sat Nov 27 09:41:22 CET 2004 Looking for host ch.pool.ntp.org and service ntp host found : gaia.ailab.ch 27 Nov 09:41:21 ntpdate[1274]: step time server 130.60.75.60 offset -1.305593 sec Sat Nov 27 09:41:21 CET 2004
– Alex Schroeder 2004-11-27 08:42 UTC
---
not really related, except it’s an online clock, you might have allready seen it but anyway I like the idea:
Alex,
you might need a line in ntp.conf to remove the global “restrict” just for the server you want to use:
restrict <server>
i long ago installed over my customized ntp.conf, but i think the logic is:
restrict default ...blah blah restrict my_preferred_server
the first restrict blocks everything, the second is necessary to “unrestrict”. yes it is confusing if it works that way...
– GregScott 2004-11-27 18:04 UTC
---
I notice that _etc_ntp.conf gets rewritten after every boot. I need to investigate. The answer was provided by clavius on #slackware @ freenode: It turns out that dhcpcd rewrites the config file:
restrict default noquery notrust nomodify restrict 127.0.0.1 restrict 80.218.0.0 mask 255.255.248.0 fudge 127.127.1.0 stratum 3 server 127.127.1.0 driftfile /etc/ntp.drift logfile /var/log/ntp.log
When I use whois 80.218.0.0, I get this:
inetnum: 80.218.0.0 - 80.218.0.255 netname: CABLECOMMAIN-NET descr: Cablecom GmbH descr: DHCP Scopes descr: Zuerich
My provider! Aha! Trying:
root@confusibombus:/etc# ntpdate 80.218.0.1 Looking for host 80.218.0.1 and service ntp host found : 80-218-0-1.dclient.hispeed.ch 27 Nov 21:44:01 ntpdate[1483]: adjust time server 80.218.0.1 offset 0.126001 sec
I guess that’s the correct usage of the ntpdate command.
– Alex Schroeder 2004-11-27 19:39 UTC