Does HUAWEI CLOUD Provide the NTP Server and How Can I Install It?
Yes. HUAWEI CLOUD provides the NTP server, and it can only be installed and used on the ECSs that are purchased on the HUAWEI CLOUD management console.
You can install the NTP server provided on the management console or other NTP servers. The installation procedures are the same. This section describes how to install the NTP server provided on the management console on an ECS.
Background
If you use the NTP server provided by HUAWEI CLOUD, you also need to use the DNS server. Table 1 lists the NTP and DNS servers provided by HUAWEI CLOUD in different regions.
The clock server addresses used by HUAWEI CLOUD are as follows:
cn.pool.ntp.org
asia.pool.ntp.org
pool.ntp.org
hk.pool.ntp.org
| Region | NTP Server IP Address | DNS Server IP Address |
|---|---|---|
| CN North | ntp.myhuaweicloud.com | 100.125.1.250 100.125.21.250 |
| CN East | ntp.myhuaweicloud.com | 100.125.17.29 100.125.135.29 |
| CN South | ntp.myhuaweicloud.com | 100.125.1.250 100.125.136.29 |
| AP-Hong-Kong | ntp.myhuaweicloud.com | 100.125.1.250 100.125.3.250 |
| AP-Bangkok | ntp.myhuaweicloud.com | 100.125.1.250 |
| AP-Singapore | ntp.myhuaweicloud.com | 100.125.1.250 100.125.128.250 |
| AF-Johannesburg | ntp.myhuaweicloud.com | 100.125.1.250 |
| LA-Santiago | ntp.myhuaweicloud.com | 100.125.1.250 100.125.0.250 |
| LA-Sao Paulo1 | ntp.myhuaweicloud.com | 100.125.1.22 |
| LA-Mexico City1 | ntp.myhuaweicloud.com | 100.125.1.22 |
Linux
The following section uses CentOS 7.3 as an example.
- Check whether the IP address of the DNS server is correct on the ECS.
- (Optional) Configure the DNS server for the ECS.
- Log in to the Linux ECS.
- Run the following command to edit the resolv.conf configuration file:
vi /etc/resolv.conf
- Add the following statement to configure the DNS server:
nameserver IP address of the DNS server
An example is provided as follows:
Take the CN North region as an example. Add the following statement:
nameserver 100.125.1.250
- Configure the NTP server for the ECS.
- Log in to the Linux ECS.
- Run the following commands to stop the chronyd process:
systemctl disable chronyd
- Run the following command to edit the ntp.conf configuration file:
vim /etc/ntp.conf
- Add the following statement to configure the NTP server:
server Domain name of the NTP server
An example is provided as follows:
server ntp.myhuaweicloud.com
- Run the following command to start the NTP service upon system restart:
systemctl restart ntpd
For SUSE:
service ntp restart
Run the required command based on the OS running on the ECS.
If "Failed to restart ntpd.service: Unit not found." is displayed, run the yum -y install ntp command.
- Run the following command to check whether the time on the NTP server has been synchronized with that on the upper-layer NTP server:
If "*" is displayed, the time has been synchronized.
It takes several minutes to perform NTP time synchronization for the first time.
- Set the automatic startup of the NTP service.
chkconfig ntpd on
For SUSE:
chkconfig ntp on
Windows
Take an ECS running Windows Server 2012 as an example.
- Log in to the ECS as user Administrator.
- Enable the local area connection.
- In the lower right corner of the taskbar, right-click the network connection icon.
- Click Open Network and Sharing Center. Figure 1 Open Network and Sharing Center
- In the navigation pane on the left, click Change adapter settings.
- Configure the DNS server for the ECS.
- Double-click network connections.
- Click Properties in the lower left corner. Figure 2 Local area connection
- Select Internet Protocol Version 4 (TCP/IPv4) and click Properties. Figure 3 Selecting a protocol type
- Select Use the following DNS server addresses and set the IP addresses of the DNS servers as prompted. Figure 4 Setting the IP addresses of the DNS servers
- Configure the NTP server for the ECS.
- Start the Run dialog box. Enter regedit and click OK.
- Modify the registry entries.
- In HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > W32Time > TimeProviders > NtpClient, set the value of Enabled to 1, indicating that the NTP client is used.
- In HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > W32Time > TimeProviders > NtpServer, set the value of Enabled to 0, indicating that the NTP server is stopped.
- Choose HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > W32Time > Parameters file and set the NtpServer data. For example, set its data to ntp.myhuaweicloud.com. Set the data of TYPE to NTP.
- In HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ W32Time \ TimeProviders \ NtpClient, set the value of SpecialPollInterval to 60 and that of Base to Decimal, indicating the clock synchronization cycle is 60s.
- In HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ W32Time \ config, set the values of MaxPosPhaseCorrection and MaxNegPhaseCorrection to ffffffff and that of Base to Hexadecimal.
- Open the Run dialog box, enter services.msc, and click OK. The Services window is displayed.
- View the service named Windows Time and set the Start Type to Automatic to synchronize time from the NTP server.
- Open the Run dialog box and run the following commands in sequence to restart the Windows Time service:
net stop w32time
net start w32time
- Manually change the time on the client to make it different from that on the NTP server. One minute later, check whether the time on the client is the same as that on the NTP server. If yes, the time is synchronized.
Follow-up Procedure
After the ECS is restarted, the DNS configuration is reset, and its IP address is changed to the IP address of the DNS server in the VPC subnet. Therefore, before restarting the ECS, check whether the DNS configuration in the VPC subnet is the same as the target DNS configuration. If they are different, modify the DNS configuration in the VPC subnet. For details, see Modifying a Subnet.
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.