6.3 Synchronizing the Time Settings
Time settings are synchronized through Network Time Protocol (NTP).
6.3.1 Network Time Protocol (NTP)
Network Time Protocol (NTP) servers synchronize time settings of systems running an NTP client. The switch supports NTP versions 1 through 4. The default is version 4.
After configuring the switch to synchronize with an NTP server, it may take up to ten minutes for the switch to set its clock. The running-config lists NTP servers that the switch is configured to use.
6.3.1.1 Configuring the NTP Server
The ntp server command adds a server to the list or modifies the parameters of a previously listed address. When the system contains multiple NTP servers, the prefer keyword can be used to specify a preferred NTP server, which will be used as the NTP server if not discarded by NTP.
Note that all NTP servers must be in the same VRF, and that they are added in the default VRF if no VRF is specified.
Example
These commands add three NTP servers, designating the second server as preferred.
switch(config)#ntp server local-NTP
switch(config)#ntp server 172.16.0.23 Prefer
switch(config)#ntp server 172.16.0.25
6.3.1.2 Configuring the NTP Source
The ntp local-interface command configures an interface as the source of NTP packets. That interface’s IP address is then used as the source address for all NTP packets unless a server-specific source is configured using the source option of the ntp server command. For an ntp local-interface command to take effect, the specified interface and the NTP server must both belong to the same VRF.
Example
This command configures VLAN interface 25 as the source of NTP update packets.
switch(config)#ntp local-interface vlan 25
switch(config)#
6.3.1.3 Configuring the Switch as an NTP Server
To configure the switch to accept NTP requests on all interfaces, use the ntp serve all command to enable NTP server mode globally on the switch. To configure an individual interface to accept or deny NTP requests, use the ntp serve command. Interface level settings override the global settings, and changing the settings at either the global or interface level also causes the switch to re-synchronize with its upstream NTP server. NTP server mode is disabled by default.
Example
This command configures the switch to act as an NTP server, accepting NTP requests.
switch(config)# ntp serve all
switch(config)#
These commands configure Ethernet interface 5 to accept NTP requests regardless of global settings.
switch(config)#interface ethernet 5
switch(config-if-Et5)#ntp serve
switch(config-if-Et5)#
6.3.1.4 Configuring NTP Authentication
The switch can be configured to synchronize its clock using NTP packets only from an authenticated source. NTP authentication is disabled by default.
To configure the switch to authenticate NTP packets, create one or more authentication keys using the ntp authentication-key command, specify which keys are trusted by using the ntp trusted-key command, and use the ntp authenticate command to enable NTP authentication. The NTP server must be configured to use the same authentication key and key ID number.
Example
These commands configure the switch to authenticate NTP packets using key 328 with the plaintext password “timeSync.”
switch(config)# ntp authentication-key 328 md5 timeSync
switch(config)# ntp trusted key 328
switch(config)# ntp authenticate
switch(config)#
6.3.1.5 Viewing NTP Settings and Status
To display the status of Network Time Protocol (NTP) on the switch, use the show ntp status command. To display the status of connections to NTP servers, use the show ntp associations command. Note that for IPv4 addresses, the reference ID is the IPv4 address of the NTP server. For IPv6 addresses, the reference ID is the first four octets of the MD5 hash of the NTP server’s IP address.
Example
This command displays the status of the switch’s NTP connection.
switch#show ntp status
unsynchronised
  time server re-starting
   polling server every 64 s
