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

Updated Apr 14, 2020

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?


  1. Before getting started, you need to enable the Secure Shell (sshd : OpenSSH Daemon) server on the Linux device via NI-MAX.
    1. Using a software to access your device in SSH (e.g. PuTTY), input the following command lines to install and configure the NTP Server:
opkg update
opkg install ntp ntp-tickadj
opkg install ntp ntp-tickadj ntp-utils
  1. 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.
  1. Now you need to setup the configuration file to the NTP server of your choice. In this example, you will use the server.
    1. To open the NTP Config file, run the following command
vi /etc/ntp.conf
  1. The ntp.conf file should open as VI editor.
  2. In order to modify the file, move the cursor with keyboard arrows. Add a line with server name.
  3. The file should look like this:
  1. Exit the edit mode of VI using the ESC key.
  2. Save and exit the NTP configuration file using :wq command
  1. 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