华为NTP配置教程(二)

10、配置NTP KOD

KOD(Kiss-o’-Death)是NTPv4提出的一种全新的访问控制技术,主要用于服务器向客户端上提供状态报告和接入控制等信息。在服务器上使能KOD功能后,服务器会根据系统的运行状态向客户端发送DENY Kiss和RATE Kiss码。

当客户端接收到DENY Kiss码,客户端将断开与服务器的所有连接,并停止向服务器发送报文。当客户端接收到RATE Kiss码,客户端将立即缩短与该服务器的轮询时间间隔,且以后每次接收到RATE Kiss码,轮询时间间隔都会进一步缩短。

KOD支持单播客户端/服务器模式、对等体模式和多播模式。KOD仅在NTPv4上有效。

1、使能KOD功能

[Huawei]ntp-service kod-enable

2、对入方向NTP报文速率的控制

[Huawei]ntp-service access limited ?

  INTEGER<2000-2999>  Apply basic ACL

  ipv6                NTP IPv6 service

11、配置NTP认证

在一些对安全性要求较高的网络中,运行NTP协议时需要启用验证功能。通过客户端和服务器端的密码验证,可以保证客户端只与通过验证的设备进行同步,从而提高网络安全性。

在配置NTP认证功能时,应注意以下原则:

必须先使能NTP认证功能,否则不会进行验证。客户端和服务器端均需要配置NTP认证功能。否则,NTP认证功能不生效。如果使能了NTP认证功能,在客户端配置一个可信的密钥。在服务器端和客户端上配置的密钥必须相同。需要进行时间同步的设备必须声明其密钥可信,否则无法通过验证。在NTP对等体模式下,主动对等体相当于客户端,被动对等体相当于服务器端。

1、使能NTP认证功能

[Huawei]ntp-service authentication enable

2、配置NTP认证密钥

[Huawei]ntp-service authentication-keyid ?

  INTEGER<1-4294967295>  Authentication key identifier value

[Huawei]ntp-service authentication-keyid wwru ?

  authentication-mode  Specify an authentication mode

[Huawei]ntp-service authentication-keyid 023 authentication-mode ?

  md5  MD5 authentication

[Huawei]ntp-service authentication-keyid 023 authentication-mode md5 ?

  STRING<1-16>/<24>  Plain text/Encrypted text

3、声明可信的密钥

[Huawei]ntp-service reliable authentication-keyid ?

  INTEGER<1-4294967295>  Authentication key identifier value

12、查看NTP运行状态信息

<HUAWEI> display ntp-service status

clock status: synchronized

clock stratum: 2

reference clock ID: LOCAL(0)

nominal frequency: 60.0002 Hz

actual frequency: 60.0002 Hz

clock precision: 2^18

clock offset: 0.0000 ms

root delay: 0.00 ms

root dispersion: 0.00 ms

peer dispersion: 10.00 ms

reference time: 15:51:36.259 UTC Apr 25 2012(C6179088.426490A3)

synchronization state: spike (clock will be set in 1010 secs)
clock status表示时钟状态。synchronized:本地时钟被同步到一个NTP服务器或时钟源。unsynchronized:本地时钟未被同步到任何一个NTP服务器。
clock stratum表示本地时钟所处的NTP层数。
reference clock ID表示时钟源。当本地时钟已被同步到一个远程NTP服务器或某个时钟源时,指示远程NTP服务器的地址或时钟源的标识。如果采用本地时钟作为参考时钟,将显示Local。如果时钟状态是unsynchronized,将显示None。
nominal frequency表示本地时钟的标称频率。
actual frequency表示本地时钟的实际频率。
clock precision表示本地时钟的精度。
clock offset表示本地时钟相对参考时钟的offset。
root delay表示本地时钟相对主参考时钟总的系统延迟。
root dispersion表示本地时钟相对主参考时钟的系统离差。
peer dispersion表示本地时钟和远程NTP对等体时钟的离差。
reference time表示参考时间戳。
synchronization state表示本地时钟的同步状态:clock not set: 表示时钟未更新。frequency set by configuration: 表示时钟频率由NTP配置而设定。clock set: 表示时钟已设定。clock set but frequency not determined: 表示时钟已设定,但时钟频率没有确定。clock synchronized: 表示时钟已同步。spike (clock will be set in XXX secs): 表示系统检测到时钟服务器与客户端之间的时间差超过128毫秒,且时钟会在XXX秒内重新生效。

