Network Time Protocol

The Network Time Protocol (NTP) is a protocol that allows devices to synchronize their clocks over the network. This protocol is essential to guarantee clock synchronization of network devices and other compute devices on a network.

An NTP server synchronizes to a reference clock and then distributes it to other devices in the network.

NTP Server Configuration

A user can add an NTP server in SONiC using the following command:

admin@sonic:~$ sudo config ntp add -h
Usage: config ntp add [OPTIONS] <ntp_ip_address>

  Add NTP server IP

Options:
  -?, -h, --help  Show this message and exit.

For example:

admin@sonic:~$ sudo config ntp add 192.168.0.1
NTP server 192.168.0.1 added to configuration
Restarting ntp-config service...

To show current NTP configuration:

admin@sonic:~$ show ntp
MGMT_VRF_CONFIG is not present.
synchronised to NTP server (192.168.0.1) at stratum 3 
   time correct to within 303847 ms
   polling server every 64 s
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*192.168.0.1     171.68.38.66     2 u   30   64    1    0.239  +303622   1.066

To remove NTP server:

admin@sonic:~$ sudo config ntp del -h
Usage: config ntp del [OPTIONS] <ntp_ip_address>

  Delete NTP server IP

Options:
  -h, -?, --help  Show this message and exit.

For example:

admin@sonic:~$ sudo config ntp del 192.168.0.1
NTP server 192.168.0.1 removed from configuration
Restarting ntp-config service...
admin@sonic:~$