VMware Cloud Community
anukalp
Contributor
Contributor
Jump to solution

How To Setup NTP Between Virtual Machines Without Using Vsphere Client

I have a group of 8 Virtual ESXi 5.5 Hosts without Internet Connections. There are virtual machines on each of those 8 Virtual Hosts.

I made one of those virtual ESXi 5.5 host an NTP Server by editing the /etc/ntp.conf file with below configuration and

started the ntpd daemon. It started taking time from its local clock, below is the ntpq -p output

server ip 10.108.190.14

client ip 10.108.190.15

Server /etc/ntp.conf

>> driftfile /var/lib/ntp/drift

>> server 127.127.1.0 maxpoll 4

>> fudge 127.127.1.0 stratum 10

| ntpq -p

|   remote   refid  st t when poll reach   delay   offset jitter

| ==============================================================
| *LOCAL(0)  .LOCL. 10 l    2   64  377    0.000    0.000 0.001

Then I edited the /etc/ntp.conf file on clients with below configuration but the client wouldn't sync with the server. It

wouldn't get response back from the server. Below is the ntpq -p output

Client /etc/ntp.conf

>> driftfile /var/lib/ntp/drift

>> server 10.108.190.14 iburst

| ntpq -p

|      remote    refid    st t when poll reach delay   offset jitter

| ==================================================================
| 10.108.190.14 .INIT. 16 u  

Now when I configure NPT Client/Server on Virtual Machines through the Time Configuration Option Under Configuration Option

in Vsphere Client everything works fine and the client and server sync with each other. I checked the /etc/ntp.conf file on both the client

and server and it has a couple of restrict 127.0.0.1 and restrict default kod nomodify etc lines added to it.

So why does NPT Client/Server feature when enabled through Vsphere Client works fine but it doesn't work when configured manually

in the Virtual Hosts directly.

I had connected to a vCenter Server Appliance through the VSphere Client and enabled the NPT Time Sync.

I really need to know how to setup NTP Client/Server without using the Vsphere Client so that I could automate the

task by writing a python script which would connect to each virtual host and setup NTP Client/Server.

Any help in this issue deeply appreciated!

Thank you!

1 Solution

Accepted Solutions
SatyS
Hot Shot
Hot Shot
Jump to solution

you can configure ntp server without using viclient.

Just have a look @ http://kb.vmware.com/selfservice/documentLinkInt.do?micrositeID=&popup=true&languageId=&externalID=1...

Hope this helps

-SatyS

If you find this useful,please mark the answer as correct/helpful

Regards,
SatyS
http://myvirtuallearning.wordpress.com/

View solution in original post

0 Kudos
5 Replies
SatyS
Hot Shot
Hot Shot
Jump to solution

you can configure ntp server without using viclient.

Just have a look @ http://kb.vmware.com/selfservice/documentLinkInt.do?micrositeID=&popup=true&languageId=&externalID=1...

Hope this helps

-SatyS

If you find this useful,please mark the answer as correct/helpful

Regards,
SatyS
http://myvirtuallearning.wordpress.com/

0 Kudos
anukalp
Contributor
Contributor
Jump to solution

Thanks for your reply!

I have tried that method but I the virtual hosts don't have connection to the Internet, so one of the virtual machines has been setup

to be an NTP server. When I configure this setting directly in to the virtual machines it doesn't work but the same settings when set

through Vsphere client GUI work perfectly fine. The VM start syncing with the Local NTP server, which is one of the VMs.

I need to know how to do this without using Vsphere client GUI so that I could automate the task using a python script.

What settings does the vSphere Client GUI/vCenter are changing which I am not aware of?

Thanks a bunch for your reply!!!

0 Kudos
admin
Immortal
Immortal
Jump to solution

Have you checked that the host firewall ports are open on the host you are using as an NTP server? By default the server will block incoming port 123 UDP traffic.

ScreamingSilenc
Jump to solution

Have you tried using vMA to configure NTP on your ESXi host.

vicfg-ntp --server esx01.virtualclouds.info --add nl.pool.ntp.org

vicfg-ntp --server esx01.virtualclouds.info --list

Check below KB it might help

VMware KB: Troubleshooting NTP on ESX and ESXi 4.x / 5.x

Please consider marking this answer "correct" or "helpful" if you found it useful.
0 Kudos
anukalp
Contributor
Contributor
Jump to solution

Yeah..Thanks!

I had to use below command to open up the ports first

esxcli network firewall ruleset set --enabled True --ruleset-id ntpClient

It all works now...Thank you very much everyone...

I overlooked the firewall the first time as this version of ESXi doesn't have esx-cfg command but

the newer esxcli commands.

0 Kudos