0

I read that ntp uses all the servers for time synchronization. It got me one question. Suppose I am having multiple servers in the ntp.conf file and time gap is also more than 1 day. I have not specified prefer keyword also in the ntp.conf file.

server.1 <ip>
server.2 <ip>
server.3 <ip>
server.4 <ip> 

If I ran ntpd with -g option then which server will ntp daemon prefer for filling the large time gap?

Romain
  • 207
  • 1
  • 6
vivek
  • 105
  • 1
  • 5

1 Answers1

4

I read that ntp use all the servers for time synchronization.

Yes. Use at least 4 where feasible.

A better performing one is picked as the system peer, according to the selection algorithm. Including when ntpd starts, based on the first few timestamps received from all the peers.

In both startup or ongoing operation, NTP estimates what "NTP time" is. The ntpd -g option allows an infinite step, only once, in case the system clock is very wrong. VM resumed and time not corrected, failed or missing real time clock hardware, that kind of thing.

I have not specified prefer keyword also in the ntp.conf file.

Do not use the prefer keyword. The algorithms are good at estimating time keeping performance. Collect data to prove the hypothesis that you can pick a better peer, if you want to use prefer.

Paul Gear
  • 4,367
  • 19
  • 38
John Mahowald
  • 32,050
  • 2
  • 19
  • 34
  • Thank you for the answer. My question is when I am using `ntpd -g` then with which server it will sync the time from the conf file. Does ntpd -g also uses selection algorithm for time sync or it just set the clock with any one of the server from the conf file – vivek Jul 16 '21 at 17:36
  • `ntpd -g` always uses the selection algorithm, unless you configure it with an insufficient number of peers. – Paul Gear Jul 16 '21 at 19:30