Usually you will set the NTP time sources for vCenter 7 during a deployment. But if you ever need to change it after deployment, things have got much easier than the early days of using the vCenter Server Appliance.
Much like SSH we have a few different methods to update NTP. We can do it via the VAMI or via the Shell. I’ve listed these two methods below.
Changing NTP via the browser / VAMI interface
This method involves changing / updating NTP via the VAMI interface. You can access this interface over port 5480 in a web browser. (https://vcenter_fqdn_or_ip:5480/)
Alternatively you can get to the VAMI interface while logged into the vCenter vSphere Client. Navigate to Menu and select Administration
In the left pane click on System Configuration under Deployment. Then click on your vCenter node you want to configure NTP on.
A new browser window will open to the vCenter VAMI login page on port 5480. You will need to login as root.
Navigate to Time in the left pane. Select Edit for Time Synchronization.
You have the option to change the Mode to Host (Synchronize time with the ESXi host) or NTP. Select NTP.
Before clicking SAVE you now have the option to input the NTP time sources. It’s generally recommended to have at least three time sources set (Having only two makes it hard to determine which one is accurate). Each time source should be separated with a comma.
If successful each time source should have a green tick next to it once saved.
Changing NTP via the vCenter Shell
For the slightly more adventurous, in this method we need to open an SSH session to vCenter or login via the Console. I’ve written a post on how to enable SSH on vCenter if it’s currently disabled here.
By default we log into the VMware shell. We can enter the BASH shell by typing in shell but to configure NTP it’s not necessary. We can type ntp followed by the ‘TAB‘ key to return a list of three ntp commands.
Typing in ntp.get will list any NTP servers defined. In this case none are returned.
Using ntp.set we can define our ntp servers. We define all our ntp servers we wish to use on one line, comma separated, with no spaces. Then use ntp.get to verify we have correctly defined our servers.
Command> ntp.set --servers 0.au.pool.ntp.org,1.au.pool.ntp.org,2.au.pool.ntp.org
Servers: 1.au.pool.ntp.org 0.au.pool.ntp.org 2.au.pool.ntp.org
Finally we use timesync.get and timesync.set to list the time sync mode and switch to NTP mode.
Command> timesync.set --mode NTP
If we have correctly set our time servers, once we set our mode to NTP the time sources should take effect immediately.