Pages

Saturday, 31 December 2011

Keep your vps clocks in sync

An issue I’ve come across a lot is that clocks don’t stay correct for a long time…
Now some smart heads thought up a way to fix that, it’s called NTP, Network Time Protocol.
Setting it up is easy:
on RHEL/Fedora/CentOS:
centos ~ # yum install ntp
on Debian and debian based distributions:
debian ~ # apt-get install ntp
(everything is root of course)
on debian you are done now, NTPD should be started, of course if you want to specify your own NTP server or NTP pool, you just edit /etc/ntp.conf
on RHEL it’s just a few more steps:
chkconfig ntpd on
ntpdate pool.ntp.org
/etc/init.d/ntpd start
and that should be it, please do know that if it’s a VPS forget about NTP, the system time is inherited from the host, unless you run it on a windows host(ex. Windows 2008 or in my debian server’s case, Windows 2008 R2 and using Hyper-V)
The error you get will be something like this:
ntpdate[18411]: step-systime: Operation not permitted
after trying to run ntpdate pool.ntp.org
On Windows it’s all a hell lot easier(in gui that is)
Right click on the clock and choose Adjust time and date
go to the Internet time tab.
then click the button saying Change settings.
make sure the checkbox is checked, and if you prefer a different ntp server, change it from time.microsoft.com (but it’s good as well, NTP takes latency into account when setting clock)
Windows does not support ntp pools, so please define a proper NTP server。

No comments:

Post a Comment