Linux Centos 6.2 “hangs” until date is synchronized

centosdatelinuxntptime

I'm having a problem that i cannot understand why or how to solve it.
I have a Centos 6.2 server, that's my secondary DNS (bind 8) and DHCP (ISC's dhcp server).

I need to maintain an accurate date because dhcp primary server complains and even stops synchronizing with the secondary server if the date diff is to high and here is the kicker.

In my secondary server i have a cron script that twice a day synchronizes the date and time (or at least it should).

Problem: The machine kind of hangs – kind of hangs because i can ping it, and even ssh to it, but after logging in, i just stays in the prompt and can't do anything else…
I solve the problem going to the physical machine, log in and synchronize the date and time manually with ntpdate (or another method such as rdate).
As soon as the date and time are ok, the machine works fine again, until it gets date and time unsynchronized again…

Someone knows what can be happening ? can this be an hardware problem, with the motherboard battery or something ?

EDITED: It's a DHCP problem. Since i've shutdown the DHCPD service, the machine is responsive and working perfectly. It really is something with the DHCP load balance configuration. I need to investigate deeply into this, because the configurations are standard. Thank you all for the responses…

Best Answer

Do not use ntpdate on any scheduled basis to keep your clock synchronized. It was not meant for that, it causes problems, it's abusive to the server you're pulling time from. Don't do it.

If you need to keep a server's time synchronized, use ntpd. It is really not that hard to setup, there's no excuse for using anything else on *nix (and I run ntpd on Windows too).

If you have multiple machines on-site that need their clocks synchronized. Pick one to be the "ntp server" (the one that pulls time from an external source). You can pick two or even three if you have a lot of servers and need some degree of reliability/availability.

Pop this into the selected server(s) /etc/ntpd.conf

server 0.us.pool.ntp.org minpoll 7 maxpoll 12 iburst
server 1.us.pool.ntp.org minpoll 8 maxpoll 14
server 2.us.pool.ntp.org minpoll 8 maxpoll 14
server 3.us.pool.ntp.org minpoll 9 maxpoll 15

driftfile /var/db/drift.ntp

logfile /var/log/ntp.log
logconfig +sysall +syncall

Those last two lines about logging are entirely optional. Enable ntpd, how will depend on your system.

Now, the rest of the servers in your site: Configure them with a file similar to this:

server 192.168.1.1

driftfile /var/db/drift.ntp

logfile /var/log/ntp.log
logconfig +sysall +syncall

Again the logging bits are optional. Change the IP to that of your "selected" server. If you picked more than one server, duplicate that first line for each server. So if you picked two servers to be your time keepers:

server 192.168.1.1
server 192.168.1.2

Nothing to it. There are millions of more advanced configurations you could setup. I highly recommend starting with a simply configuration. Just get one server syncing to an external source. Once you've got that, set the other servers to sync to it. If you find you need more accuracy or higher availability just ask, and we can churn out the config.

Misconfiguring time synchronization is a pet-peeve of mine. This stuff has been around for many years and really isn't complicated. Running a public NTP Pool server isn't even that bad...