Stuarty1874
Contributor
Contributor

Comfirming NTP Configuration

Jump to solution

Folks, after configuring NTP on my ESX 3.0.1 host I'd like to confirm if the timesync is working.

Is there a command that I can issue in the Service Console to confirm if the host is sync'ing with the external time source.

0 Kudos
1 Solution

Accepted Solutions
jlanders
VMware Employee
VMware Employee

On the service console, you can use either 'ntpq -p' or 'ntpdc -c peers' to check status without shutting down the NTP daemon. For example 'ntpq -p' might show something like (sorry about the formatting):

remote refid st t when poll reach delay offset jitter
==============================================================================
- xxxxxxxxxxxxxx xxx.xxx.xxx.xxx 2 u 242 1024 377 0.475 16.155 20.651
- xxxxxxxxxxxxxx xxx.xxx.xxx.xxx 2 u 11 1024 377 0.479 18.142 36.815
+ xxxxxxxxxxxxxx xxx.xxx.xxx.xxx 2 u 104 1024 377 0.556 1.923 26.553
+ xxxxxxxxxxxxxx xxx.xxx.xxx.xxx 2 u 230 1024 377 0.499 9.698 20.618
- xxxxxxxxxxxxxx xxx.xxx.xxx.xxx 3 u 137 1024 377 0.483 -24.643 11.705
- xxxxxxxxxxxxxx xxx.xxx.xxx.xxx 3 u 205 1024 377 0.416 -35.343 49.053
+ xxxxxxxxxxxxxx xxx.xxx.xxx.xxx 3 u 214 1024 377 0.305 2.938 31.240
- xxxxxxxxxxxxxx xxx.xxx.xxx.xxx 3 u 197 1024 377 0.338 -13.874 16.208
* xxxxxxxxxxxxxx xxx.xxx.xxx.xxx 1 u 199 1024 377 2.760 -0.005 0.157

Briefly, the first column is the tally code: '*' is the best server, '+' are providing good time data, '-' are providing time, but aren't being used. The 'remote' column is the hostname/address of the NTP server. The 'refid' field is where the remote server is getting its time (think of a tree of NTP servers). The 'st' column is the stratum number (where it fits in the tree). The 'when' column is when the last NTP packet was received from the remote server. The 'poll' column is the number of seconds between queries to the remote server. The 'offset' is the time difference between your ESX system and the remote NTP server, in milliseconds.More detailed information about ntpq is available at:

Generally, if the 'reach' field shows 377 and the 'offset' field is on the order of tens of milliseconds, NTP is working fine.

Joe

View solution in original post

0 Kudos
9 Replies

Hi stuarty,

Try "ntpdate -q"

regards

santhosh

0 Kudos
sonofploppy
Enthusiast
Enthusiast

Query only parameter for ntpdate is -q

0 Kudos
Stuarty1874
Contributor
Contributor

When I issue ntpdate -q I get the following error.... ntpdate[7319]: no servers can be used, exiting

I have configured both my NTP.CONF and step-ticker files and opened Port 123 UDP Outgoing. The service is also started.

Incidently... when I stop and start the ntpd service, its stops, appears to sync, and restarts.

0 Kudos
ctfoster
Expert
Expert

Its working.

You've got the NTP daemon running on your ESX server so when you run 'ntpdate' it fails since it uses the same port (123/UDP).

You also need to supply a server name to 'ntpdate' as a command line parameter, for instance, 'ntpdate fr.ntp.pool.org' however, you'll probably see the 'NTP socket in use, exiting' since 'ntpd' is still running. If you want to run 'ntpdate', you should shutdown 'ntpd' first.

Once 'ntpd' has stopped, the command 'ntpdate fr.ntp.pool.org' should work. If it doesn't work, it generally means that something is blocking access to your external NTP servers.

If you found this or any other post helpful please consider the use of the Helpfull/Correct buttons to award points