switch #
This command displays data about the NTP servers in the configuration.
switch#show ntp associations
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
moose.aristanet 66.187.233.4     2 u    9   64  377    0.118  9440498   0.017
172.17.2.6      .INIT.          16 u    - 1024    0    0.000    0.000   0.000
*LOCAL(0)        .LOCL.          10 l   41   64  377    0.000    0.000   0.000
switch#
6.3.2 Precision Time Protocol (PTP)
The Precision Time Protocol (PTP) enhances the accuracy of real-time clocks in networked devices by providing sub-microsecond clock synchronization. Inbound clock signals are organized into a master-slave hierarchy. PTP identifies the switch port that is connected to the device with the most precise clock. This clock is referred to as the master clock. All the other devices on the network synchronize their clocks with the master and are referred to as slaves.
The master clock sends out a sync message every second. The slave clock sends a delay request message to the master clock noting the time it was sent in order to measure and eliminate packet delays. The master clock then replies with the time stamp the delay message was received. The slave clock then computes the master clock time compensated for delays and finalizes synchronization. Constantly exchanged timing messages ensure continued synchronization.
6.3.2.1 Enable PTP
PTP is disabled globally by default. The following steps are required to enable PTP on an interface:
Set the PTP Mode
To allow PTP to be used on switch interfaces, first set the PTP mode using the ptp mode command. PTP mode options include:
boundary     The device acts as a boundary clock, and both runs and participates in the best master clock algorithm.
disabled     PTP is disabled, and the device forwards all PTP packets as normal traffic.
end-to-end transparent     The device acts as an end-to-end transparent clock, synchronizing all ports to a connected master clock and updating the time interval field of forwarded PTP packets using switch residence time.
peer-to-peer transparent     The device acts as a peer-to-peer transparent clock, synchronizing all ports to a connected master clock and updating the time interval field of forwarded PTP packets using switch residence time and inbound path delays.
generalized Precision Time Protocol (gPTP)     The device runs generalized Precision Time Protocol (gPTP), participating in the best master clock algorithm but also updating the interval field of forwarded PTP packets using switch residence time and inbound path delays.
To disable PTP globally on the switch, use the no or default forms of the ptp mode command.
Example
This command configures the device as a PTP boundary clock.
switch(config)# ptp mode boundary
switch(config)#
Enable PTP on an Interface
To enable PTP on a specific interface on the device, use the ptp enable command.
Example
This command enables PTP on Ethernet interface 5.
switch(config)# interface ethernet 5
switch(config-if-Et5)# ptp enable
6.3.2.2 Configuring PTP Global Options
The following PTP global configurations are optional:
Configure the PTP Domain
To set the domain number to use for the clock, use the ptp domain command.
The ptp domain command configures the domain 1 to use with a clock.
switch(config)# ptp domain 1
switch(config)#
Configure the Offset Hold Time
To set the PTP offset hold time, use the ptp hold-ptp-time command.
The ptp hold-ptp-time command configures the PTP offset hold time to 600 seconds.
switch(config)# ptp hold-ptp-time 600
switch(config)#
Set the PTP Priority 1
To set the priority 1 value, use the ptp priority1 command. Lower values take precedence.
The ptp priority1 command configures the priority 1 value of 120 to use when advertising the clock.
switch(config)# ptp priority1 120
switch(config)#
Set the PTP Priority 2
To set the priority 2 value for the clock, use the ptp priority2 command.
The ptp priority2 command configures the priority 2 value of 128.
switch(config)# ptp priority2 128
switch(config)#
Configure the Source IP
To set the source IP address for all PTP packets, use the ptp source ip command.
The ptp source ip command configures the source IP address of 10.0.2.1 for all PTP packets.
switch(config)# ptp source ip 10.0.2.1
switch(config)#
Configure the TTL for the PTP Packets
To set the time to live (TTL) of the PTP packets, use the ptp ttl command. Time to live is the maximum number of hops that a PTP packet may make.
The ptp ttl command configures the time to live (TTL) of 64 hops for PTP packets.
switch(config)# ptp ttl 64
switch(config)#
6.3.2.3 Configuring PTP Interface Options
The following PTP interface-level configurations are optional:
Set the PTP Announcement Interval
To set the interval (in log seconds) between PTP announcement messages on an interface, use the ptp announce interval command. This value also affects the time interval.
This command configures the interval between PTP announcement messages on Ethernet interface 5 to 4 seconds.
switch(config)# interface ethernet 5
switch(config-if-Et5)# ptp announce interval 2
switch(config-if-Et5)#
Set the PTP Timeout Interval
To set the timeout multiplier for an interface, use the ptp announce timeout command. The timeout multiplier is the number of announcement intervals that the interface will wait without receiving a PTP announcement before a timeout occurs; values range from 2 to 255. The default multiplier is 3, which results in a 6-second timeout interval when the announcement interval is set to the default of 2 seconds.
This command sets timeout multiplier for the interface to 5; since the announcement interval has just been set to 2 (4 seconds), this means the interface will time out if it doesn’t receive a PTP announcement for 20 seconds.
switch(config-if-Et5)# ptp announce timeout 5
switch(config-if-Et5)#
Configure the PTP Delay Mechanism
To set the delay mechanism used in boundary-mode, use the ptp delay-mechanism command.
This command sets the delay mechanism in boundary clock mode for the interface to peer-to-peer.
switch(config-if-Et5)# ptp delay-mechanism p2p
switch(config-if-Et5)#
Set the Delay Request Interval
To set the time for the slave devices to send delay request messages, use the ptp delay-req interval command.
This command sets the time the slave devices to send delay request messages to the master state to 3 for the interface.
switch(config-if-Et5)# ptp delay-request interval 3
switch(config-if-Et5)#
Set the Peer Delay Request Interval
To set the minimum interval between the PTP peer delay-request messages, use the ptp pdelay-req interval command.
This command sets the interval between PTP peer delay-request messages on the interface to 3.
switch(config-if-Et5)# ptp pdelay-request interval 3
switch(config-if-Et5)#
Set the Peer Link Propagation Threshold
To set the delay threshold for which the peer will be considered unable to run generalized Precision Time Protocol (gPTP), use the ptp pdelay-neighbor-threshold command.
This command sets the link propagation delay threshold on the interface to 200000 nanoseconds..
switch(config-if-Et5)# ptp pdelay-neighbor-threshold 200000
switch(config-if-Et5)#
Set the Interval for Sending Synchronization Messages
To set the interval (in log seconds) for sending synchronization messages, use the ptp sync-message interval command. Value ranges and defaults vary based on the PTP mode of the switch.
This command configures the interval for sending synchronization messages on the interface to 3 (8 seconds).
switch(config-if-Et5)# ptp sync-message interval 3
switch(config-if-Et5)#
Set the PTP Transport Type
To set the PTP transport type, use the ptp transport command.
This command configures the PTP transport type for the interface to IPv4.
switch(config-if-Et5)# ptp transport ipv4
switch(config-if-Et5)#
6.3.2.4 Viewing PTP Settings and Status
The following commands display the status of the switch PTP server connections:
Show General PTP Information
To display general Precision Time Protocol (PTP) information, use the show ptp command.
The show ptp command displays PTP summary and port status information.
switch#show ptp
PTP Mode: gptp - Generalized PTP Clock
Clock Identity: 2001:0DB8:73:ff:ff:26:fd:90
Grandmaster Clock Identity: 2001:0DB8:96:ff:fe:6c:ed:02
Number of slave ports: 1
Number of master ports: 6
Slave port: Ethernet33
Mean Path Delay (nanoseconds): 718
Steps Removed: 1
Neighbor Rate Ratio: 1.00000007883
Rate Ratio: 1.00000007883
Interface State    AS      Time Since Last    Neighbor    Mean Path   Residence
                   Capable Changed            Rate Ratio  Delay (ns)  Time (ms)
--------- -------- ------- ------------------ ----------- ----------- ---------
Et1       Disabled No      Never              1.0         0           0
Et2       Disabled No      Never              1.0         0           0
Et3       Disabled No      Never              1.0         0           0
Et4       Disabled No      Never              1.0         0           0
Et5       Disabled No      Never              1.0         0           0
Et6       Disabled No      Never              1.0         0           0
Et7       Master   Yes     0:21:08            1.00000009  420         0
<-------OUTPUT OMITTED FROM EXAMPLE--------> 
Show PTP Local Clock and Offset
The show ptp local-clock command displays the local PTP clock and offset.
switch#show ptp local-clock
PTP Mode: Boundary Clock
Clock Identity: 0x00:1c:73:ff:ff:1e:83:24
Clock Domain: 1
Number of PTP ports: 24
Priority1: 128
Priority2: 128
Clock Quality:
   Class: 248
   Accuracy: 0x30
   OffsetScaledLogVariance: 0xffff
Offset From Master: 0
Mean Path Delay: 0
Steps Removed: 0
switch#
Show PTP Masters Information
The show ptp masters command displays the PTP clock’s master and grandmaster identity and configuration.
switch# show ptp masters
Parent Clock:
Parent Clock Identity: 0x00:1c:73:ff:ff:00:72:40
Parent Port Number: 0
Parent IP Address: N/A
Observed Parent Offset (log variance): N/A
Observed Parent Clock Phase Change Rate: N/A
 
Grandmaster Clock:
Grandmaster Clock Identity: 0x00:1c:73:ff:ff:00:72:40
Grandmaster Clock Quality:
   Class: 248
   Accuracy: 0x30
   OffsetScaledLogVariance: 0xffff
   Priority1: 128
   Priority2: 128
switch#
Show PTP Clock Properties
The show local-clock time-properties command displays PTP clock properties.
switch# show local-clock time-properties
Current UTC offset valid: False
Current UTC offset: 0
Leap 59: False
Leap 61: False
Time Traceable: False
Frequency Traceable: False
PTP Timescale: False
Time Source: 0x0
switch#
Show PTP Information for all Interfaces
The show ptp interface command displays PTP information for specified interfaces.
switch# show ptp interface
Interface Ethernet1
PTP: Disabled
Port state: Disabled
Sync interval: 1.0 seconds
Announce interval: 2.0 seconds
Announce interval timeout multiplier: 3
Delay mechanism: end to end
Delay request message interval: 32.0 seconds
Transport mode: ipv4
 
Interface Ethernet5
PTP: Disabled
Port state: Disabled
Sync interval: 8.0 seconds
Announce interval: 2.0 seconds
Announce interval timeout multiplier: 5
Delay mechanism: peer to peer
Peer delay request message interval: 8.0 seconds
Peer Mean Path Delay: 0
Transport mode: ipv4
<-------OUTPUT OMITTED FROM EXAMPLE--------> 
switch#
Show PTP Interface Counters
The show ptp interface counters command displays PTP interface counters for specified interfaces.
switch# show ptp interface ethernet 5 counters
Interface Ethernet5
Announce messages sent: 0
Announce messages received: 0
Sync messages sent: 0
Sync messages received: 0
Follow up messages sent: 0
Follow up messages received: 0
Delay request messages sent: 0
Delay request messages received: 0
Delay response messages sent: 0
Delay response messages received: 0
Peer delay request messages sent: 0
Peer delay request messages received: 0
Peer delay response messages sent: 0
Peer delay response messages received: 0
Peer delay response follow up messages sent: 0
Peer delay response follow up messages received: 0
switch#
Show PTP Foreign Master
The show ptp foreign-master-record command displays information about foreign masters (PTP sources not designated as the switch’s master from which the switch has received sync packets).
switch# show ptp foreign-master-record
No Foreign Master Records
switch#
Show PTP Source IP
The show ptp source ip command displays PTP IP source information.
switch#show ptp source ip
PTP source IP: 10.0.2.1
switch#