All Products
Search
Document Center

Elastic Compute Service:Configure the NTP service for a Windows instance

Last Updated:Sep 08, 2023

This topic describes how to enable and configure the Network Time Protocol (NTP) service for a Windows Elastic Compute Service (ECS) instance to ensure that the local time of the instance is precisely synchronized with the NTP server.

Background Information

By default, ECS instances in all Alibaba Cloud regions use UTC+8. You can configure or change the time zones of your instances based on your business requirements.

In this topic, an instance that runs Windows Server 2012 R2 Datacenter Edition 64-bit is used to demonstrate how to use the NTP service to synchronize the local time of Windows instances. You can also run commands to enable and configure the NTP service for Windows instances. For more information, see How to enable NTP for ECS instances with Windows operating system.

Enable the NTP service

By default, the Windows Time service is enabled on Windows Server operating systems. The Windows Time service follows the NTP specification to provides network clock synchronization for computers. The Windows Time service must be enabled for Windows instances to synchronize their local time as expected. Perform the following steps to check and enable the Windows Time service:

  1. Connect to a Windows instance.

    For more information, see Connect to a Windows instance by using a password or key.

  2. Right-click the image.png icon and select Run to open the Run dialog box.

  3. In the Run dialog box, enter services.msc and click OK.

  4. In the Services dialog box, find and double-click Windows Time.

  5. In the Windows Time Properties (Local Computer) dialog box, perform the following operations:

    1. Set Startup type to Automatic.

    2. Make sure that the value of Service status is Running. If the value of Service status is not Running, click Start.

    3. Click OK.

Change the default NTP server address

By default, Windows Server operating systems synchronize with the Microsoft NTP server (time.windows.com), but errors may occur. When you use a Windows ECS instance, you can replace the default Microsoft NTP server with an internal NTP server provided by Alibaba Cloud. Perform the following steps to change the default NTP server address:

  1. Connect to a Windows instance.

    For more information, see Connect to a Windows instance by using a password or key.

  2. In the notification area of the taskbar, click the date and time, and then click Change date and time settings.

  3. In the Date and Time dialog box, click the Internet Time tab and then click Change settings.

  4. In the Internet Time Settings dialog box, select Synchronize with an Internet time server, enter the address of an Alibaba Cloud internal NTP server, and then click Update Now. Then, click OK.

    For the addresses of Alibaba Cloud internal NTP servers, see Alibaba Cloud NTP servers.

  5. Click OK.

Modify the NTP synchronization interval

The default NTP synchronization interval is 5 minutes. You can modify the interval. Perform the following steps to modify the NTP synchronization interval:

  1. Connect to a Windows instance.

    For more information, see Connect to a Windows instance by using a password or key.

  2. Right-click the image.png icon and select Run to open the Run dialog box.

  3. In the Run dialog box, enter regedit and click OK.

  4. In the left-side navigation pane of the Registry Editor window, choose HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > W32Time > TimeProviders > NtpClient and double-click SpecialPollInterval in the right-side pane.

  5. In the Edit DWORD (32-bit) Value dialog box, set Base to Decimal and enter a value in the Value data field. The entered value is the new synchronization interval. Unit: seconds.

  6. Click OK.

  7. Restart the instance for the changes to take effect.

    You can restart the instance for the changes to take effect. If you cannot restart the instance due to business requirements, you can restart the Windows Time service for the changes to take effect. Perform the following steps:

    1. Right-click the image.png icon and select Run to open the Run dialog box.

    2. In the Run dialog box, enter services.msc and click OK.

    3. In the Services dialog box, find and double-click Windows Time.

    4. In the Windows Time Properties (Local Computer) dialog box, click Stop to stop the Windows Time service.

      Warning

      If the Windows Time service is stopped, the instance cannot synchronize its local time with a time source and your business that runs on the instance may be interrupted. We recommend that you perform the operation during off-peak hours.

    5. Wait until the service enters the Stopped state, and then click Start.

    6. Click OK.