13、查看本地设备的NTP会话信息。

<HUAWEI> display ntp-service sessions

 clock source: 224.0.1.1                                                        

 clock stratum: 1                                                             

 clock status: configured, insane, valid, unsynced                             

 reference clock ID: LOCAL(0)                                                   

 reach: 0                                                                      

 current poll: 64                                                              

 now: 9                                                                         

 offset: 0.0000 ms                                  

 delay: 0.00 ms                                                 

 disper: 0.00 ms
clock source时钟源地址。
clock stratum时钟源的层数。时钟层数决定了时钟的准确度,取值范围为1~16,层数为1的时钟准确度最高,准确度从1到16依次递减,层数为16的时钟处于未同步状态,不能作为参考时钟。
clock status指定时钟状态。其中:configured:表示该会话是配置命令所建立的master:表示该会话对应的时钟源是当前系统的主时钟源selected:表示该会话对应的时钟源通过了时钟选择算法candidate:表示该会话对应的时钟源为候选时钟源sane:表示该会话对应的时钟源通过健全验证insane:表示该会话对应的时钟源未通过健全验证valid:表示该会话对应的时钟源是有效的(通过验证、处于同步状态、层数有效、根延时/离差未越界等)invalid:表示该会话对应的时钟源是无效的unsynced:表示该会话对应的时钟源未同步或层数非法
reference clock ID当本地系统已被同步到一个远程NTP服务器或某个时钟源时,指示远程服务器的地址或时钟源的标识。
reach时钟源的可达性计数,0表示时钟源不可达。
current pollNTP报文轮询间隔,即两个连续NTP报文之间的时间间隔,单位为秒。
now最后一次同步到现在的时间间隔。
offset表示相对上一级时钟源的时差。
delay表示相对上一级时钟源的延时。
disper表示相对于上一级时钟源的离差。

14、查看本地设备NTP会话的详细信息。

<HUAWEI> display ntp-service sessions verbose

 clock source: 172.11.12.1                                                       

 clock stratum: 1                                                             

 clock status: configured, insane, valid, unsynced                             

 reference clock ID: LOCAL(0)                                                   

 local mode: client, local poll: 64, current poll: 64                           

 peer mode: server, peer poll: 64, now: 21                                              

 offset: -3.2385 ms,delay: 26.97 ms,  disper: 14.85 ms                            

 root delay: 0.00 ms, root disper: 10.94 ms                                    

 reach: 255, sync dist: 0.058, sync state: 4                                  

 precision: 2^18, version: 3, peer interface: wildcard                         

 reftime: 10:01:38.546 UTC Sep 5 2005(C6C69602.8C00DA1A)                       

 orgtime: 10:01:43.463 UTC Sep 5 2005(C6C69607.76ACC921)                       

 rcvtime: 10:01:43.480 UTC Sep 5 2005(C6C69607.7AF4ADBC)                       

 xmttime: 10:01:43.452 UTC Sep 5 2005(C6C69607.73F1E8E6)                      

 filter delay :  0.03   0.02   0.03   0.02   0.02   0.02   0.04   0.02         

 filter offset:  0.00  -0.01   0.00   0.01   0.00   0.00   0.00   0.00         

 filter disper:  0.03   0.02   0.00   0.11   0.09   0.08   0.06   0.05

 reference clock status: normal
clock source时钟源地址。
clock stratum本地系统所处的NTP层数。
clock status指定时钟状态。其中:configured:表示该会话是配置命令所建立的master:表示该会话对应的时钟源是当前系统的主时钟源selected:表示该会话对应的时钟源通过了时钟选择算法candidate:表示该会话对应的时钟源为候选时钟源sane:表示该会话对应的时钟源通过健全验证insane:表示该会话对应的时钟源未通过健全验证valid:表示该会话对应的时钟源是有效的(通过验证、处于同步状态、层数有效、根延时/离差未越界等)invalid:表示该会话对应的时钟源是无效的unsynced:表示该会话对应的时钟源未同步或层数非法
reference clock ID当本地系统已被同步到一个远程NTP服务器或某个时钟源时,指示远程服务器的地址或时钟源的标识。当该服务器处于某一VPN内时,将显示该VPN实例的名称。
local mode本地系统模式。
peer mode对端系统模式。
local poll本地选举模式。
peer poll对端选举模式。
offset表示相对上一级时钟源的时差。
delay表示相对上一级时钟源的延时。
disper表示相对于上一级时钟源的离差。
root delay本地到主参考时钟总的系统延迟。缺省值是0。
root disper本地相对主参考时钟的系统离差。缺省值是0。
reach可达性标记。表明了相对于时钟源的可达性。
sync dist表示相对上一级时钟源的同步距离,此参数评价描述时钟源,NTP选择同步距离最小的时钟源。
sync state同步的状态:0:时钟没有被更新过1:从配置信息中得到频率信息2:时钟被设定3:时钟被设定,但是还没有决定频率4:时钟被同步5:发现错误
precision对端时钟精度。
versionNTP版本。
peer interface对端接口。
reftime参考时间戳。
orgtime最后发送NTP报文时间。
rcvtime最后收到NTP报文时间。
xmttime最后转发NTP报文时间。
filter delay最后接收的8个报文的过滤延迟。
filter offset最后接收的8个报文的过滤偏差。
filter disper最后接收的8个报文的过滤误差。
reference clock status表示参考时钟的状态,包括:normal: 表示对端时钟可达。abnormal: 表示对端时钟不可达。

