wire / wire-format / ntp-protocol

NTP (Network Time Protocol)

NTP synchronizes clocks over the network. Packet format (48 bytes): LI (leap indicator, 2 bits), VN (version, 3 bits), Mode (3 bits), Stratum (1 byte), Poll (1 byte), Precision (1 byte), Root Delay (4 bytes), Root Dispersion (4 bytes), Reference ID (4 bytes), Reference Timestamp (8 bytes), Origin Timestamp (8 bytes), Receive Timestamp (8 bytes), Transmit Timestamp (8 bytes). NTP uses UDP port 123.

wire-format kind wire-format status standard verification verified tier B wire-format@1

aka: NTP (Network Time Protocol)

wire format

spec: RFC 5905

NTP synchronizes clocks over the network. Packet format (48 bytes): LI (leap indicator, 2 bits), VN (version, 3 bits), Mode (3 bits), Stratum (1 byte), Poll (1 byte), Precision (1 byte), Root Delay (4 bytes), Root Dispersion (4 bytes), Reference ID (4 bytes), Reference Timestamp (8 bytes), Origin Timestamp (8 bytes), Receive Timestamp (8 bytes), Transmit Timestamp (8 bytes). NTP uses UDP port 123.

fieldsizemeaning
LI (Leap Indicator)2 bits0 = no leap, 1 = 61 seconds (leap added), 2 = 59 seconds (leap removed), 3 = alarm (clock not synchronized).
VN (Version)3 bitsNTP version (3 or 4).
Mode3 bits0 = reserved, 1 = symmetric active, 2 = symmetric passive, 3 = client, 4 = server, 5 = broadcast, 6 = NTP control, 7 = private.
Stratum1 byteClock stratum: 0 = unspecified, 1 = primary (atomic clock/GPS), 2-15 = secondary (synced to stratum-1), 16 = unsynchronized.
Poll1 byte (signed)Poll interval in log2 seconds (e.g., 6 = 64 seconds, 10 = 1024 seconds).
Precision1 byte (signed)Clock precision in log2 seconds (e.g., -20 = ~1 microsecond).
Root Delay4 bytes (fixed-point)Total round-trip delay to the primary reference source.
Root Dispersion4 bytes (fixed-point)Maximum error of the local clock relative to the primary source.
Reference ID4 bytesIdentifier of the reference source (IP address for stratum 2+, or ASCII code for stratum 1: GPS, PPS, etc.).
Timestamps4 x 8 bytesReference, Origin, Receive, Transmit timestamps (64-bit: 32-bit seconds + 32-bit fraction, epoch 1900-01-01).

example:

1b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

NTP client request (mode 3, version 4, stratum 0)


provenance

agent: curl -H 'accept: application/json' wire.phall.io/wire-format/ntp-protocol or /wire-format/ntp-protocol.json