Ralph Scharping
asked on
NTP in VMware
Hi, I keep having issues with time in VMware environments.
Usually, I work in environments with a single standalone ESXi and about 5-10 VMs. I can't think of a single Installation where configuring an NTP-server in ESXi management console actually worked. I also set the time manually, and that is then the time the system continues to work with.
Usually I can activate time synchronisation in VM properties to sync time from the host to the VM. This time, running Fujitsu custom image 6.7 update 3, the checkbox is klickable, but the caption is grey and it does not do anything. Instead, the VMs are 3h ahead of the host and I can't change their time settings.
Can somebody explain to me how this is done in VMware? I am getting increasingly irritated and convinced that I am missing something.
Thanks, Ralph
Usually, I work in environments with a single standalone ESXi and about 5-10 VMs. I can't think of a single Installation where configuring an NTP-server in ESXi management console actually worked. I also set the time manually, and that is then the time the system continues to work with.
Usually I can activate time synchronisation in VM properties to sync time from the host to the VM. This time, running Fujitsu custom image 6.7 update 3, the checkbox is klickable, but the caption is grey and it does not do anything. Instead, the VMs are 3h ahead of the host and I can't change their time settings.
Can somebody explain to me how this is done in VMware? I am getting increasingly irritated and convinced that I am missing something.
Thanks, Ralph
ASKER
Hi Andrew,
thank you, but I am nowhere nearer now.
I have a Windows VM, a DC, that refuses me to set time manually. I have tried 1001 tutorials on how to configure NTP. It insists on being 1:55h ahead of the world.
It is not in sync with the host nor with anything else here. Windows NTP queries are reportedly successful, I can see the traffic pass in the firewall, but nothing happens.
That is a Windows issue - I am aware you are the VMware expert.
Can you tell me why the Option to sync all VMs time with the host is grey? Can you tell me what to "tweak" in the VMX file? Can you help me to set the f%&# clock?
Thanks,
Ralph
thank you, but I am nowhere nearer now.
I have a Windows VM, a DC, that refuses me to set time manually. I have tried 1001 tutorials on how to configure NTP. It insists on being 1:55h ahead of the world.
It is not in sync with the host nor with anything else here. Windows NTP queries are reportedly successful, I can see the traffic pass in the firewall, but nothing happens.
That is a Windows issue - I am aware you are the VMware expert.
Can you tell me why the Option to sync all VMs time with the host is grey? Can you tell me what to "tweak" in the VMX file? Can you help me to set the f%&# clock?
Thanks,
Ralph
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can also use the below VMware PowerCLI command to do it automatically for you:
Check the value:
This is how to make the bulk changes:
Check the value:
Get-VMHost | Select-Object Name, @{Name = "NTPServer"; Expression = { $_ | Get-VMHostNtpServer } }, @{Name = "NTPRunning"; Expression = { ($_ | Get-VMHostService | Where-Object { $_.key -eq "ntpd" }).Running } } | Sort-Object -Property "NTPRunning", "NTPServer" | ft -AutoSize
This is how to make the bulk changes:
$ntp1 = "YourPDCEmulatorrole.domain.com"
$ntp2 = "NTPPool.org"
$oldntp = "OldServer"
$oldntp2 = "OldServer"
Add-PSSnapin VMware.VimAutomation.Core
connect-viserver -server vcentername -credential (Get-Credential)
$vmhosts = Get-VMHost
foreach ($element in $vmhosts) {
Remove-VMHostNtpServer -NtpServer $oldntp -VMHost $element
Remove-VMHostNtpServer -NtpServer $oldntp2 -VMHost $element
Add-VmHostNtpServer -NtpServer $ntp1 -VMHost $element
Add-VmHostNtpServer -NtpServer $ntp2 -vmhost $element
$ntpd = Get-Vmhostservice -VMHost $element | where { $_.key -eq 'ntpd' }
Restart-VMHostService $ntpd -Confirm:$false
}
ASKER
Thank you so much!
no problems, I hope all better and running ?
1. ESXi host Sync with Local Time Source or NTP GPS (if none available use Internet)
2. Sync ALL Windows DCs (PDC emulator) with same time source as 1.
3. All Windows VMs will sync with 2.
4. Sync all Linux VMs with time source in 1.
Make sure you tweak the VMX files to stop syncing with host (oh they will unless you disable!)
P.S. Time Sync in ESXi is foo bar, it randomly stops, and is not very reliable!