RFC 1361
Simple Network Time Protocol (SNTP)
RFC 1361: Simple Network Time Protocol (SNTP) β°
okay bestie, let's get the vitals sorted first π this is RFC 1361, written in August 1992 by D. Mills from the University of Delaware π« it's filed under the Network Working Group and it's Informational, so it provides information for the Internet community and does not specify an Internet standard π distribution is unlimited, so share the vibes π and it does not obsolete or update any RFC, so it's not stepping on anyone's toes π«Ά
Status of this Memo β¨
this memo is giving "informational reading, not a rulebook" π it provides information for the Internet community and does not specify an Internet standard. distribution of this memo is unlimited, so you can pass it around as much as you want π¦
Abstract πΈ
okay so this memo describes the Simple Network Time Protocol (SNTP), which is basically a lighter-weight version of the Network Time Protocol (NTP) that computers use to sync their clocks across the Internet π°οΈ you reach for SNTP when you don't need the ultimate performance of the full NTP implementation from RFC-1305 and it's not worth the extra complexity π the cute part is that it involves no change to the current or previous NTP specification versions or known implementations. it's really just a clarification of certain design features NTP already has, which lets it work in a simple, stateless RPC mode π§ the accuracy and reliability expectations are similar to the UDP/TIME protocol described in RFC-868, so it's giving classic vibes π
this memo does not obsolete or update any RFC π«Ά and you don't need a working knowledge of RFC-1305 to implement SNTP, which is honestly so iconic for a beginner π
1. Introduction β¨
okay the Network Time Protocol (NTP), specified in RFC-1305 [MIL92], is the thing keeping computer clocks in sync across the global Internet β° it's extremely thorough: it has mechanisms to access national time and frequency dissemination services, organize the time-synchronization subnet, and adjust the local clock in each participating subnet peer π°οΈ in most places on today's Internet, NTP gives you accuracies of 1-50 ms, depending on the jitter characteristics of the synchronization source and the network paths π₯
RFC-1305 describes the NTP protocol machine in terms of events, states, transition functions and actions, and on top of that it has optional algorithms to improve timekeeping quality and to mitigate among several, possibly faulty, synchronization sources π§ to get accuracies in the low milliseconds over paths that span major portions of today's Internet, these intricate algorithms (or their functional equivalents) are necessary. BUT, and this is the tea β, in lots of cases you don't need accuracy that tight. something in the order of one second is totally fine. that's where simpler protocols like the Time Protocol [POS83] came in π those usually involve a remote-procedure call (RPC) exchange where the client requests the time of day and the server returns it in seconds past some known reference epoch π°οΈ
NTP is designed for clients and servers with a wide range of capabilities, and over a wide range of network delays and jitter characteristics π most members of today's Internet NTP synchronization subnet run software packages with the full suite of NTP options and algorithms. that software is relatively complex and runs as real-time applications π it's been ported to a wide variety of hardware, from supercomputers all the way down to personal computers, but its sheer size and complexity just isn't appropriate for many applications. so it's useful to explore alternative access strategies using far simpler software that's appropriate for accuracy expectations in the order of a second π§
this memo describes SNTP, which is a simplified access strategy for servers and clients using NTP as it is now specified and deployed on the Internet π there are no changes to the protocol or to implementations that are running now, or likely to be implemented in the near future. the access paradigm is identical to the UDP/Time Protocol, and honestly it should be easily possible to adapt a UDP/Time client implementation (say, for a personal computer) to operate using SNTP π SNTP is also designed to work in a dedicated server configuration that includes an integrated radio clock π‘ with careful design and control of the various latencies in the system (which is practical in a dedicated design), it is possible to deliver time accurate to the order of microseconds π€―β¨
SNTP should be used only at the extremities of the synchronization subnet, and that is strongly recommended π¨
so the vibe check: SNTP clients should operate only at the leaves (highest stratum) of the subnet, and only in configurations where no SNTP client is dependent on another SNTP client for synchronization π SNTP servers should operate only at the root (stratum 1) of the subnet, and only in configurations where no source of synchronization other than a reliable radio clock is available π» the full degree of reliability you'd normally expect from primary servers is only possible using the redundant sources, diverse subnet paths and crafted algorithms of a full NTP implementation π«Ά and this extends to the primary source of synchronization itself, in the form of multiple radio clocks and backup paths to other primary servers in case the radio clock fails or becomes faulty π¬ so the use of SNTP rather than NTP in primary servers should be carefully considered π
2. NTP Timestamp Format π°οΈ
SNTP uses the standard NTP timestamp format described in RFC-1305 and in previous versions of that document π following standard Internet practice, NTP data are specified as integer or fixed-point quantities, with bits numbered in big-endian fashion, starting from zero at the left (high-order) position π§ unless specified otherwise, all quantities are unsigned and may occupy the full field width, with an implied zero preceding bit zero π¦
NTP timestamps are cherished data and they're literally the main product of the protocol, so they got their own special format π an NTP timestamp is a 64-bit unsigned fixed-point number, in seconds relative to 0h on 1 January 1900. the integer part is in the first 32 bits and the fraction part is in the last 32 bits β¨ this makes multiple-precision arithmetic and conversion to Time Protocol representation (seconds) convenient, but it does complicate conversion to the ICMP Timestamp message representation (milliseconds) π the precision of this representation is about 200 picoseconds, which should be adequate for even the most exotic requirements π₯
now the plot twist πͺοΈ since some time in 1968, the most significant bit (bit 0 of the integer part) has been set, and the 64-bit field will overflow some time in 2036. if NTP or SNTP is still in use in 2036, some external means will be necessary to qualify time relative to 1900 and time relative to 2036 (and other multiples of 136 years) π timestamped data that needs that qualification will be so precious that appropriate means should be readily available π and there will exist a 200-picosecond interval (henceforth ignored) every 136 years when the 64-bit field will be zero, which by convention is interpreted as an invalid timestamp π
3. NTP Message Format β¨
okay bestie, so NTP and SNTP are both clients of UDP [POS83] π¦, and UDP is itself a client of IP [DAR81] π . the IP and UDP headers have their own specs, so we're not going over them here. what matters is the SNTP message format that comes right after those headers π. ngl it's basically the same as the NTP format in RFC-1305, except some of the data fields are "canned" (aka initialized to prespecified values) π. the NTP message data area sits right after the UDP header and looks like this:
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|LI | VN |Mode | Stratum | Poll | Precision |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Root Delay |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Root Dispersion |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Reference Identifier |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| Reference Timestamp (64) |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| Originate Timestamp (64) |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| Receive Timestamp (64) |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| Transmit Timestamp (64) |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| |
| Authenticator (optional) (96) |
| |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
as we'll see in the next section, most of these fields in SNTP get filled with prespecified data π§. still, for completeness, here's a quick recap of what each field does π
Leap Indicator (LI): this is a two-bit code that warns about an impending leap second to be inserted/deleted in the last minute of the current day β°. bit 0 and bit 1 are coded like this, respectively:
LI Value Meaning
-------------------------------------------------------
00 0 no warning
01 1 last minute has 61 seconds
10 2 last minute has 59 seconds)
11 3 alarm condition (clock not synchronized)
Version Number (VN): a three-bit integer for the NTP version number, currently 3 π₯
Mode: a three-bit integer for the mode, with values defined like so π
Mode Meaning
------------------------------------
0 reserved
1 symmetric active
2 symmetric passive
3 client
4 server
5 broadcast
6 reserved for NTP control message
7 reserved for private use
the use of this field gets discussed in the next section π«Ά
Stratum: an eight-bit integer for the stratum level of the local clock π
Stratum Meaning
----------------------------------------------
0 unspecified or unavailable
1 primary reference (e.g., radio clock)
2-15 secondary reference (via NTP or SNTP)
16-255 reserved
Poll Interval: an eight-bit signed integer for the maximum interval between successive messages, in seconds to the nearest power of two β. the values that normally show up here range from 6 to 10, inclusive π
Precision: an eight-bit signed integer for the precision of the local clock, in seconds to the nearest power of two π . normal values range from -6 for mains-frequency clocks to -18 for microsecond clocks found in some workstations π
Root Delay: a 32-bit signed fixed-point number for the total roundtrip delay to the primary reference source, in seconds, with the fraction point between bits 15 and 16 π¦. note that this variable can take on both positive and negative values, depending on the relative time and frequency errors π. normal values range from negative values of a few milliseconds to positive values of several hundred milliseconds β¨
Root Dispersion: a 32-bit unsigned fixed-point number for the maximum error relative to the primary reference source, in seconds, with the fraction point between bits 15 and 16 πΈ. normal values range from zero to several hundred milliseconds π«Ά
Reference Clock Identifier: a 32-bit code identifying the particular reference clock π₯. for stratum 0 (unspecified) or stratum 1 (primary reference), this is a four-octet, left-justified, zero-padded ASCII string π. while it's not enumerated as part of the NTP specification, these are representative ASCII identifiers π§
Stratum Code Meaning
------------------------------------------------------------
0 ascii generic time service other than NTP, such as ACTS
(Automated Computer Time Service), TIME (UDP/Time
Protocol), TSP (TSP Unix time protocol), DTSS
(Digital Time Synchronization Service), etc.
1 ATOM calibrated atomic clock
1 VLF VLF radio (OMEGA, etc.)
1 callsign Generic radio
1 LORC LORAN-C radionavigation system
1 GOES Geostationary Operational Environmental Satellite
1 GPS Global Positioning Service
2 address secondary reference (four-octet Internet address of
the NTP server)
Reference Timestamp: the local time at which the local clock was last set or corrected, in 64-bit timestamp format β°
Originate Timestamp: the local time at which the request departed the client for the server, in 64-bit timestamp format π¦
Receive Timestamp: the local time at which the request arrived at the server, in 64-bit timestamp format π
Transmit Timestamp: the local time at which the reply departed the server for the client, in 64-bit timestamp format π
Authenticator (optional): when the NTP authentication mechanism is implemented, this contains the authenticator information defined in Appendix C of RFC-1305 π. in SNTP this field is ignored for incoming messages and is not generated for outgoing messages π
4. SNTP Client Operations π
the model for an SNTP client operating with either an NTP or SNTP server is an RPC client with no persistent state π§. the flow is simple: the client initializes the SNTP message header, sends the message to the server, and strips the time of day from the reply π . for this, all of the message-header fields shown above are set to zero, except the first octet. in that octet, the Leap Indicator is set to zero (no warning) and the Mode to 3 (client) π«Ά
the Version Number must agree with the software version of the NTP or SNTP server π₯. however, NTP Version 3 (RFC-1305) servers will also accept Version 2 (RFC-1119) and Version 1 (RFC-1059) messages, while NTP Version 2 servers will also accept NTP Version 1 messages π. Version 0 (original NTP described in RFC-959) messages are no longer supported π. since there are NTP servers of all three versions operating in the Internet of today, it is recommended that the Version Number field be set to one β¨
the server reply includes all the fields described above, but in SNTP only the Transmit Timestamp has explicit meaning π. the integer part of this field contains the server time of day in the same format as the Time Protocol π. while the fraction part of this field will usually be valid, the accuracy achieved with the SNTP mode of access probably does not justify its use π
the following table is a summary of the SNTP client operations π. there are three recommended error checks shown in the table. in all NTP versions, if the Leap Indicator field is 3 or the Transmit Timestamp is zero (unsynchronized), the server has never synchronized or not synchronized to a valid timing source within the last 24 hours β°. if the Stratum field is 0 (unspecified or unavailable), the server has never synchronized, has lost reachability with all timing sources, or is synchronized by some protocol other than NTP π. whether to believe the transmit timestamp or not in this case is at the discretion of the client implementation π«Ά
Field Name Request Reply
-------------------------------------------------------------
Leap Indicator (LI) 0 if 3 (unsynchronized),
disregard
Version Number (VN) (see text) ignore
Mode 3 (client) ignore
Stratum 0 if 0 (unspecified),
disregard
Poll 0 ignore
Precision 0 ignore
Root Delay 0 ignore
Root Dispersion 0 ignore
Reference Identifier 0 ignore
Reference Timestamp 0 ignore
Originate Timestamp 0 ignore
Receive Timestamp 0 ignore
Transmit Timestamp 0 time of day (seconds only);
if 0 (unsynchronized),
disregard
Authenticator (not used) ignore
5. SNTP Server Operations β¨
okay so bestie, the vibe for an SNTP server is giving RPC server with no persistent state π . it basically just takes a request, ignores almost everything in it except the first octet, tweaks a few fields, and sends it right back π¦. no memory, no drama, just vibes.
ngl, an SNTP server doesn't run the full set of NTP algorithms, which are the ones that power the highest quality service π. so the move is that it's recommended that an SNTP server only runs alongside an outside time source, like a radio clock π». when it does that, it always operates at stratum 1 π. iconic, right?
5.1. First Octet
okay so the first octet is where the action is π. the Leap Indicator and Version Number fields get ignored β¨. messages with version numbers other than 1, 2, or 3 can be discarded if you want, that's optional bestie πΈ.
for primary servers hooked up to a working radio clock, the Leap Indicator gets set to zero and the Stratum gets set to one in the reply π. otherwise, those fields get set to 3 and zero, respectively π₯Ί. either way, the Version Number and Poll fields get copied intact into the reply header π«Ά. if the Mode field says 3 (client), it flips to 4 (server) in the reply π₯. if it's anything else, the Mode gets set to 2 (symmetric passive) π.
5.2. Stratum, Root Delay, Root Dispersion, and Reference Identifier
the Stratum field reflects the maximum reading error of the local clock π. for all practical cases, it's computed as the negative of the number of significant bits to the right of the decimal point in the NTP timestamp format π§.
the Root Delay and Root Dispersion fields are set to zero for a primary server π. optionally, the Root Dispersion can be set to a value matching the expected (constant) maximum error of the primary reference source β¨.
the Reference Identifier designates the primary reference source, as shown in the table above π . if that info is unspecified or unavailable, the field is set to zero π.
5.3. Timestamp Fields
the Reference Timestamp, Receive Timestamp and Transmit Timestamp fields all get set to the time of day at the server β. the Originate Timestamp gets copied unchanged from the request π. here's the whole breakdown:
Field Name Request Reply
----------------------------------------------------------
Leap Indicator (LI) ignore 0 (normal), 3
(unsynchronized)
Version Number (VN) ignore copied from request
Mode (see text) (see text)
Stratum ignore server stratum (1)
Poll ignore copied from request
Precision ignore server precision
Root Delay ignore 0
Root Dispersion ignore 0 (see text)
Reference Identifier ignore source identifier or 0
Reference Timestamp ignore time of day or 0
Originate Timestamp ignore copied from request
Receive Timestamp ignore time of day or 0
Transmit Timestamp ignore time of day or 0
Authenticator ignore (not used)
6. References π
okay the sources are next, bestie π
- [DAR81] Postel, J., "Internet Protocol - DARPA Internet Program Protocol Specification", RFC 791, DARPA, September 1981. πΈ
- [MIL92] Mills, D., "Network Time Protocol (Version 3) Specification, Implementation and Analysis", RFC 1305, University of Delaware, March 1992. π
- [POS80] Postel, J., "User Datagram Protocol", RFC 768, USC/Information Sciences Institute, August 1980. π¦
- [POS83] Postel, J., and K. Harrenstien, "Time Protocol", RFC 868, USC/Information Sciences Institute, SRI, May 1983. β¨
Security Considerations π₯
security issues are not discussed in this memo π so there's nothing more to say here, periodt π
Author's Address π
David L. Mills Electrical Engineering Department University of Delaware Newark, DE 19716
Phone: (302) 831-8247
EMail: mills@udel.edu π§
π¦ where this page comes from
- ietf: rfc1361 1992-08
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms