Avatar of Ralph Scharping
Ralph ScharpingFlag for Germany

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
VirtualizationInstallationVMware

Avatar of undefined
Last Comment
Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Avatar of Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Flag of United Kingdom of Great Britain and Northern Ireland image

We usually do this...

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!
Avatar of Ralph Scharping

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
ASKER CERTIFIED SOLUTION
Avatar of Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
You can also use the below VMware PowerCLI command to do it automatically for you:

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

Open in new window


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
}

Open in new window

Avatar of Ralph Scharping

ASKER

Thank you so much!
no problems, I hope all better and running ?
VMware
VMware

VMware, a software company founded in 1998, was one of the first commercially successful companies to offer x86 virtualization. The storage company EMC purchased VMware in 1994. Dell Technologies acquired EMC in 2016. VMware’s parent company is now Dell Technologies. VMware has many software products that run on desktops, Microsoft Windows, Linux, and macOS, which allows the virtualizing of the x86 architecture. Its enterprise software hypervisor for servers, VMware vSphere Hypervisor (ESXi), is a bare-metal hypervisor that runs directly on the server hardware and does not require an additional underlying operating system.

39K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo