跳到主要内容

5. SNTP 服务器操作

与 NTP 或 SNTP 客户端一起运行的 SNTP 服务器模型是一个无持久状态的 RPC 服务器. SNTP 服务器忽略除第一个八位组外的所有头部字段, 修改某些字段并将报文返回给发送方. 由于 SNTP 服务器通常不实现旨在支持最高质量服务的完整 NTP 算法集, 建议 SNTP 服务器仅在与外部同步源 (例如无线电时钟) 配合时运行. 在这种情况下, 服务器始终运行在 stratum 1.

第一个八位组解释如下. Leap Indicator 和 Version Number 字段被忽略. 可选地, 版本号不为 1, 2 或 3 的报文可以被丢弃. 对于连接到正常工作的无线电时钟的主服务器, Leap Indicator 字段在应答中被置零, Stratum 字段被置为 1; 否则, 这些字段分别被置为 3 和 0. 无论何种情况, Version Number 和 Poll 字段都被原样复制到应答报文头部. 如果 Mode 字段被置为 3 (client), 则在应答中改为 4 (server); 否则该字段被置为 2 (symmetric passive).

Stratum 字段被设置为反映本地时钟的最大读数误差. 对于所有实际情况, 它计算为 NTP 时间戳格式中小数点右侧有效位数的负值. Root Delay 和 Root Dispersion

字段对于主服务器被置为零; 可选地, Root Dispersion 可以设置为对应于主参考源预期 (恒定) 最大预期误差的值. Reference Identifier 被设置为指明主参考源, 如上面表格所示. 如果此信息未指定或不可用, 则该字段被置为零.

时间戳字段设置如下. Reference Timestamp, Receive Timestamp 和 Transmit Timestamp 字段被设置为服务器处的当日时间. Originate Timestamp 字段从请求中不加修改地复制. 下表演示了这些动作.

   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)