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:
Once the IP is found:
Confirm the NTP Server responds (see troubleshooting section Check the UDP port)
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):
Restart the service
Run systemctl restart systemd-timesyncd
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:
Review configuration file
Run the command: cat /etc/systemd/timesyncd.conf
If the local NTP Server has been configured, the file should look like:
The use of FallbackNTP is taken from here https://developers.google.com/time/guides#systemd-timesyncd
Last updated