NTP
From LinodeWiki
The Network Time protocol allows servers to synchronize their clocks. With the default Linux kernel, Linode takes care of time synchronization, but if you're using a non-standard kernel, you might want to synchronize your server.
Contents |
[edit] Am I Synchronized?
To check if you're using a Xen kernel, which synchronizes your clock automatically, check if /proc/sys/xen exists:
ls /proc/sys/xen
If the directory exists, you don't need to do anything. If it doesn't exist, you may want to do your own time syncing.
[edit] Setting Up Time Synchronization
To setup time synchronization, you need to install NTP and set it to run on bootup:
yum install ntp service ntpd start chkconfig ntpd on
By default, ntpd will synchronize with three servers in the NTP Pool at regular intervals.
[edit] Running a Time Server
If you'd like to contribute to the NTP Pool, you can do this by running ntpd. Follow the instructions above to set it up, then the below, and finally sign up.
[edit] Standard Kernels
If you're running a Linux kernel where /proc/sys/xen exists, you need to disable synchronization with the host, so that it only uses ntpd as a time source:
echo 1 > /proc/sys/xen/independent_wallclock
To make this permanent, you need to also edit /etc/sysctl.conf and add xen.independent_wallclock=1
[edit] Non-pool Sources
By default, ntpd uses servers within the pool as sources. If you're planning to contribute to the pool, you should select your own sources. For instance: public stratum 2 servers.
If your server is located in the Fremont, CA data center, you might consider using this stratum 1 source, which is operated by the data center, Hurrcane Electric: clock.fmt.he.net
Additionally, some other linodes run public time servers, both on external and data center private interfaces. A Few of them can be found on the Internal Services page.
[edit] Troubleshooting
The ntp package in the CentOS repositories will not listen at interfaces brought up unless restarted. This in undesirable, because it resets your server and disables it for a bit. This is fixed in the Production source with bug 622.
If you are getting the message "kernel time sync error 0001" in /var/log/messages, you need to switch to a newer kernel, as suggested by bug 780.
