VMware Cloud Community
dphalen
Contributor
Contributor
Jump to solution

Time Syncronization

Is there a way to Synchronize the ESX server with time server automatically other than just at reboot? I have it set correctly to sync time during a restart and if I run an update. But unless I run the update it gets way out of sync in a month or two.

Is there some way that this can run automatically at least once or twice a week if not daily without me having to log in and run it manually?

0 Kudos
1 Solution

Accepted Solutions
mikemast
Enthusiast
Enthusiast
Jump to solution

Mine is checkin the ntp server first, Not sure without reading, but I had to add the options that I listed to my ntp.conf

noquery nopeer

restrict (ntp server IP) mask 255.255.255.255 nomodify notrap noquery

This was not the default settings.

Did you modify the ntp.conf file to have what i put in and then reload the ntpd service.?

Mike

View solution in original post

0 Kudos
13 Replies
espi3030
Expert
Expert
Jump to solution

you can do the following...

service ntpd restart

chkconfig --level 345 ntpd on

hwclock --systohc

Hope this helps!

0 Kudos
mikemast
Enthusiast
Enthusiast
Jump to solution

I have NTP setup on all my esx hosts to sync with a central internal NTP server. Then I have a nagios check to my ESX hosts to verify the NTP offset from the main NTP server, and notify me if the time is off. So I can resolve the issue before the time gets to far out of sync.

Mike

0 Kudos
dphalen
Contributor
Contributor
Jump to solution

These are step I perform during the seting up the timesync But does this does not have it run automatically.

0 Kudos
mikemast
Enthusiast
Enthusiast
Jump to solution

The deamon will run all the time using the chkconfig, you have to setup a ntp server in the ntp.conf file, for it to sync to a central NTP server.The clock will still drift a little, but the NTP daemon will bring it back within specs.

Mike

0 Kudos
dphalen
Contributor
Contributor
Jump to solution

This is the setup we have in our ntp.conf file

restrict 127.0.0.1

restrict default kod nomodify notrap

server 0.pool.ntp.org

server 1.pool.ntp.org

server 2.pool.ntp.org

driftfile /var/lib/ntp/drift

noquery

nopeer

When i run ntpq -p i get this

# ntpq -p

remote refid st t when poll reach delay offset jitter

==============================================================================

*LOCAL(0) LOCAL(0) 10 l 1 64 377 0.000 0.000 0.008

valkyrie.netser 0.0.0.0 16 u - 1024 0 0.000 0.000 4000.00

ns1.kirkforcong 0.0.0.0 16 u - 1024 0 0.000 0.000 4000.00

64.73.32.134 0.0.0.0 16 u - 1024 0 0.000 0.000 4000.00

0 Kudos
mikemast
Enthusiast
Enthusiast
Jump to solution

I just thought, did you open the firewall port on ESX for NTP, so it can communicate with these servers. ?

And the servers you have listed are internet NTP servers, does your organization have a firewall rule possibly blocking the esx host from contacting those servers.?

All of mine are ser to a internal NTP server, and that internal NTP server communicates to the internet. That way i only had to open one port for one server, and not for multiple servers

Mike

0 Kudos
mikemast
Enthusiast
Enthusiast
Jump to solution

ntpq -p

remote refid st t when poll reach delay offset jitter

==============================================================================

*ntpserver navobs1.wustl.e 2 u 27 64 377 0.436 386.837 27.457

LOCAL(0) LOCAL(0) 10 l 33 64 377 0.000 0.000 0.004

This shows my system is syncing with the "ntpserver" that is syncing with navobs1.wustl.e and currently mine is offset by 386 seconds....or 6.4 min. The system will adjust the clock slowly over the next few polling cycles.It does not jump the time all at one time, that will throw off time stamps in log files.

Our ntp conf:

restrict default kod nomodify notrap noquery nopeer

restrict 127.0.0.1

restrict (ntp server IP) mask 255.255.255.255 nomodify notrap noquery

server (ntp server ip)

server 127.127.1.0 # local clock

fudge 127.127.1.0 stratum 10

driftfile /var/lib/ntp/drift

broadcastdelay 0.008

authenticate yes

keys /etc/ntp/keys

0 Kudos
dphalen
Contributor
Contributor
Jump to solution

Thanks for the information. I am able to sync, my setting are OK , each time I restart the server in Synchronizes. I can see how far off the clock is and can manual update it to the correct time. Buy It does not do it automatically.

It seems that i will have to create a Cron job that runs "ntpdate -q 0.vmware.pool.ntp.org" sync the servers on a regular basis.

0 Kudos
mikemast
Enthusiast
Enthusiast
Jump to solution

Yes, if it is not syncing thruout the day and ntpd is set to run in run level3, and its not. Then a cron job would be the best best, other than troubleshooting why the daemon is not running.

0 Kudos
dphalen
Contributor
Contributor
Jump to solution

Hi Mike,

When i run ntpq -p it show as the first server the "LOCAL(0) LOCAL" with the * in front. it also shows our time servers but it seems to only be poling the "LOCAL" and not other time servers. the polling is working as we see it cointing. How do i get it to NOT poll the LOCAL but our Time servers. I changed our server names but the rest is the exact as it is on the command.

remote refid st t when poll reach delay offset jitter

==============================================================================

*LOCAL(0) LOCAL(0) 5 l 39 64 1 0.000 0.000 0.008

ourserver1 0.0.0.0 16 u - 64 0 0.000 0.000 4000.00

ourserver2 0.0.0.0 16 u - 64 0 0.000 0.000 4000.00

ourserver3 0.0.0.0 16 u - 64 0 0.000 0.000 4000.00

[

0 Kudos
mikemast
Enthusiast
Enthusiast
Jump to solution

Mine is checkin the ntp server first, Not sure without reading, but I had to add the options that I listed to my ntp.conf

noquery nopeer

restrict (ntp server IP) mask 255.255.255.255 nomodify notrap noquery

This was not the default settings.

Did you modify the ntp.conf file to have what i put in and then reload the ntpd service.?

Mike

0 Kudos
dphalen
Contributor
Contributor
Jump to solution

THANKS!!!

That line we needed to place as the first line in the conf file!

0 Kudos
harryc
Enthusiast
Enthusiast
Jump to solution

Thanks Mike - that's been a nagging problem for quite awhile, your conf file did the trick.

0 Kudos