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...
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 runntpd
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
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:
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:
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...
How are you setting the date? Are you setting the hardware clock as well? This is something that I've had to add to my kickstarts and build process for CentOS 6.
After you run your
ntpdate
command, set the hardware clock to the new system time usinghwclock -w
.You didn't give any detail as to how long this has been happening, or if this was a new build, new hardware, old hardware or if you are rebooting in between. That may help. I would look at the motherboard battery if you start losing BIOS settings across reboots and the system is older.
I'm solving my question. I know what's happening now. The DHCP load balance solution (according to DHCP documentation) is what's causing all this. Since i've stopped the service, the server is running smoothly.
I'll dig into it and check what can i do to have a load balancing solution "by the book".
Thank you all for the tips and answers.
EDIT: It turns out that the problem is really the machine... Something is wrong and it hangs... DHCP has been turned off for some time and i found the machine "crashed"... Thank you all for the answers.