ntp — 48-Byte RFC 5905 Stratum-1 Time Sync on UDP 123
- Default Port / Protocol
- UDP 123
- Host Endpoint Rule
- Dual-Stack IPv4/IPv6
- Wireshark Display Filter
- ntp
- Standards & Specs
- RFC 5905
What It Does on the Wire
When Kerberos tickets start failing because two servers drifted five minutes apart, everyone stares at UDP 123. ntp writes clean 48-byte RFC 5905 packets right down to signed precision and ASCII refid.
Network Time Protocol (ntp, RFC 5905) synchronizes system clocks across routers, servers, financial engines, and Kerberos/TLS infrastructure over UDP dstport 123. Every standard NTPv4 packet is a fixed 48-byte binary structure packing Leap Indicator (li), Version (vn), Mode (mode), stratum, poll, signed log2 precision, Root Delay/Dispersion, 4-byte refid ("GPS", "PPS", "ATOM", or kiss-o'-death "RATE"), and 64-bit NTP epoch timestamps.
Stratum 1 GPS / Atomic Clock Sync & Kiss-o'-Death (stratum 0) Testing
Generate mode 3 client requests paired with mode 4 stratum 1 refid "GPS" responses—or stratum 0 refid "RATE" Kiss-o'-Death rate-limiting replies.
NTP Mode 6 (monlist / Control) DDoS Amplification Firewall Filters
Craft ntp vn 2 mode 6 or mode 7 packets on UDP 123 to verify edge ACLs block legacy NTP control/private amplification queries while permitting mode 3/4.
Router Symmetric-Active (mode 1) Peer Verification
Test core router NTP peerings (srcport 123 dstport 123, mode 1 / mode 2) with dscp 48 (CS6) QoS markings.
RFC Wire Header Layout (ntp)
Select any 32-bit wire word or field slice below to inspect which .frasm modifiers control those octets and what defaults the compiler writes.
Minimal Quickstart (ntp_quickstart.frasm)
Select Preview Packets to compile in-browser and inspect timestamps + wire byte lengths, or open directly in the Playground.
host app_srv { ip 10.10.20.40 }
host time_appliance { ip 10.10.20.123 }
compile {
app_srv -> time_appliance ntp vn 4 mode 3 poll 6 wait 2ms
app_srv <- time_appliance ntp li 0 vn 4 mode 4 stratum 1 poll 6 precision -20 refid "GPS" txtimestamp 0xe9b4c20000000000
}Handled Automatically on the Wire
- Packs the first byte
(li << 6) | (vn << 3) | modecleanly (0x23forli 0 vn 4 mode 3client;0x24formode 4server) inside a 48-byte RFC 5905 header. - Zero-pads 4-character ASCII
refidstrings ("GPS\0","PPS\0","RATE") for Stratum 0/1 servers. - Reverses ephemeral
srcport <-> 123automatically across->and<-statements.
Stratum 1 Synchronization + Kiss-o'-Death Rate-Limit & Mode 6 Audit Probe
Captures normal NTPv4 client/server clock sync, a stratum 0 refid "RATE" Kiss-o'-Death response, and a blocked mode 6 control query for IDS testing.
host branch_rtr { ip 172.16.30.1 }
host ntp_core { ip 172.16.30.123 }
compile {
// 1. Standard NTPv4 Client (mode 3) -> Stratum 1 GPS Server (mode 4)
branch_rtr -> ntp_core ntp vn 4 mode 3 poll 6 precision -18 dscp 48 wait 2ms
branch_rtr <- ntp_core ntp li 0 vn 4 mode 4 stratum 1 poll 6 precision -24 refid "GPS" txtimestamp 0xe9b4d01080000000 dscp 48 wait 5ms
// 2. RFC 5905 Kiss-o'-Death (stratum 0, li 3, refid "RATE")
branch_rtr <- ntp_core ntp li 3 vn 4 mode 4 stratum 0 refid "RATE" wait 5ms
// 3. Mode 6 NTP Control query probe (tested against perimeter IDS/firewall)
branch_rtr -> ntp_core ntp vn 2 mode 6
}# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show ntp_sync_and_security_audit.frasm
# 2. Compile .frasm -> classic .pcap (tcpdump/tcpreplay/Suricata) or nanosecond .pcapng
frameassembly ntp_sync_and_security_audit.frasm ntp_sync_and_security_audit.pcap
frameassembly ntp_sync_and_security_audit.frasm ntp_sync_and_security_audit.pcapng
# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse ntp_sync_and_security_audit.pcap ntp_sync_and_security_audit_edited.frasm
# 4. Verify dissected protocol fields in tshark
tshark -r ntp_sync_and_security_audit.pcap -Y "ntp"All ntp Keywords & Header Options
Every sub-keyword and header option is lowercase [a-z0-9]+ with zero underscores — mix and match them in any order after ntp:
src_host -> dst_host ntp [li <0..3>] [vn <1..4>] [mode <0..7>] [stratum <0..16>] [poll <0..255>] [precision <-128..127>] [refid "<text>"] [txtimestamp <number>]| Keyword / Option | Accepted Value | Default | Effect on Packet |
|---|---|---|---|
| li <0..3> | 2-bit Leap Indicator | 0 (no warning) | Sets bits 7..6 of byte 0 (0=no leap, 1=61s minute, 2=59s minute, 3=unsynchronized/alarm). |
| vn <1..4> | 3-bit NTP Version Number | 4 (NTPv4) | Sets bits 5..3 of byte 0 (1..4). |
| mode <0..7> | 3-bit Association Mode | 3 (Client) | Sets bits 2..0 of byte 0 (1=Symmetric Active, 2=Passive, 3=Client, 4=Server, 5=Broadcast, 6=Control, 7=Private). |
| stratum <0..16> | Whole number (0..255) | 0 (client) / 1 (when refid set) | Sets Clock Stratum (0=unspecified/KoD, 1=primary GPS/PPS, 2..15=secondary, 16=unsynchronized). |
| poll <0..255> | precision <-128..127> | poll: u8 log2 seconds, precision: signed i8 (-128..127) | poll 6 (64s), precision -20 (~1us) | Sets 8-bit Poll Interval exponent and signed 8-bit two's-complement Clock Precision. |
| refid "<text>" | Up to 4 ASCII chars ("GPS", "PPS", "ATOM", "RATE") | "LOCL" / zeroed | Writes the 4-byte Reference Identifier in bytes 12..15. |
| txtimestamp <number> | 64-bit NTP timestamp (32b sec since 1900 + 32b frac) | Non-zero deterministic epoch | Writes the 8-byte Transmit Timestamp in bytes 40..47. |
Cross-Layer Wrappers Valid with ntp
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
10 options
Cross-Layer Wrappers Valid with ntp
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
| Option | Range / Format | Default | Effect on Packet |
|---|---|---|---|
| wait <number><ns|us|ms|s|m> | Time gap (ns, us, ms, s, m) | 10ms | Advances the packet timestamp clock after sending this packet and before the next packet (wait 0ns sends back-to-back). |
| payload "<text>" | hexpayload "<hex>" | Quoted text or hex bytes (choose one) | Omitted | Appends or overrides raw payload bytes ("deadbeef" or "de:ad:be:ef") and updates packet lengths and checksums. |
| srcmac <mac> | dstmac <mac> | ethertype <0..65535> | Colon/hyphen/Cisco MAC · EtherType u16 (e.g. 0x0800) | Host MAC / RFC multicast MAC / auto EtherType | Overrides the 14-byte Ethernet II source MAC, destination MAC, or 16-bit EtherType for this single packet. |
| vlan <0..4095> [pcp <0..7>] [dei <0|1>] | VLAN ID 0..4095, PCP 0..7, DEI 0..1 | Untagged | Wraps the packet in an IEEE 802.1Q VLAN tag (0x8100) with optional 802.1p QoS priority. |
| qinq <0..4095> [innervlan <0..4095>] | Outer S-VLAN 0..4095, Inner C-VLAN 0..4095 | Untagged (innervlan 1 when qinq is set) | Double-tags the packet with outer IEEE 802.1ad S-Tag (0x88a8) plus inner IEEE 802.1Q C-Tag (0x8100). |
| mpls <0..1048575> [label <0..1048575>] [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>] | Label 0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255 | Unlabeled (at most 1 mpls tag per packet) | Inserts a 32-bit MPLS label header (0x8847) ahead of the Layer 3 header. |
| ttl <0..255> [dscp <0..63>] [ecn <0..3>] | TTL/Hop Limit 0..255, DSCP 0..63, ECN 0..3 | ttl 64, dscp 0, ecn 0 | Sets IPv4 TTL or IPv6 Hop Limit plus DiffServ (DSCP) and ECN QoS markings. |
| ipid <0..65535> [df] [mf] [fragoffset <0..8191>] | IPv4 ID, DF/MF flags, fragment offset 0..8191 | ipid 1, flags 0, fragoffset 0 | Sets IPv4 Identification, Do-Not-Fragment (df), More-Fragments (mf), and fragment offset (ignored over IPv6). |
| flowlabel <0..1048575> | 20-bit IPv6 Flow Label (0..1048575) | 0 | Sets the 20-bit IPv6 Flow Label for ECMP routing tests (ignored when running over IPv4 hosts). |
| srcport <0..65535> | dstport <0..65535> | Port number 0..65535 | srcport 49152 (remembered), UDP 123 | Overrides source or destination port and remembers the port pair automatically on <- replies. |
Gotchas & Quick Fixes
Signed precision Accepts Negative Integers Directly (precision -20)
app_srv <- time_appliance ntp mode 4 precision "-20"app_srv <- time_appliance ntp mode 4 precision -20precision expects an unquoted signed 8-bit integer (-20 represents $2^{-20} \approx 0.95\,\mu\text{s}$).
Set mode 4 Explicitly on Server Replies
app_srv <- time_appliance ntp stratum 1 refid "GPS"app_srv <- time_appliance ntp mode 4 stratum 1 refid "GPS"ntp defaults to mode 3 (Client); always specify mode 4 on <- server responses so Wireshark labels the packet NTP Version 4, server.