15、查看从本地设备到参考时钟源的路径

<HUAWEI> display ntp-service trace

server 127.0.0.1,stratum 5, offset 0.024099 s, synch distance 0.06337

server 192.168.1.2,stratum 4, offset 0.028786 s, synch distance 0.04575

server 192.168.2.2,stratum 3, offset 0.035199 s, synch distance 0.03075

server 192.168.10.1,stratum 2, offset 0.039855 s, synch distance 0.01096

refid 127.127.1.0
serverNTP服务器的IP地址。
stratum该NTP服务器的层数。
offset相对上一级时钟源的时差。
synch distance相对上一级时钟源的同步距离,此参数评价描述时钟源,NTP选择同步距离最小的时钟源。
refid参考时钟源。

16、查看NTP报文的统计信息

<HUAWEI> display ntp-service statistics packet

NTP IPv4 Packet Statistical Information                                       

 ---------------------------------------                                       

 Sent                                  :          100                            

    Send failures                      :          10                            

 Received                              :          1000                            

    Processed                          :          800                            

    Dropped                            :          200                            

       Validity test failures          :          50                            

          Authentication failures      :          20                            

       Invalid packets                 :          50                            

       Access denied                   :          50                            

       Rate-limited                    :          0

       Processing delay                :          50                            

       Interface disabled              :          0                             

       Max dynamic association reached :          0                            

       Others                          :          0

Last 2 packets drop reasons:

  [2011-11-24 12:19:26-08:00] Global drop: NTP service disabled for interface.

  [2011-11-24 12:20:30-08:00] Global drop: NTP service disabled for interface.
NTP IPv4 Packet Statistical Information表示IPv4 NTP包的统计信息。
Sent表示发送的包的数目。
Send failures表示发送包的失败次数。
Received表示接收到的包的数目。
Processed表示处理的包的数目。
Dropped表示丢弃的包的数目。
Validity test failures表示由于NTP合法性检验不通过而丢弃的包的数目。
Authentication failures表示由于认证失败而丢弃的包的数目。
Invalid packets表示由于包无效而丢弃的包的数目。
Access denied表示由于访问控制权限拒绝接入而丢弃的包的数目。
Rate-limited表示由于速度限制而丢弃的包的数目。
Processing delay表示由于处理延迟而丢弃的包的数目。
Interface disabled表示由于接口失效而丢弃的包的数目。
Max dynamic association reached表示由于超过动态连接的最大数目而丢弃的包的数目。
Others表示由于其它原因而丢弃的包的数目。
Last 2 packets drop reasons表示最近n次丢包的原因,n最大取10。

17、查看最新的10条时钟不同步原

<HUAWEI> display ntp-service event clock-unsync

 1. Clock source   :  10.1.1.1(vrf1)

    Session type   :  client, configured

    Unsync reason  :  Peer reachability lost

    Unsync time    :  2012-07-30 12:24:44+00:00

 2. Clock source   :  10.2.1.1(vrf2)

    Session type   :  bdcast client (Interface: Eth0/0/0), dynamic

    Unsync reason  :  Authentication failure

    Unsync time    :  2011-06-15 11:24:44+00:0
Clock source显示服务器时钟的IP地址。
Session type显示服务器时钟的会话类型。
Unsync reason显示时钟不同步的原因。
Unsync time显示时钟不同步时间。
© 版权声明
THE END
喜欢就支持一下吧!
点赞114 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容