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...

  • Are there any errors in the logs? If you leave SSH long enough does it let you in (i.e. could it actually be a DNS issue and it is waiting for a reverse DNS lookup on the incoming ssh connection to timeout). Is there a reason ntpd isn't running on this machine? Why are you manually running ntpdate from a cron? Is this a virtualised system or a physical box (I assume the latter as you mention the battery but need to check)? – webtoe Apr 23 '12 at 10:28
  • It's a physical box - the battery i mention is the one in the motherboard... I don't think it's a ssh problem, because in the terminal at the physical machine, i can't do much either... If i try an ls, it does nothing and i stay waiting for the listing... If i execute a command, it does execute it... I don't have ntp running (for now) because it does nothing... in that time, i thought it was something with ntp and replace it with the cron jobs, just to see if it was something... The logs show absolutely nothing... – Feiticeir0 Apr 23 '12 at 11:14
  • dmesg? <space filler> – Kyle Smith Apr 23 '12 at 11:58
  • As an aside, why are you using cron to sync the time? Why not use ntpd? – cjc Apr 23 '12 at 12:35
  • He's probably running an ntpdate from cron. – ewwhite Apr 23 '12 at 12:36

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:


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:


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...

| improve this answer | |
  • Thank you Chris... I'm starting to think this is not an NTP issue - This Monday morning i knew the machine was "stopped" because the primary DHCP server was complaining... I went to the console, logged in and check the date - April, 19 22:51:01 (10pm). The logs show absolutely nothing (next edit) – Feiticeir0 Apr 23 '12 at 14:04
  • Apr 19 22:51:01 sauk dhcpd: DHCPREQUEST for <ip> from <MAC> via bond0 Apr 19 22:51:01 sauk dhcpd: DHCPACK on <ip> to <MAC> via bond0 Apr 23 09:17:07 sauk init: tty (/dev/tty1) main process ended, respawning Apr 23 09:17:11 sauk dhcpd: failover peer dhcp: peer moves from normal to communications-interrupted Apr 23 09:17:11 sauk dhcpd: failover peer dhcp: I move from communications-interrupted to normal Apr 23 09:17:11 sauk dhcpd: balancing pool 217d0b8 vmanage.domain.com total 1 free 1 backup 0 lts 0 max-own (+/-)0 Apr 23 09:17:11 sauk dhcpd: balanced pool 217d0b8 vmanage.domain.com – Feiticeir0 Apr 23 '12 at 14:05
  • I had NTPD configured before, but i removed and tried cron jobs with rdate... But still no cigar... Couldn't this be some network problem? The machine is not "stopped" per say, but it doesn't work either..It has ping, i can login (in the console - remote only stays in the prompt) and perform some commands - not all - ls does not work .. Don't really know what could be... – Feiticeir0 Apr 23 '12 at 14:10
  • So the "secondary" machine was not responding; the OS was still responding, you could login? Was the dhcpd process running still? Anything interesting in /log/messages, /log/debug, do you have DHCPd logging specifically enabled? – Chris S Apr 23 '12 at 14:13
  • Yes, the machine is "kind of working". Has you can see by the comment above, the syslog stops in April 19 22:51:01 and starts at April 23 09:17 when i manually synchronized the clock again.. Could DHCP had something to do? It does complains about the clock skew (the primary server) – Feiticeir0 Apr 23 '12 at 14:22

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 using hwclock -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.

| improve this answer | |
  • Well, it's old harware - Fujitsu-Siemens L200 dual PIII 1300MHz with 3GHz memory. It's a new install, but the machine, before installing CentOS 6 in it, it was perfect - but has been shutdown for about 1 year before this new install – Feiticeir0 Apr 23 '12 at 13:57
  • It's your motherboard/CMOS battery :) Replace it! – ewwhite Apr 23 '12 at 14:56
  • will try in a few moments and let you know in two days (holidays in Portugal =:)) – Feiticeir0 Apr 23 '12 at 15:09
  • Well, it didn't work... The machine still keeps "hanging"... Since this is the secondary server, i'll disable dhcp and wait ... – Feiticeir0 Apr 26 '12 at 13:50

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.