Using a local Network Time server (NTP)

General Concepts

How does it works: An NTP server receives time data from a reliable source (such as atomic clocks, GPS satellites, or other higher-level NTP servers) and distributes this time information to clients on a network. The protocol adjusts the clocks on the client devices to account for network delays and other factors.

Importance: NTP servers are critical in data acquisition systems because they ensure accurate time synchronization across all networked devices, enabling reliable and coherent data collection and analysis. This precision is essential for maintaining data integrity, coordinating distributed systems, and meeting regulatory requirements.

Implementation

We can find the following 2 scenarios:

With Internet Access

In this case, an NTP Server on the internet can be used.

Ardexa Linux uses by default systemctl-timesyncd for clock synchronization. So, as long as the plant has an internet connection, the synchronization will be automatically done and no further steps are required.

See the section "Troubleshooting" to check the internet access if needed.

Without Internet Access

In this case, a local NTP Server will be required.

If there is no internet access nor a local NTP Server available, escalate the issue.

To configure the local server, its IP Address will be needed. If it cannot be obtained directly, scan the local network for port 123/udp(your IP subnet will most likely be different) with the following command:

nmap -sU -p 123 192.168.1.0/24

Once the IP is found:

  1. Confirm the NTP Server responds (see troubleshooting section Check the UDP port)

  2. Configure the NTP Server IP

The NTP Configuration is in the file /etc/systemd/timesyncd.conf

To edit it, use the following command (with the appropriate IP):

printf '[Time]\nNTP=\nFallbackNTP=192.168.1.1' > /etc/systemd/timesyncd.conf
  1. Restart the service

Run systemctl restart systemd-timesyncd

  1. Review the status (see Troubleshooting section Check clock synchronization status)

If the time zone is changed on the edge device, make sure to call "Refresh metadata" on the device.

Troubleshooting

  • Check internet access

Go to DEVICE > NETWORK SETTINGS > ACCESS and click on Check Access

If the services return Green, internet access is enable.

  • Check the UDP port

Run (with the required IP) nmap -sU -p 123 --script ntp-info 192.168.1.1

Routers are most likely to have the port open and active.

  • Check clock synchronization status

Run the command: timedatectl status

If the NTP service is active and System clock synchronized indicate yes, then the NTP Server is running properly.

The command date can also be run to check the current date and time.

Finally, the following commands can also be used to obtain more information:

systemctl status systemd-timesyncd
timedatectl timesync-status
timedatectl show-timesync
  • Review configuration file

Run the command: cat /etc/systemd/timesyncd.conf

If the local NTP Server has been configured, the file should look like:

[Time]
NTP=
FallbackNTP=192.168.1.1

The use of FallbackNTP is taken from here https://developers.google.com/time/guides#systemd-timesyncd

Last updated