Keeping the Clock Synchronized
When your server is booted, it’s clock is set to match the underlying host. However, over time the clock can drift, just like any other computer.
If you need to the time to be kept accurate, then it needs to be synchronized using the NTP protocol. Two popular packages to do this are ntp and chrony.
For either ntp or chrony, simply install the appropriate package.
By default each will use a pool of global NTP servers. Zerigo also provides a pair of NTP servers (each of which have both IPv4 and IPv6 addresses). Zerigo’s servers are closer, but the global servers will work too. Zerigo’s servers are:
- tick.zerigo.net
- tock.zerigo.net
chrony is a little bit lighter-weight than ntp, however ntp supports IPv6 and is a little bit more flexible.
Additionally, if you are using a kernel version ≤ 2.6.26, you will likely need to tell the kernel to allow local changes to the clock. Newer kernels no longer need this setting.
To set it one time (lost at reboot):
echo 1 > /proc/sys/xen/independent_wallclock
To set it permanently:
echo 'xen.independent_wallclock = 1' >> /etc/sysctl.conf
and then run sysctl -p or reboot.
Please note that older versions of Xen and older kernels didn’t need any of the above and it was generally recommended to not run NTP. Older articles across the internet generally reflect this. However, with newer pv-ops kernels or with Xen 4.0 this has changed and running NTP is necessary.
