NTP configurations should be a mandatory setting for everyone, regardless of whether we are talking about VMware products or general infrastructure software. It is just as critical as having proper DNS configured and can cause a whole slew of issues if not configured or setup properly. A question that was raised internally a couple of days back was around automating NTP configurations on the VCSA (vCenter Server Appliance) which is normally performed through the VAMI web interface as seen in the screenshot below.
Instead of using the VAMI UI, the user was interested in automating it through the command-line and wondered if this was possible. This is definitely possible among other VAMI operations by leveraging the vpxd_servicecfg utility and there are a couple of options when configuring NTP on a VCSA 5.5 system.
The option that most of you will probably using is to configure a list of NTP servers (comma separated). To do so, you can run the following command (replace the NTP server with your own):
/usr/sbin/vpxd_servicecfg timesync write ntp '172.30.0.100' ''
This command should have a return code of 0, else there maybe an issue connecting to your time source from the VCSA. You can also confirm the operation was successful or query the current configuration by running the following command:
/usr/sbin/vpxd_servicecfg timesync read
If you wish to synchronize your time with the underlying ESXi host through VMware Tools, then you can run the following command:
/usr/sbin/vpxd_servicecfg timesync write tools '' ''
Finally, if you wish to disable time synchronization on the VCSA for whatever reason, you can do so by running this command:
/usr/sbin/vpxd_servicecfg timesync write none '' ''
Note: If the VCSA is joined to an Active Directory domain, then the time synchronization is provided by your Active Directory server and no additional configurations are required.
Once you have configured your NTP servers, you should can also manually force a sync to ensure the current date/time is correct by running the following command:
sntp -P no -r [NTP-SERVER]