[PTP][1588v2] Sync消息和Delay_Req消息

文章详细解析了IEEE1588V2协议中PrecisionTimeProtocol(PTP)的报文格式,包括Sync消息和Delay_Req消息的实例,展示了不同类型的字段含义和示例数据包结构。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、报文格式

+0------3--------7--------11--------15--------------------------------31
|TranSpec|MsgType|Reserved1| VerPTP |              MsgLength          |
+----------------|------------------|---------------------------------|
|  DomainNumber  |      Reserved2   |              FlagField          |
+---------------------------------------------------------------------|
|                             CorrectionField                         |
|                                                                     |
+---------------------------------------------------------------------|
|                                Reserved3                            |
+---------------------------------------------------------------------|
|                          SourcePortIdentity                         |
|                                                                     |
|                                   +---------------------------------|
|                                   |SequenceID                       |
+----------------|------------------|---------------------------------|
|  ControlField  |  LogMsgInterval  |                                 |
+---------------------------------------------------------------------|
|                           OriginTimestamp                           |
|                                                                     |
|                                   |                                 |
字段长度含义
TranSpec4 bits传送相关。
0–表示PTP消息由1588协议使用
1–表示PTP消息由802.1as协议使用
MsgType4 bits0x00: Sync
0x01: Delay_Req
Reserved14 bits保留字段。
VerPTP4 bits表示1588协议的版本。
MsgLength2 bytesPTP消息的长度,即PTP消息的全部字节数目。
计入字节始于报头的第一个字节,同时包含并收尾于任何尾标的最后一个字节,或是无尾标成员时收尾于消息的最后一个字节。
DomainNumber1 byte域编号,表示发送该消息时钟所属的域
Reserved21 byte保留字段。
FlagField2 bytes标志域。
CorrectionFieldCorrectionField修正域,各报文都有,主要用在Sync报文中,用于补偿网络中的传输时延,E2E的频率同步。
Reserved34 bytes保留字段。
SourcePortIdentity10 bytes源端口标识符,发送该消息时钟的ID和端口号。
SequenceID2 bytes序列号ID,表示消息的序列号,以及关联消息的对应关系。
ControlField1 byte控制域,由消息类型决定。
LogMsgInterval1 byte录入消息周期,PTP消息的发送时间间隔
OriginTimestamp10 bytes源时间标签。

二、报文示例

(1) 基于UDP的Sync消息

Frame 1: 90 bytes on wire (720 bits), 90 bytes captured (720 bits)
Ethernet II, Src: 0a:2a:0a:31:0a:13 (0a:2a:0a:31:0a:13), Dst: IeeeI&MS_00:00:00 (01:1b:19:00:00:00)
Internet Protocol Version 4, Src: 10.1.1.1 (10.1.1.1), Dst: 224.0.1.129 (224.0.1.129)
User Datagram Protocol, Src Port: ptp-event (319), Dst Port: ptp-event (319)
Precision Time Protocol (IEEE1588)
    0000 .... = transportSpecific: 0x00
    .... 0000 = messageId: Sync Message (0x00)
    .... 0010 = versionPTP: 2
    messageLength: 44
    subdomainNumber: 0
 flags: 0x002c
        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
        .... .... ..1. .... = FREQUENCY_TRACEABLE: True
        .... .... ...0 .... = TIME_TRACEABLE: False
        .... .... .... 1... = PTP_TIMESCALE: True
        .... .... .... .1.. = PTP_UTC_REASONABLE: True
        .... .... .... ..0. = PTP_LI_59: False
        .... .... .... ...0 = PTP_LI_61: False
    correction: 0.144547 nanoseconds
        correction: Ns: 0 nanoseconds
    ClockIdentity: 0x00259e1000000001
    SourcePortID: 1280
    sequenceId: 62761
    control: Sync Message (0)
    logMessagePeriod: -10
    originTimestamp (seconds): 947130386
    originTimestamp (nanoseconds): 414447272

(2) 基于以太的Sync消息

Frame 1: 64 bytes on wire (512 bits), 64 bytes captured (512 bits)
Ethernet II, Src: 0a:2a:0a:31:0a:13 (0a:2a:0a:31:0a:13), Dst: HuaweiTe_98:f2:6e (00:25:9e:98:f2:6e)
    Destination: HuaweiTe_98:f2:6e (00:25:9e:98:f2:6e)
    Source: 0a:2a:0a:31:0a:13 (0a:2a:0a:31:0a:13)
    Type: PTPv2 over Ethernet (IEEE1588) (0x88f7)
Precision Time Protocol (IEEE1588)
    0000 .... = transportSpecific: 0x00
    .... 0000 = messageId: Sync Message (0x00)
    .... 0010 = versionPTP: 2
    messageLength: 44
    subdomainNumber: 0
