我已经完成ntpq
,然后运行associations
并收到以下内容:
ind assid status conf reach auth condition last_event cnt
===========================================================
1 12097 c811 yes none yes reject mobilize 1
从man ntp-decode
(Peer Status)的文档中,我了解到第一个数字表示Status
,第二个Select
,第三个Count
和第四个Code
。
我试图找到 Select Status
本手册的部分并找到以下内容:
The Select Field displays the current selection status. (The T Field in the following table gives the corresponding tally codes used in the ntpq peers dis-
play.) The values are coded as follows:
+-------------------------+---------------------------------------+--------------------------+-------------------------------------------------------------+
| Code | Message | T | Description |
+-------------------------+---------------------------------------+--------------------------+-------------------------------------------------------------+
| 0 | sel_reject | | discarded as not valid (TEST10-TEST13) |
+-------------------------+---------------------------------------+--------------------------+-------------------------------------------------------------+
| 1 | sel_falsetick | x | discarded by intersection algorithm |
+-------------------------+---------------------------------------+--------------------------+-------------------------------------------------------------+
| 2 | sel_excess | . | discarded by table overflow (not used) |
+-------------------------+---------------------------------------+--------------------------+-------------------------------------------------------------+
| 3 | sel_outlyer | - | discarded by the cluster algorithm |
+-------------------------+---------------------------------------+--------------------------+-------------------------------------------------------------+
| 4 | sel_candidate | + | included by the combine algorithm |
+-------------------------+---------------------------------------+--------------------------+-------------------------------------------------------------+
| 5 | sel_backup | # | backup (more than tos maxclock sources) |
+-------------------------+---------------------------------------+--------------------------+-------------------------------------------------------------+
| 6 | sel_sys.peer | * | system peer |
+-------------------------+---------------------------------------+--------------------------+-------------------------------------------------------------+
| 7 | sel_pps.peer | o | PPS peer (when the prefer peer is valid) |
+-------------------------+---------------------------------------+--------------------------+-------------------------------------------------------------+
那么,这个8
数字Select Status
是什么意思呢?
文档中对等状态代码的解释说,状态字段“为 5 位宽,并与 3 位宽的选择字段结合以创建对等状态字的第一个完整字节。” 选择字段是 3 位,所以它只能有 0-7 的值。第 2 位的 8 是状态字段中的最低有效位,而不是选择字段中的最高有效位。
所以
c8
表示“持久关联”、“启用身份验证”和“广播关联”(位 0、1 和 4,计算大端序)。您可以ntpq
使用readvar
命令为您解释这些字段。这是我笔记本电脑的一个示例,它被配置为[0-3].ubuntu.pool.ntp.org
在pool
模式下使用:请注意“conf”(永久配置关联)和“bcast”(广播关联),它们是状态字段的简短解释。(显然,当它具有 POOL 的 refid 时,广播不仅仅意味着广播。)