Setting the Time and Timezone Using NTP Service

Use the timedatectl command on the Host VM to perform following operations to sync the time between the host and the docker:

  • Displaying the Current Date and Time: timedatectl

  • Changing the Current Time: timedatectl set-time HH:MM:SS

  • Changing the Current Date: timedatectl set-time YYYY-MM-DD

  • Listing the Time Zone: timedatectl list-timezones

  • Changing the Time Zone: timedatectl set-timezone time_zone

  • Enabling NTP Service: timedatectl set-ntp yes

Configuring NTP Server

To configure the NTP server on Cisco IoT FND and TPS servers, follow the steps given.

Procedure


Step 1

Run the command to edit the chrony.conf file.

Example:

[root@iot-fnd ~]# nano /etc/chrony.conf
This will display the current chrony.conf file details.

Step 2

Enter the IP address of the server that you want to use as the NTP server.

Example:

server 209.165.200.225

Step 3

Save the changes by selecting Y and exit.

Step 4

Restart the chrony service using the command given in the example.

Example:

[root@iot-fnd ~]# systemctl restart chronyd

Step 5

To view the NTP server you configured, use the command given in the example.

Example:

[root@iot-fnd ~]# chronyc sources
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* 209.165.200.225                 2  10   377   915    +17us[  +19us] +/-   21ms

The newly configured NTP server details are displayed.