ptp4l 采用的协议不同的时候,输出的结果也是不同的。
ptp4l默认采用 IEEE 1588协议进行时钟同步:
用ptp4l默认的同步结果是这样的:
root@dell:/home/ppl/sbs# ptp4l -i eno1 -m -s -2
ptp4l[1876840.874]: selected /dev/ptp0 as PTP clock
ptp4l[1876840.915]: port 1: INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[1876840.915]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[1876842.452]: port 1: new foreign master 001df3.fffe.125282-1
ptp4l[1876846.548]: selected best master clock 001df3.fffe.125282
ptp4l[1876846.548]: port 1: LISTENING to UNCALIBRATED on RS_SLAVE
ptp4l[1876849.620]: master offset 271277 s0 freq +19786 path delay 7379
ptp4l[1876850.644]: master offset 271360 s1 freq +19869 path delay 7379
ptp4l[1876851.669]: master offset 298 s2 freq +20167 path delay 7379
ptp4l[1876851.669]: port 1: UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED
ptp4l[1876852.693]: master offset -96 s2 freq +19862 path delay 7380
ptp4l[1876853.716]: master offset 175 s2 freq +20105 path delay 7399
ptp4l[1876854.741]: master offset -216 s2 freq +19766 path delay 7399
ptp4l[1876855.765]: master offset -116 s2 freq +19801 path delay 7419
ptp4l[1876856.789]: master offset 199 s2 freq +20081 path delay 7410
ptp4l[1876857.813]: master offset -147 s2 freq +19795 path delay 7419
ptp4l[1876858.837]: master offset 19 s2 freq +19917 path delay 7421
ptp4l[1876859.861]: master offset 186 s2 freq +20090 path delay 7421
ptp4l[1876860.885]: master offset -95 s2 freq +19865 path delay 7421
ptp4l[1876861.909]: master offset 75 s2 freq +20006 path delay 7433
对端命令:
ptp4l -i swp0 -2
如果用802.1AS同步的结果是这样的:
root@dell:/home/ppl/sbs# ptp4l -i eno1 -2 -m -f gPTP.cfg -s
ptp4l[1876971.010]: selected /dev/ptp0 as PTP clock
ptp4l[1876971.051]: port 1: INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[1876971.051]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[1876974.292]: port 1: new foreign master 001df3.fffe.125282-1
ptp4l[1876974.293]: selected best master clock 001df3.fffe.125282
ptp4l[1876974.293]: port 1: LISTENING to UNCALIBRATED on RS_SLAVE
ptp4l[1876975.317]: port 1: UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED
ptp4l[1876975.958]: rms 11098 max 22234 freq +19720 +/- 276 delay 7481 +/- 0
ptp4l[1876976.982]: rms 321 max 516 freq +20110 +/- 115 delay 7511 +/- 0
ptp4l[1876978.006]: rms 109 max 194 freq +20025 +/- 62 delay 7513 +/- 0
ptp4l[1876979.031]: rms 86 max 148 freq +20082 +/- 49 delay 7511 +/- 0
ptp4l[1876980.056]: rms 81 max 147 freq +20053 +/- 107 delay 7511 +/- 0
ptp4l[1876981.080]: rms 77 max 128 freq +20023 +/- 106 delay 7507 +/- 4
ptp4l[1876982.104]: rms 58 max 105 freq +20062 +/- 78 delay 7486 +/- 0
ptp4l[1876983.129]: rms 90 max 141 freq +20020 +/- 122 delay 7486 +/- 0
ptp4l[1876984.157]: rms 71 max 169 freq +20006 +/- 94 delay 7497 +/- 0
ptp4l[1876985.181]: rms 78 max 135 freq +19977 +/- 102 delay 7490 +/- 0
ptp4l[1876986.206]: rms 69 max 128 freq +20049 +/- 89 delay 7481 +/- 0
ptp4l[1876987.230]: rms 76 max 165 freq +20036 +/- 105 delay 7474 +/- 0
ptp4l[1876988.255]: rms 71 max 159 freq +20025 +/- 98 delay 7481 +/- 0
ptp4l[1876989.279]: rms 56 max 108 freq +20039 +/- 77 delay 7481 +/- 0
ptp4l[1876990.303]: rms 67 max 129 freq +20091 +/- 84 delay 7481 +/- 0
ptp4l[1876991.328]: rms 69 max 125 freq +20097 +/- 92 delay 7474 +/- 0
对端命令:
ptp4l -i swp0 -f gPTP.cfg -2
gPTP.cfg内容:
[global]
gmCapable 1
priority1 128
priority2 248
logAnnounceInterval 0
logSyncInterval -3
syncReceiptTimeout 3
#neighborPropDelayThresh 800
neighborPropDelayThresh 80000
min_neighbor_prop_delay -20000000
assume_two_step 1
path_trace_enabled 1
follow_up_info 1
transportSpecific 0x1
ptp_dst_mac 01:80:C2:00:00:0E
network_transport L2
delay_mechanism P2P
ptp配置项意义
参数 | 说明 |
gmCapable | 该项目决定设备是否能成为整个网络的主时钟。 默认配置下,所有运行ptp4l的设备将从该选项设为1的设备中自动协商选择主时钟。 |
priority1, priority2 | 设备时钟优的先级。数字越小,优先级越高。 |
neighborPropDelayThresh | 邻近设备延时阈值,单位为纳秒(ns)。实际组网后,设备将根据测得的网络延时来选择主时钟,若连接的所有设备网络延时均超出阈值,且在gmCapable设置为1的情况下,则设备将以自身本地时钟作为网络的主时钟。 |
ptp_dst_mac | 使用MAC地址01:80:C2:00:00:0E。该项目为IEEE 802.1AS协议规范,不应修改。 |
network_transport | 使用数据链路层传输协议,相当于命令行参数-2。该项目为IEEE 802.1AS协议规范,不应修改。 |