1

I am synchronizing 4 Raspberry Pi Clocks with an Ubuntu server (all in a local net, connected over ethernet), using NTP. All devices are offline, so the Server just listens to its local clock; The real time does not matter. When I reboot the host computer and start the NTP server, the clients cannot synchronize for a couple of minutes: The command

sudo ntpdate NTP-server-host

throws the error:

18 Jun 18:42:55 ntpdate[1546]: no server suitable for synchronization found

(NTP-server-host corresponds to the ip of the server) After some minutes it works. This only happens after a reboot. What could be the reason? The server is running and the firewall ports are opened.

ntp.conf on Server:

driftfile /var/lib/ntp/ntp.drift

# Leap seconds definition provided by tzdata
leapfile /usr/share/zoneinfo/leap-seconds.list

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

server 127.127.1.0
fudge 127.127.1.0 stratum 10

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# Needed for adding pool entries
restrict source notrap nomodify noquery

ntp.conf on Client:

driftfile /var/lib/ntp/ntp.drift

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable


# pool.ntp.org maps to about 1000 low-stratum NTP servers.  Your server will
# pick a different set every time it starts up.  Please consider joining the
# pool: <http://www.pool.ntp.org/join.html>
pool 0.debian.pool.ntp.org iburst
pool 1.debian.pool.ntp.org iburst
pool 2.debian.pool.ntp.org iburst
pool 3.debian.pool.ntp.org iburst

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# Needed for adding pool entries
restrict source notrap nomodify noquery

# Use specified ntp server
server NTP-server-host prefer iburst

I only modified the ntp.conf files and do not understand them completely. It would be amazing if somebody with a deeper understanding could show me the mistakes in it. Thanks!

  • If you're expecting the clients to sync with "NTP-server-host" only, then I would find the "pool" entries in their config to be confusing ... – Jeff Schaller Jul 3 at 15:57
  • Thank you for the answer! I will remove them. I just thought they would not matter and I might change back the settings at some point. But I feel like the core of the problem is shown in the error after calling "sudo ntpdate NTP-server-host" – James Trüeb Jul 3 at 16:08
  • Indeed; I don't have a full answer, but wanted to narrow the problem a bit. It sounds to me like the problem is that the NTP server doesn't advertise that it's a "good" / "reliable" server for several minutes after it starts, perhaps by design. – Jeff Schaller Jul 3 at 16:17
0

This is perfectly normal. NTP takes several cycles to stabilise and start serving time. The client part also takes several cycles to accept that a server is stable and able to offer time.

You can see what's going on with your Ubuntu server by running this

ntpq -pn

I would also recommend that you remove the pool servers from your clients' configuration as you said that all your systems were running offline.

  • Ok, thank you! But up to 10 minutes, would that not be a bit too many cycles? The status of the NTP server says INIT before it works. Do you know a way to speed up the NTP sync after a server reboot? – James Trüeb Jul 4 at 11:59
  • Remove the external pool servers from your server's configuration. You've said it's offline so there's no point trying to contact them. – roaima Jul 4 at 12:27
  • I guess you are tallking about my client's configuration, which I have already adjusted. Still cannot call "ntpdate" in the first minutes – James Trüeb Jul 4 at 12:38
  • Yes, client's configuration, sorry. (I've updated my question correctly.) Don't use ntpdate to set the time when you're running ntpd. Use ntpdate -qu {server} to visually check the time, by all means, but you'll upset ntpd if you jump a client's time underneath it. Use ntpq -pn on either a client or on the server to see what's going on. – roaima Jul 4 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.