Network Time Protocol Daemon

The Network Time Protocol Daemon (ntpd) may be used to set the time on Per Vices SDRs, using the Network Time Protocol (NTP). Both the linux software time and the hardware clock (that keeps time while the SDR is switched off) are set by ntpd. This may be useful for applications that have time based triggers or for synchronizing multiple SDRs.

Check that ntpd is installed on your SDR

To determine if your SDR has ntpd installed, ssh into the the SDR and run the command:

systemctl status ntpd

if ntpd.service is not found, please email support@pervices.com so we can discuss options for getting ntpd installed on your SDR.

NTP server

Ensure that you are running an NTP server on your host machine. Note that ntpd operates as both a time server and a time reciever, as such you may use ntpd on your host machine as the server that your SDR will connect to. If you are using ntpd as the NTP server on your host machine, you can check that it is working using the instructions below for checking that ntpd is working on your SDR.

Take note of the ip address that your host machine uses as the SDR management port. You will need to know that IP address to configure ntpd. If you set up your ip addresses in the default Per Vices configuration, that IP address will be 192.168.10.4.

Configure ntpd

The configuration file for ntpd is /etc/ntp.conf. You can use vim to edit this file, but you need to

  1. ssh into your SDR
  2. Use root access by issuing the command:

    sudo -i

    and entering your password.

  3. Edit the conifguration file with vim by issuing the command:

    vim /etc/ntp.conf

    Note that in order to save your changes you must have logged into root using a sudo command. You cannot simply invoke sudo in the same command as vim.

    The default configuration file shows includes the line:

    server 127.127.1.0

    This is the only line that you need to change to get ntpd working. The default file tells ntpd to use the local system clock as a reference. Change the line to have the IP address of your NTP server and the iburst option, so that synchronization occurs quickly when the SDR turns on. For example:

    server 192.168.10.4 iburst

  4. Ensure that ntpd is enabled by issuing the command:

    systemctl enable ntpd

    Note that default systemd service starts ntpd with the “panic-gate” disabled, so that the correct time is set even if the SDR’s hardware clock is more than 1000s different than the NTP server’s time.

Check that ntpd is working

Once, you have confifured ntpd, check that it is working:

  1. Turn your SDR off, and then on again. This will help you make sure that ntpd is starting when you turn your SDR on.
  2. ssh into your SDR
  3. Use root access by issuing the command:

    sudo -i

    and entering your password.

  4. Issue the command:

    ntpq -pn

    to see the NTP server that your SDR is connected to. Expect to see a table that looks like:

         remote           refid      st t when poll reach   delay   offset  jitter
    ==============================================================================
    *192.168.10.4    206.108.0.131    2 u   25   64   37    1.052   -1.391   1.047
    

    If you have not logged into root you will see:

    bash: ntpq: command not found
    

    You cannot simply invoke sudo in the same command as ntpq.

    If ntpd is not running, instead you will see:

    ntpq: read: Connection refused
    

    In that case, enable ntpd by running the command:

    systemctl enable ntpd

    Then go back to step one, including turn your SDR off, so that you can ensure that ntpd is starting when you turn your SDR on.

  5. Check that the IP address(es) shown in the remote column of the table matches the IP address(es) you set in ntp.conf.

  6. Check that one of the IP addresses shown in the remote column is marked with an asterisk (*). The asterisk indicates that the time on your SDR is synchronized with the NTP server at that IP address.

    If there is no asterisk, check the reach column of the table. If reach is 0, then your SDR cannot communicate with the NTP server. Check your network connection, and check that you entered the IP address of the NTP server correctly.

    If reach less than 10, then your SDR is not communicating with your NTP server in burst mode, and synchronization may take a very long time. Confirm that your ntp.conf file includes the instruction iburst after the NTP server’s IP address.

    If reach is greater than 10, then your SDR is communicating with your NTP server. Wait 2 minutes before checking again to see if the asterisk has appeared to indicate successful synchronization.

  7. You have ensured that ntpd is running properly.