Synchronize Linux Real Time Targets with Network Time Protocol (NTP) Server

Updated Jan 18, 2019

Reported In


  • CompactRIO Controller


  • NI CompactRIO

Operating System

  • NI Linux Real-Time

Issue Details

I have a Linux Real Time Device (e.g. CompactRIO) and I am experiencing time drift. I want to synchronize its clock with the Network Time Protocol Server. How should I proceed?


Before getting started, you need to enable the Secure Shell (sshd : OpenSSH Daemon) server on the Linux device via NI-MAX. Using a software to access your device in SSH (e.g. PuTTY), input the following command lines to install and configure NTP Server:

opkg update
opkg install ntp ntp-tickadj
opkg install ntp ntp-tickadj ntp-utils

The NTP server should be installed and running in the background. If the Linux device fails to update or install, make sure that the device is connected to network and that the failed links are valid webpages.

Now you need to setup the configuration file to the NTP server of your choice. In this example, I will be using the server.

To open the NTP Config file, run the following command

vi /etc/ntp.conf

The ntp.conf file should be opened as VI editor. In order to modify the file, move the cursor with keyboard arrows. Add a line with server name.

The file should look like this:

Exit the edit mode of VI using ESC key.
Save and exit the NTP configuration file using :wq key. 

Reboot the Linux Real Time target. Your target clock and time should now be synchronized to the server you specified in the configuration file.

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 mentionned in this NI forum post.


Not Helpful