[ntp:questions] How the "peer candidate" is selected?
cswiger at mac.com
Fri Oct 22 19:05:16 UTC 2010
On Oct 22, 2010, at 9:37 AM, pateretou Pateretou wrote:
> I'm so embarrassing with this stupid question but I'm not very comfortable with the "peer select algorithm"
> Let me try to explain:
> I've got one GPS stratum 1 server located in New York (172.17.200.100) and one GPS stratum 1 server located in London (172.17.100.100).
> in each datacenter approx 200 servers sync on BOTH servers
> server 172.17.100.100 minpoll 4 maxpoll 4
> server 172.17.200.100 minpoll 4 maxpoll 4
> I would like servers in london sync to the London GPS and servers in NY sync with the NY GPS (seems to be a coherent choice, isn't it?)
Sure, and you can add the "prefer" keyword to cause NTPd to try and use a particular NTP server for syncing, unless something appears obviously wrong with it.
Anyway, given the # of clients, I would be strongly tempted to set up three machines in each data center, all referencing each others as peers and referencing either the non-local NTP server in the other data center, or some other public stratum-1 or -2 NTP source for highest redundancy, because NTP clock selection algorithm can do a better job if at least 4 timeservers are configured.
For your client boxes, either setup a DNS alias like time-ny.example.com & time-london.example.com which lists A records for the three IPs of the local timeservers in the corresponding data center, and just have a single "server time-ny.example.com" line for the client configs, or do something like:
London client machines ntp.conf:
server 172.17.100.100 iburst prefer
server 172.17.100.101 iburst
server 172.17.100.102 iburst
NY client machines ntp.conf:
server 172.17.200.100 iburst prefer
server 172.17.200.101 iburst
server 172.17.200.102 iburst
...assuming you'd setup .101 & .102 as additional NTP servers. The default poll intervals for the client machines should be fine; keep using maxpoll 4 for traffic between the designated NTP servers, if you like.
> The problem is all my servers are the NY server in "sys.peer". But the only "difference" between my timeserver with my servers in london is the delay is bigger with the NY server so I don't understand why my server use the NY server for sync and not the london server
> $ ntpq -pn
> remote refid st t when poll reach delay offset jitter
> +172.17.100.100 .PPS. 1 u 9 16 377 0.178 0.007 0.008
> *172.17.200.100 .PPS. 1 u 8 16 377 67.203 0.009 0.010
> Why my servers are sync with the most away time server?
Checking the details of the status messages suggests that the London timeserver claims a precision of -19, but NY claims -20. If everything else is identical, ntpd likes the higher precision source-- higher network delay doesn't really matter if it is consistent, and your jitter results suggest that the delay is quite consistent....
More information about the questions