Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
serve ntpd only from hwclock?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
dasPaul
Apprentice
Apprentice


Joined: 14 Feb 2012
Posts: 183
Location: Dresden

PostPosted: Thu Sep 15, 2016 5:33 am    Post subject: serve ntpd only from hwclock? Reply with quote

Hi
I have a Raspberry Pi with a RTC Module. Ntpd is running on it and serves the time
among my local clients. I do not fully understand how and what time is served
from ntpd.
Is this correct that ntpd connects from time to time to an external server
to correct the drift and sets the swclock (and not hwclock)? If yes, is it possible do disable that and make ntpd simply serve
the time that the RTC has to the clients. I want then to sync the RTC Module to an external
server only once in a month. is that possible?
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Thu Sep 15, 2016 7:48 am    Post subject: Reply with quote

What i saw so far with the ntp stuff is that you can set only the software clock or both the software and the hardware clock.

date vs hwclock command

i use the following, => /etc/ntp.conf

Code:
ASUS-G75VW roman # rc-update show|grep ntp
           ntp-client |      default 




The ntp stuff is not that bloated you should stick to the standard configs.

Also bear in mind that you have over one single day a certain drift on notebooks for example, so I doubt it will be smart to only sync it once a month. There are also leap seconds, seconds which are inserted, which are not covered by the hwclock for example ...


You may look in the manpage for ntp and also check those examples on the net for ntp.

a bit off topic: I had with my notebook a drift of several minutes over ~1-3 weeks. The other notebook which I sold had an issue with wrong clock on a random basis. so ntp keeps your files at a correct timestamp which is important for troubleshooting. Quite annoying when your box tells you for example, file system check enforced on ext3 because files in the future were found and such nonsense


I recommend that you go with the standard settings as this "daemon" service is very slim and leightweight

--

you can set up for sure your own ntp-server if desired
Back to top
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1717

PostPosted: Thu Sep 15, 2016 6:01 pm    Post subject: Reply with quote

Quote:
correct the drift and sets the swclock (and not hwclock)

Software and hardware clock refer each other. Many systems use software clocks when they are powered on, fix hardware clock on shutdown, let it run when powered off, and then read the results back to software when they boot.
Other systems always use hardware, and some others cut the costs and do that in software only.

Quote:
Ntpd is running on it and serves the time
among my local clients. I do not fully understand how and what time is served
from ntpd.
Thsi depends on the time source you have. Since you only said about pi, I assume it's just a cheap (And not very accurate) clock. In this case you should synchronize with remote time servers, adjust your clock, and THEN serve it to other machines in your network.

It's quite different when you plug a GPS receiver though: those things allow you to synchronize with incredibly accurate atomic clocks running aboard the satellites. Using this signal for a source you can be sure your pi's time will be more accurately adjusted than whatever you can get from remote servers.
Not that it actually mattered, for YOUR builtin clock is not accurate enough to notice :)
If you want to know how the time is served, you may consider running wireshark (or any other sniffer) on port 123. It's not very verbose.
Back to top
View user's profile Send private message
dasPaul
Apprentice
Apprentice


Joined: 14 Feb 2012
Posts: 183
Location: Dresden

PostPosted: Fri Sep 16, 2016 6:45 am    Post subject: Reply with quote

The reason I want this is simply I dont want each client in the subnet to connect to an external ntp server on boot but instead only
to my RPi.

I think I will do some test to see what drift I have to expect from the RPi's swclock vs. hwclock over time. My RTC Module
is a DS3231 which seems to be "quite" accurate (not compared to GPS clocks).

Well actually the RTC Module is a bit meaningless if ntpd is running, because ntpd syncs swclock to external servers when it "thinks" the drift is to high.
I'll read a bit more through the docs. So far thanks for your thoughts.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum