最为我们熟悉的时间同步协议是 NTP,配置起来相对简单,并不复杂;但是 NTP 实现的毫秒级的时间同步,在普通的网络中只是用来实现网络时间的同步管理。在 5G 网络中需要一种更为精确的时间同步协议,所以这个文章记录下微妙级的时间同步协议-PTP 配置案例。
网络元素 #
- Grandmaster (GM) :时间源设备, 所为其他网络设备提供计时,并且不将其本地时钟与其他网络设备同步。
- T-BC(Boundary Clock):边界时钟, 将其本地时钟与 T-GM 或上游 T-BC 时钟同步,并向下游 T-BC 或 T-TSC 时钟提供时序信息。
- T-TSC: time slave clock, 从时钟将其本地时钟与另一个 PTP 时钟同步,但不向任何其他网络设备提供 PTP 同步。
设备端口状态 #
INIT | Port is not ready to participate in PTP. |
LISTENING | First state when a port becomes ready to participate in PTP: In this state, the port listens to PTP masters for a (configurable) period of time. |
PRE-MASTER | Port is ready to enter the MASTER state. |
MASTER | Port provides timestamps for any Slave or boundary clocks that are listening. |
UNCALIBRATED | Port receives timestamps from a Master clock but, the router’s clock is not yet synchronized to the Master. |
SLAVE | Port receives timestamps from a Master clock and the router’s clock is synchronized to the Master. |
PASSIVE | Port is aware of a better clock than the one it would advertise if it was in MASTER state and is not a Slave clock to that Master clock. |
NCS55 G82751 配置案例 #
T-GM #
RP/0/RP0/CPU0:PE2-NCS55A2-A#show run ptp
Sat Aug 22 16:11:00.559 UTC
ptp
clock
domain 24
profile g.8275.1 clock-type T-GM
identity mac-address 0100.4817.6033
clock-class 6
!
profile g82751_any
multicast
transport ethernet
sync frequency 16
announce frequency 8
delay-request frequency 16
!
log
servo events
best-master-clock changes
!
!
RP/0/RP0/CPU0:PE2-NCS55A2-A#
RP/0/RP0/CPU0:PE2-NCS55A2-A#
RP/0/RP0/CPU0:PE2-NCS55A2-A#show run frequency synchronization
Sat Aug 22 16:11:09.727 UTC
frequency synchronization
quality itu-t option 1
log selection changes
!
RP/0/RP0/CPU0:PE2-NCS55A2-A#show ptp interfaces brief
Sat Aug 22 16:12:44.308 UTC
Intf Port Port Line
Name Number State Encap State Mechanism
--------------------------------------------------------------------------------
Te0/0/0/8 1 Master Ethernet up 1-step DRRM
RP/0/RP0/CPU0:PE2-NCS55A2-A#
RP/0/RP0/CPU0:PE2-NCS55A2-A#
RP/0/RP0/CPU0:PE2-NCS55A2-A#show run int tenGigE 0/0/0/8
Sat Aug 22 16:12:50.416 UTC
interface TenGigE0/0/0/8
ptp
profile g82751_any
!
ipv4 address 10.99.1.2 255.255.255.252
frequency synchronization
wait-to-restore 0
quality transmit exact itu-t option 1 PRC
!
!
T-BC #
RP/0/RP0/CPU0:NCS5516-B#show run ptp
Sat Aug 22 16:37:52.667 UTC
ptp
clock
domain 24
profile g.8275.1 clock-type T-BC
priority2 100
clock-class 165
!
profile g82751_any
multicast
transport ethernet
sync frequency 16
announce frequency 8
delay-request frequency 16
!
time-of-day priority 99
physical-layer-frequency
log
servo events
best-master-clock changes
!
!
RP/0/RP0/CPU0:NCS5516-B#show run frequency synchronization
Sat Aug 22 16:38:06.764 UTC
frequency synchronization
quality itu-t option 1
log selection changes
!
RP/0/RP0/CPU0:NCS5516-B#show run int tenGigE 0/1/0/0
Sat Aug 22 16:38:57.615 UTC
interface TenGigE0/1/0/0
ptp
profile g82751_any
port state slave-only
!
ipv4 address 10.99.1.1 255.255.255.252
frequency synchronization
selection input
priority 10
wait-to-restore 0
!
!
RP/0/RP0/CPU0:NCS5516-B#show ptp interfaces brief
Sat Aug 22 16:39:01.662 UTC
Intf Port Port Line
Name Number State Encap State Mechanism
--------------------------------------------------------------------------------
Te0/1/0/0 1 Slave Ethernet up 1-step DRRM
Te0/1/0/1 2 Master Ethernet up 1-step DRRM
Hu0/0/0/34 4 Master Ethernet up 1-step DRRM
Hu0/0/0/35 3 Master Ethernet up 1-step DRRM