Ntp

NTP Peer 狀態的 Select Field 中的 8 表示什麼?

  • February 16, 2018

我已經完成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.orgpool模式下使用:

# ntpq -n
ntpq> peers
    remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
0.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
1.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
...
ntpq> assoc

ind assid status  conf reach auth condition  last_event cnt
===========================================================
 1 32962  8811   yes  none  none    reject    mobilize  1
 2 32963  8811   yes  none  none    reject    mobilize  1
...
ntpq> readvar 32962
associd=32962 status=8811 conf, bcast, sel_reject, 1 event, mobilize,
srcadr=0.0.0.0, srcport=0, srchost="0.ubuntu.pool.ntp.org",
dstadr=0.0.0.0, dstport=0, leap=11, stratum=16, precision=-24,
rootdelay=0.000, rootdisp=0.000, refid=POOL,
reftime=00000000.00000000  Thu, Feb  7 2036 16:28:16.000,
...

請注意“conf”(永久配置關聯)和“bcast”(廣播關聯),它們是狀態欄位的簡短解釋。(顯然,當它具有 POOL 的 refid 時,廣播不僅僅意味著廣播。)

引用自:https://serverfault.com/questions/891765