flags: 0x042c
        0... .... .... .... = PTP_SECURITY: False
        .0.. .... .... .... = PTP profile Specific 2: False
        ..0. .... .... .... = PTP profile Specific 1: False
        .... .1.. .... .... = PTP_UNICAST: True
        .... ..0. .... .... = PTP_TWO_STEP: False
        .... ...0 .... .... = PTP_ALTERNATE_MASTER: False
        .... .... ..1. .... = FREQUENCY_TRACEABLE: True
        .... .... ...0 .... = TIME_TRACEABLE: False
        .... .... .... 1... = PTP_TIMESCALE: True
        .... .... .... .1.. = PTP_UTC_REASONABLE: True
        .... .... .... ..0. = PTP_LI_59: False
        .... .... .... ...0 = PTP_LI_61: False
correction: 0.602692 nanoseconds
        correction: Ns: 0 nanoseconds
        SubNs: 0.602692 nanoseconds
    ClockIdentity: 0x00259e1000000001
    SourcePortID: 1280
    sequenceId: 25801
    control: Sync Message (0)
   logMessagePeriod: 127
    originTimestamp (seconds): 947130222
    originTimestamp (nanoseconds): 436724034

(3) 基于UDP的Delay_Req消息

Frame 1: 94 bytes on wire (752 bits), 94 bytes captured (752 bits)
Ethernet II, Src: HuaweiTe_00:00:11 (00:18:82:00:00:11), Dst: HuaweiTe_92:27:fe (28:6e:d4:92:27:fe)
Internet Protocol Version 4, Src: 10.0.1.2 (10.0.1.2), Dst: 10.0.1.50 (10.0.1.50)
User Datagram Protocol, Src Port: ptp-event (319), Dst Port: ptp-event (319)
Precision Time Protocol (IEEE1588)
    0000 .... = transportSpecific: 0x00
    .... 0001 = messageId: Delay_Req Message (0x01)
    .... 0010 = versionPTP: 2
    messageLength: 44
    subdomainNumber: 0
    flags: 0x050a
        0... .... .... .... = PTP_SECURITY: False
        .0.. .... .... .... = PTP profile Specific 2: False
        ..0. .... .... .... = PTP profile Specific 1: False
        .... .1.. .... .... = PTP_UNICAST: True
        .... ..0. .... .... = PTP_TWO_STEP: False
        .... ...1 .... .... = PTP_ALTERNATE_MASTER: True
        .... .... ..0. .... = FREQUENCY_TRACEABLE: False
        .... .... ...0 .... = TIME_TRACEABLE: False
        .... .... .... 1... = PTP_TIMESCALE: True
        .... .... .... .0.. = PTP_UTC_REASONABLE: False
        .... .... .... ..1. = PTP_LI_59: True
        .... .... .... ...0 = PTP_LI_61: False
    correction: 0.000000 nanoseconds
        correction: Ns: 0 nanoseconds
        SubNs: 0.000000 nanoseconds
    ClockIdentity: 0x704433fffe297564
    SourcePortID: 4363
    sequenceId: 48672
    control: Delay_Req Message (1)
    logMessagePeriod: 127
    originTimestamp (seconds): 0
    originTimestamp (nanoseconds): 0

(4) 基于以太的Delay_Req消息

Frame 1: 64 bytes on wire (512 bits), 64 bytes captured (512 bits)
Ethernet II, Src: 0e:e0:f0:00:00:02 (0e:e0:f0:00:00:02), Dst: IeeeI&MS_00:00:00 (01:1b:19:00:00:00)
    Destination: IeeeI&MS_00:00:00 (01:1b:19:00:00:00)
    Source: 0e:e0:f0:00:00:02 (0e:e0:f0:00:00:02)
    Type: PTPv2.over Etherner (IEEE1588) (0x88f7)
Precision Time Protocol (IEEE1588)
    0000 .... = transportSpecific: 0x00
        ...0 .... = 802 1as conform:Flase
    .... 0001 = messageId: Delay_Req Message (0x01)
    .... 0010 = versionPTP: 2
    messageLength: 44
    subdomainNumber: 0
    flags: 0x0128
        0... .... .... .... = PTP_SECURITY: False
        .0.. .... .... .... = PTP profile Specific 2: False
        ..0. .... .... .... = PTP profile Specific 1: False
        .... .1.. .... .... = PTP_UNICAST: False
        .... ..0. .... .... = PTP_TWO_STEP: False
        .... ...1 .... .... = PTP_ALTERNATE_MASTER: True
        .... .... ..0. .... = FREQUENCY_TRACEABLE: True
        .... .... ...0 .... = TIME_TRACEABLE: False
        .... .... .... 1... = PTP_TIMESCALE: True
        .... .... .... .0.. = PTP_UTC_REASONABLE: False
        .... .... .... ..1. = PTP_LI_59: False
        .... .... .... ...0 = PTP_LI_61: False
    correction: -22895715404183.000000 nanoseconds
        correction: Ns: -22895715404183 nanoseconds
        SubNs: 0.000000 nanoseconds
    ClockIdentity: 0x00259e1000000003
    SourcePortID: 3330
    sequenceId: 19267
    control: Delay_Req Message (1)
    logMessagePeriod: 127
    originTimestamp (seconds): 0

三、参考标准

标准描述
IEEE 1588 V2面向网络测控系统的精密时钟同步协议
IEEE P1588™ D2.2网络测控系统精密时钟同步协议标准草案
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

jianqiang.xue

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值