To use NTP on a Linux Real-Time target, you will need to install and configure the NTP software on the target using a secure shell (SSH) session to the target. These instructions should apply to all Linux Real-Time targets, but if you are using a TSN-enabled target, such as a cRIO-904x or cRIO-905x, please read the note in the Additional Information section below.
- Make sure that the Linux Real-Time target is connected to the internet. A simple way to do this is to connect both the host PC and the target to a network switch that is connected to the internet.
- Open an SSH session to the Linux Real-Time target using a terminal program, such as PuTTY.
- Enter the username and password when prompted to log into the target.
- Once the SSH session is open to the Linux Real-Time target, enter the following command lines to install the NTP software:
-
The NTP software should now be installed and running in the background. If the above commands fails to update or install, make sure that the device is connected to the internet. If you are using an offline target, instead, navigate to download.ni.com/#ni-linux-rt/feeds/<base image version>/x64/main/core2-64/ with an online host PC and download the following IPKs:
- ntp-lic
- libperl5
- ntp-tickadj
- ntp-utils
- ntp-lic
- ntp
- perl
- Once you have downloaded the IPKs, transfer them into the target, navigate to the directory where you placed them, and run the following command lines:
For example, this is how it would look for a NI Linux Real-time base system image 2020.6

- You now need to setup the NTP configuration file to point to the NTP server of your choice. You can use an NTP server on your local network or use a publicly available NTP server. This example will show how to connect to the time.natinst.gov server.
-
- Open a new SSH session to the target if your session is no longer open.
- Run the following command to open the NTP configuration file:
- The ntp.conf file should now be open in the Linux vi text editor.
- Press i to enter edit mode.
- Move the cursor with keyboard arrows. Add a line with the server name in the format server <server URL or IP address>. You can add multiple servers in this file by placing each on their own line. If you need additional help configuring /etc/ntp.conf, there are many guides available on the internet.
- The file should now look like this:

- Exit the edit mode of the file by pressing the ESC key.
- Save and exit the NTP configuration file by entering:
- Reboot the Linux Real-Time target and the time server. Your target should start synchronizing to the server you specified in the configuration file. Please be aware that NTP will adjust the time slowly, so it may take some time for the skew between the target system time and the NTP server time to be minimized.
- You can test the connection to the NTP server by running the following command to query the server:
Additional Information
- This solution should work on Linux Real Time Targets with Real Time module 14.0 or newer. For this solution to work on Real Time module 13.1 and older, you need to configure third party installation sources as mentioned in Installing and Configuring NTP on NI Linux Real-Time Devices community post.
- The configuration file works on the OS level, thus the NTP server setup will be included in the RT image, should it be copied with the Replication and Deployment (RAD) Utility .
-
To use NTP with TSN-enabled targets, such as the cRIO-904x and cRIO-905x, the Linux OS time must be desynchronized from NI Time Sync. On these targets, the NI Time Sync service (nitsmd) controls the Linux OS clock by default through the phc2sysEnable setting. When enabled, standard NTP utilities such as ntpq -p and ntpdate -bu may indicate successful synchronization, but the Linux system time may not update because NI Time Sync overwrites OS clock changes.
Verify the current configuration:
cat /var/lib/ni-timesync/tsm.json | grep phc2sysEnable
If phc2sysEnable is set to true, disable Linux OS clock synchronization using:
/usr/lib/x86_64-linux-gnu/ni-timesync/configgen --tsmJsonFile
/var/lib/ni-timesync/tsm.json --setTKPluginConfig phc2sysEnable false
Restart the NI Time Sync service or reboot the target after applying the change.
Symptoms that may indicate this condition include:
ntpq -p displays a valid NTP server.ntpdate -bu calculates a time offset.- The
date command does not reflect the expected time update.
If these symptoms occur, verify the phc2sysEnable setting before continuing NTP troubleshooting.