Configuration of Time Syncronization (NTP)

From Proxmox VE
Jump to: navigation, search

Proxmox itself rely heavily on the fact that all the nodes have precisely synced time. Some other component, like Ceph, refuse to work properly if storage nodes are not in sync.

Time synchronization between nodes can be achieved with the Wikipedia:Network Time Protocol, or shortly NTP.

Continuous time synchronization via NTP can be achieved using the ntpd daemon (the only choice before systemd, eg Proxmox < 4) or systemd-timesyncd (for proxmox >= 4); note that ntpd can keep local time in sync but also is a NTP server, eg if available systemd-timesyncd is surely better.
Anyway, both services came preconfigured against a set of public NTP server, and work out of the box.

The trouble arise when you put nodes behind a firewall, and so default configuration does not work. You can pinhole your firewall, but probably you have also a proper configured network of internal NTP server to use (configuration of NTP server is out of the scope of this page, indeed).
You have to specify that.

ntpd

For ntpd it suffices to edit /etc/ntp.conf, comment out all the existing server lines (pointing to public NTP server aliases) and adding instead your internal server, one per line:

server ntp1.internal.local iburst
server ntp2.internal.local iburst

then it suffices to restart the service:

service ntp restart

systemd-timesyncd

Similarly, you have to edit /etc/systemd/timesyncd.conf, comment out the existing Server line under the [Time] section (typically just commented, is the default) and adding your servers, space separated:

Servers=server ntp1.internal.local server ntp2.internal.local

Then service have to be enabled (normally is, but in doubt):

timedatectl set-ntp true

and then restarted:

systemctl restart systemd-timesyncd