0 Kudos
jlanders
VMware Employee
VMware Employee

On the service console, you can use either 'ntpq -p' or 'ntpdc -c peers' to check status without shutting down the NTP daemon. For example 'ntpq -p' might show something like (sorry about the formatting):

remote refid st t when poll reach delay offset jitter
==============================================================================
- xxxxxxxxxxxxxx xxx.xxx.xxx.xxx 2 u 242 1024 377 0.475 16.155 20.651
- xxxxxxxxxxxxxx xxx.xxx.xxx.xxx 2 u 11 1024 377 0.479 18.142 36.815
+ xxxxxxxxxxxxxx xxx.xxx.xxx.xxx 2 u 104 1024 377 0.556 1.923 26.553
+ xxxxxxxxxxxxxx xxx.xxx.xxx.xxx 2 u 230 1024 377 0.499 9.698 20.618
- xxxxxxxxxxxxxx xxx.xxx.xxx.xxx 3 u 137 1024 377 0.483 -24.643 11.705
- xxxxxxxxxxxxxx xxx.xxx.xxx.xxx 3 u 205 1024 377 0.416 -35.343 49.053
+ xxxxxxxxxxxxxx xxx.xxx.xxx.xxx 3 u 214 1024 377 0.305 2.938 31.240
- xxxxxxxxxxxxxx xxx.xxx.xxx.xxx 3 u 197 1024 377 0.338 -13.874 16.208
* xxxxxxxxxxxxxx xxx.xxx.xxx.xxx 1 u 199 1024 377 2.760 -0.005 0.157

Briefly, the first column is the tally code: '*' is the best server, '+' are providing good time data, '-' are providing time, but aren't being used. The 'remote' column is the hostname/address of the NTP server. The 'refid' field is where the remote server is getting its time (think of a tree of NTP servers). The 'st' column is the stratum number (where it fits in the tree). The 'when' column is when the last NTP packet was received from the remote server. The 'poll' column is the number of seconds between queries to the remote server. The 'offset' is the time difference between your ESX system and the remote NTP server, in milliseconds.More detailed information about ntpq is available at:

Generally, if the 'reach' field shows 377 and the 'offset' field is on the order of tens of milliseconds, NTP is working fine.

Joe

View solution in original post

0 Kudos
Sarek
Hot Shot
Hot Shot

There are three files that needs to change

/etc/ntp.conf

/etc/hosts

/etc/ntp/steptickes

I saw you have changed 2 of them but didn't saw a change in hosts file.

If you have a firewall between ESX and the external ntp you should open the ports

Also you could try to use a internal ntp sever (like the first installed Windows Domain controller (pdc emulator) in your network. If this works the error is between the ESX and the connection outside

If you find this information useful, please award points for "correct" or "helpful".
0 Kudos
Gene_H
Enthusiast
Enthusiast

Installing and Configuring NTP on VMware ESX Server

Don't forget to restart the NTP service: service ntpd restart

Don't forget to ensble the NTP daemon to autostart when the server is rebooted: chkconfig --level 345 ntpd on

Don't forget to open the firewall ports: esxcfg-firewall --enableService ntpClient

Note: The vmtools time sync between the vmguest OS and the host only works when the guest time is "behind" the host time. The vmtools time sync will not "set back" a guest vmguest OS.

Gene

0 Kudos
Schorschi
Expert
Expert

stop NTP daemon, when you run ntpdate. As I recall ntpdate can not function if ntpd is active.

0 Kudos
kamphor
Contributor
Contributor

You can use ntpdate -u to force syncing your clock without having to stop the ntpd process.

If you do not want to use ntpd as it's a server, then you can just add the following line in /etc/crontab:

*/1 * * * * root ntpdate -u pool.ntp.org

this will update the esx host system to pool.ntp.org (random time servers) every minute.

then do a: "chkconfig ntpd off" to turn off the ntpd service.

-Kamphor