Skip to Content
Technical Articles

Virtual Machine Clock Synchronization Using NTP

If your application requires your SAP Cloud Platform virtual machine clock to show the correct time, there is a way to achieve that thanks to a basic set of commands. The goal is to synchronize the clock with the network time servers using the Network Time Protocol (NTP).

Let’s assume you’ve already established an SSH connection with your virtual machine. Just follow these steps:

1. To immediately synchronize the clock, execute the following command:

ntpdate -u <NTP server IP>

Here is the list with the IPs of the three currently available regions in the Neo environment where you can run SAP Cloud Platform virtual machines:

Europe (Rot) – EU1 US East (Sterling) – US3 Australia (Sydney) – AP1

10.78.68.28

10.78.68.29

10.78.68.44

10.78.68.45

147.204.72.22

147.204.72.23

10.174.116.20

10.174.116.21

10.174.116.22

For example, if my virtual machine is running on the US East (Sterling) SAP Cloud Platform region, I have two options. I can run one of the following two commands:

ntpdate -u 147.204.72.22

or

ntpdate -u 147.204.72.23

2. Check whether the clock is synchronized by executing:

date


Now that the time is updated, you can make sure it stays in sync in the long run by completing a few more steps.

1. Check the current NTP server configurations. Execute:

cat /etc/ntp.conf

You need to update the server configurations listed there by adding the server IPs of the SAP Cloud Platform region where your virtual machine is running.

2. Edit the ntp.conf file and add all IPs for the corresponding region:

For example, I’ve used the vi editor to add the Europe (Rot) server IPs, because my virtual machine is running in the Europe (Rot) region:

3. Check the state of the daemon by executing:

systemctl status ntpd

Then:

  • If the daemon is disabled, run the following commands:

   systemctl enable ntpd

   systemctl start ntpd

  • If the daemon is enabled but currently stopped, run:

   systemctl start ntpd

In general, it shouldn’t take long for the configuration changes to be applied.

If you have any feedback, go ahead and share it in the comments section below.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.