[ntp:questions] Clock selection in Orphan Mode

Mathieu Deltorre deltorrem at gmail.com
Mon Jul 29 09:47:49 UTC 2013


Reading the documentation might help:
> http://doc.ntp.org/4.2.6p5/assoc.html#orphan
> (6th paragraph)
> While ordinary NTP clients use a selection metric based on delay and
> dispersion, orphan children use a metric computed from the IP address of
> each core server. Each orphan child chooses the orphan parent as the
> root server with the smallest metric.

Yes. That my pointer.

To answer:

>>   tos orphan 1
>I'd set that higher like maybe 10 {then maybe that's just me}.
I'm aggree. In my case, I already know that no UTC sources are available to
any core server. That why I configure ntpd in orphan/broadcastcast mode.
I follow NTP architecture illustrated in  "Figure 2. Orphan Broadcast
Configuration" in documentation

>> Second question:
>> My needs is to synchronize network time to the maximum time
>>  of all PCs.
>??? what in the world does that mean.
I mean : In orphan mode, orphan children use a metric computed from the
offset time of each core servers. Each orpahn child chooses the orphan
parent as the root server with the highest metric.

According to the documentation :
http://www.eecis.udel.edu/~mills/ntp/html/clock.html Paragraph "Step and
Stepout Thresholds"
"In some applications the clock can never be set backward, even it
accidentally set forward a week by some evil means"
The previous given example do not validate this sentence.

To be more precise:
Test scenario.
1/ Under ordinary condition, no UTC sources are available to any core
server, one of them (in my case : PC1 with ip x.x.x.1) can provide a
simulated UTC source for all other hosts in the subnet. Assuming synched
time is 10h00.
2/ All systems reboot
3/ In case of hardware failure (or operator error), init hardware clock of
PC1 is set to 09h00 (or worst 1 Jan 1970)
4/ ntpd on all systems are restarted in orphan/broadcast mode in order to
broadcast their local clock and to first synchronize all systems.
5/ PC1 is select as a root server. NTP time is now the time of PC1.
6/ Time is set backward on PC2 and PC3, resulting inconsistent data
timestamp stored in DB for example.

I think I have a point. Still determine if this is an issue.

I code a new metric for select an orphan parent in orphan mode based on
offset. Should be read as a workaround to fix my issue.
ntp version 4.2.7 p368
in ntp_proto.c, in function clock_select, near line 2470:

if (peer->stratum == sys_orphan) {
    if(sys_offset < peer->offset ) {
        typeorphan = peer;
        fprintf(stderr, "clock_select select typeorphan=%p\n", typeorphan);

Please feel free to comment and correct anything.


More information about the questions mailing list