Synchronizing The System Clock On CentOS, RHEL

January 28th, 2008

Using NTP On CentOS, RHELSometimes your web server’s internal clock can be somewhat unreliable. While this may not have any considerable consequences on an isolated server or network, this can turn out to be a nightmare when you connect it to the Internet.

Why Should Your Server’s Internal Clock Be Synchronized?

When servers are exchanging data between each other, it is sometime crucials that they are set to the same date and time. Just imagine some email message arrived five minutes before it was sent, and there even was a reply two minutes before the message was sent.

How Do I Synchronize My Server’s Internal Clock?

To synchronize your server’s internal clock, you need to use the NTP (Network Time Protocol). It is a network protocol used to synchronize the clocks of computers to some time reference.

The NTP protocol uses two components: the NTP client and the NTP server. To synchronize your server’s internal clock, you need to use the NTP client to connect to a NTP server.

How Do I Setup The NTP Client?

While there are NTP clients available for all operating systems, we’re going to focus on CentOS Linux and Red Hat Enterprise Linux. This is faily easy:

1. First you got to install the NTP package. I suggest you try using YUM for this task:

# yum install ntp

2. Then you want to have the NTP service started at boot time:

# chkconfig --levels 235 ntpd on

3. Specify the NTP server you’ll be synchronizing with. I suggest you use the NTP server pool from ntp.org:

# ntpdate 0.pool.ntp.org

4. Start the NTP service:

# service ntpd start

What’s interesting with the NTP protocol is that if the network connection is temporarily unavailable, NTP can use measurements from the past to estimate current time and error.

On MS Windows server, you can use the W32Time service. It’s been a long time since I’ve configured this on MS Windows so I’ll dig that out and post it here when I find it.

2 responses so far ↓

avatar

1. Response by : Dan on Apr 21, 2009 at 4:13 pm

avatar

2. Response by : Dan on Apr 21, 2009 at 4:15 pm

Better put the KB # and official title since the link wrapped.

Timekeeping best practices for Linux
KB Article 1006427
Updated Apr. 08, 2009

http://kb.vmware.com/selfservice/microsites/microsite.do

Leave a Comment




Webmaster Resources: Web Hosting Blog
© Copyright 2012 - TheWebHostingHero.com
Follow us on TwitterFacebookSubscribe to our RSS Feed