我正在尝试与 PTP 同步时间;我已使用 PTP 配置 Trimble 设备。但是,当我使用具有以下配置的 LinuxPTP 时,本地时钟始终被选为最佳主时钟。
ptp4l[892.103]: selected local clock 00032d.fffe.55bd3b as best master
我想知道为什么它不选择 Trimble 设备作为主时钟。
设备通过 SFP/光纤电缆连接。
- PTP 配置文件 -
/etc/linuxptp/ptpv2.conf
[global] verbose 1 domainNumber 24 clockClass 6 priority1 128 priority2 128 [enp11s0]
- 像这样运行
sudo
并控制台此输出。$ sudo ptp4l -f /etc/linuxptp/ptpv2.conf ptp4l[886.038]: selected /dev/ptp7 as PTP clock ptp4l[886.039]: port 1 (enp11s0): INITIALIZING to LISTENING on INIT_COMPLETE ptp4l[886.039]: port 0 (/var/run/ptp4l): INITIALIZING to LISTENING on INIT_COMPLETE ptp4l[886.039]: port 0 (/var/run/ptp4lro): INITIALIZING to LISTENING on INIT_COMPLETE ptp4l[892.103]: port 1 (enp11s0): LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES ptp4l[892.103]: selected local clock 00032d.fffe.55bd3b as best master ptp4l[892.103]: port 1 (enp11s0): assuming the grand master role
- 我还捕获了 Wireshark 公告消息,看看是否有助于调试此消息。
Frame 9466: 78 bytes on wire (624 bits), 78 bytes captured (624 bits) on interface enp11s0, id 0 Ethernet II, Src: Trimble_70:07:6a (00:17:47:70:07:6a), Dst: IEEEI&MS_00:00:00 (01:1b:19:00:00:00) Precision Time Protocol (IEEE1588) 0000 .... = majorSdoId: Unknown (0x0) .... 1011 = messageType: Announce Message (0xb) 0000 .... = minorVersionPTP: 0 .... 0010 = versionPTP: 2 messageLength: 64 domainNumber: 24 minorSdoId: 0 flags: 0x003c 0... .... .... .... = PTP_SECURITY: False .0.. .... .... .... = PTP profile Specific 2: False ..0. .... .... .... = PTP profile Specific 1: False .... .0.. .... .... = PTP_UNICAST: False .... ..0. .... .... = PTP_TWO_STEP: False .... ...0 .... .... = PTP_ALTERNATE_MASTER: False .... .... .0.. .... = SYNCHRONIZATION_UNCERTAIN: False .... .... ..1. .... = FREQUENCY_TRACEABLE: True .... .... ...1 .... = TIME_TRACEABLE: True .... .... .... 1... = PTP_TIMESCALE: True .... .... .... .1.. = PTP_UTC_REASONABLE: True .... .... .... ..0. = PTP_LI_59: False .... .... .... ...0 = PTP_LI_61: False correctionField: 0.000000 nanoseconds correction: Ns: 0 nanoseconds correctionSubNs: 0 nanoseconds messageTypeSpecific: 0 ClockIdentity: 0x001747fffe70076a MAC Vendor: Trimble SourcePortID: 1 sequenceId: 28828 controlField: Other Message (5) logMessagePeriod: -3 originTimestamp (seconds): 0 originTimestamp (nanoseconds): 0 originCurrentUTCOffset: 37 priority1: 128 grandmasterClockClass: 6 grandmasterClockAccuracy: The time is accurate to within 100 ns (0x21) grandmasterClockVariance: 20061 priority2: 128 grandmasterClockIdentity: 0x001747fffe70076a localStepsRemoved: 0 TimeSource: GPS (0x20)
- 同步命令
phc2sys -w -m -s enp11s0 -c CLOCK_REALTIME
当我在互联网上检查其他一些配置时,他们的日志显示正确的时钟选择,但我的总是选择最好的主时钟作为本地时钟,并且它不会同步主/边界时钟的时间(现在,我我使用的是带有 GPS 的 Trimble 1570001820 设备)。
其他注意事项:
- NTP 已禁用
- 硬件能够处理 PTP,并且安装了最新的驱动程序。