Time changes

Latest response

Hello,
On a redhat 5 server i get a different output each time i run the command : date.
for exp:
date
Mon May 11 15:46:49 WET 2015
date
Mon May 11 15:36:10 WET 2015

i stopped the ntp service but no change
what can cause this problem ?
thank you
bye

Responses

Hi Khawla,
Is this a physical or virtual machine?
Are you the only person logged in? ;-)

Do you see a pattern to how the time fluctuates?
Do you see any outbound connections on port 123?

# grep ^ntp /etc/services 
ntp             123/tcp
ntp             123/udp                         # Network Time Protocol
# netstat -anp | grep ^[tu] | grep :123
udp        0      0 10.84.8.110:35723       97.107.131.6:123        ESTABLISHED 1729/chronyd       
... truncated....
# grep ntp /var/log/messages

Hi,
It is a virtual machine running on Hyper-v
Yes i am the only person curretly logged on
This is a sample output where you can see the pattern (I ran the command date on 09:57 )

date

Tue May 12 08:07:49 WET 2015

date

Tue May 12 07:50:03 WET 2015

date

Tue May 12 08:07:55 WET 2015

date

Tue May 12 07:50:08 WET 2015
these are the outputs of the commands :

grep ^ntp /etc/services

ntp 123/tcp
ntp 123/udp # Network Time Protocol

grep ntp /var/log/messages

May 11 00:23:25 srv ntpd[2510]: synchronized to 168.167.71.131, stratum 2
May 11 00:25:01 srv ntpd[2510]: time reset -928.583730 s
May 11 00:46:17 srv ntpd[2510]: synchronized to LOCAL(0), strat um 10
May 11 03:31:46 srv ntpd[2510]: synchronized to 168.167.168.38, stratum 2
May 11 03:48:46 srv ntpd[2510]: synchronized to 168.167.71.131, stratum 2
May 11 03:48:59 srv ntpd[2510]: synchronized to LOCAL(0), strat um 10
May 11 04:06:20 srv ntpd[2510]: synchronized to 168.167.71.131, stratum 2
May 11 04:40:12 srv ntpd[2510]: synchronized to LOCAL(0), strat um 10
May 11 05:14:07 srv ntpd[2510]: synchronized to 168.167.168.38, stratum 2
May 11 05:31:16 srv ntpd[2510]: synchronized to 196.43.1.5, str atum 2
May 11 05:15:41 srv ntpd[2510]: time reset -935.284305 s
May 11 05:36:45 srv ntpd[2510]: synchronized to LOCAL(0), strat um 10

i just wanna add that yesterday i stopped the ntp service but the same thing happened

It sounds as though you have competing things attempting to control your clock (likely NTP and the Hypervisor tools). Unfortunately there are quite a few ways that you could have your environment configured - and I have no experience with Hyper-V.

For example, if using Vmware and NTP, there is a VM-specific setting they recommend.

Set tools.syncTime = "FALSE" in the configuration file (.vmx file) of the virtual machine.

From my limited research, it appears that Hyper-V also has a Time Synchronization capability
https://technet.microsoft.com/en-us/library/dn798297.aspx
and it appears that most folks do not recommend disabling it.

Hopefully a Portal member with more Hyper-V experience can chime in, but I would review that doc and investigate what best-practice Microsoft recommends.

You seem to be switching between stratum 2 and stratum 10 time sources. Which servers are indicated by the command "ntpq -p" and do you have connectivity issues with one of these servers?

We use VMware ESXi, but from my experience with RHEL VMs we simplify things by disabling NTP on the VM guest hosts and ensure the VM HOSTs' NTPd syncs to our NTP server and the guest will correctly pick up the clock times. I've only seen the RHEL guest VMs drift when the vmtoolsd daemon crashed or died and we didn't know it, restarting it corrected the time immediately. Now we have a simple check script ensures the vmtools are always running.

Hope this helps.

VMware tools' timekeeping has, historically, been suboptimal. If you're AD-integrating, best results come from letting your AD tools time-slave to the domain controllers. Otherwise, I'd probably go with ntpd (though, ntpd needs a real NTP server since AD uses an SNTP implementation that ntpd is happy to use for an initial-sync but not a continuous sync against).

In general, unless you like your logs spammed with time-adjustment events (and audispd calling out all the time resets), you really want to make sure only one sync method is being used.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.