玩转华为ENSP模拟器系列 | 配置带验证的单播NTP服务器/客户端示例

素材来源:华为路由器配置指南

一边学习一边整理试验笔记,并与大家分享,侵权即删,谢谢支持!

附上汇总贴:玩转华为ENSP模拟器系列 | 合集_COCOgsta的博客-CSDN博客_ensp实验大全


目标

客户端必须先使能NTP验证,然后再指定NTP服务器地址,并同时指定发给服务器的验证密钥。如果认证失败,将不会同步。客户端和服务器端都需要进行完整的配置,才能验证通过。

组网需求

DeviceA作为NTP单播服务器,其本地时钟作为NTP主时钟,层数为2。

DeviceB作为NTP客户端,同步远端服务器DeviceA的时钟。

DeviceC和DeviceD作为NTP客户端,把DeviceB作为自己的NTP服务器。

在所有路由器启用NTP验证。

配置思路

  • 配置DeviceA作为服务器,提供主时钟。
  • 配置DeviceB作为NTP客户端,同步DeviceA的时钟。
  • 配置DeviceC、DeviceD作为NTP客户端,同步DeviceB的时钟。
  • 在DeviceA、DeviceB、DeviceC和DeviceD上配置NTP验证。

操作步骤

  1. 配置各设备间路由可达(略)。
  2. 配置各路由器的IP地址并路由可达。具体配置过程略。
  3. 在DeviceA配置NTP主时钟并启动验证功能

在DeviceA上指定使用自己的本地时钟作为参考时钟,层数为2。

DeviceA:
ntp-service refclock-master 2

在DeviceA上使能NTP验证功能、配置验证密钥并声明该密钥可信。

ntp-service authentication-keyid 42 authentication-mode md5 cipher %^%#$c;xPHzg=46Xs{TeP>:MQ;fsBhwC(AlHE}&!LHR&%^%#
ntp-service authentication enable

说明:注意服务器端与客户端必须配置相同的验证密钥。

  1. 在DeviceB指定NTP服务器并启动验证功能

在DeviceB上使能NTP验证功能、配置验证密钥并声明该密钥可信。

DeviceB:
ntp-service authentication enable
ntp-service authentication-keyid 42 authentication-mode md5 cipher %^%#cjHXQ}[JdI|+2+G0-6\%4(q4P68X&5<<^q@[xPV.%^%#
ntp-service reliable authentication-keyid 42

DeviceB指定DeviceA为NTP服务器,并使用已配置的验证密钥。

DeviceB:
ntp-service unicast-server 2.2.2.2 authentication-keyid 42
  1. 在DeviceC指定NTP服务器并启动验证功能

DeviceC指定DeviceB作为自己的NTP服务器。

DeviceC:
ntp-service authentication enable
ntp-service authentication-keyid 42 authentication-mode md5 cipher %^%#i+`UI~k8^&|wmS~^ExcA]/~#)T&j#7SV8K$IM>C=%^%#
ntp-service reliable authentication-keyid 42
ntp-service unicast-server 10.0.0.1 authentication-keyid 42
  1. 在DeviceD指定NTP服务器并启动验证功能

DeviceD指定DeviceB作为自己的NTP服务器。

DeviceD:
ntp-service authentication enable
ntp-service authentication-keyid 42 authentication-mode md5 cipher %^%#zR1U("=07.s.u~>Fj7h#}wEe"w4#{F0,X#ND71hT%^%#
ntp-service reliable authentication-keyid 42
ntp-service unicast-server 10.0.0.1 authentication-keyid 42
  1. 验证配置结果

完成上述配置后,DeviceB可以同步到DeviceA的时间。

查看DeviceB的NTP状态,可以看到时钟状态为“synchronized”,即,已经完成同步。时钟的层数为3,比服务器DeviceA低1级。

[~DeviceB]dis ntp-service status
 clock status: synchronized
 clock stratum: 3
 reference clock ID: 2.2.2.2 
 nominal frequency: 100.0000 Hz
 actual frequency: 100.0000 Hz
 clock precision: 2^16
 clock offset: -0.0025 ms
 root delay: 0.00 ms
 root dispersion: 3.31 ms
 peer dispersion: 11.41 ms
 reference time: 11:15:21.011 UTC Oct 30 2019(E163EF49.02E47DC3)
 synchronization state: clock set but frequency not determined
[~DeviceB] 

完成上述配置后,DeviceC可以同步到DeviceB的时间。

查看DeviceC的NTP状态,可以看到时钟状态为“synchronized”,即,已经完成同步。时钟的层数为4,比服务器DeviceB低1级。

[~DeviceC]dis ntp-service stat
 clock status: synchronized
 clock stratum: 4
 reference clock ID: 10.0.0.1 
 nominal frequency: 100.0000 Hz
 actual frequency: 100.0000 Hz
 clock precision: 2^18
 clock offset: 6.1890 ms
 root delay: 12.38 ms
 root dispersion: 2.67 ms
 peer dispersion: 2.79 ms
 reference time: 11:15:12.500 UTC Oct 30 2019(E163EF40.80000000)
 synchronization state: clock set but frequency not determined
[~DeviceC]

查看DeviceD的NTP状态,可以看到时钟状态为“synchronized”,即,已经完成同步。时钟的层数为4,比服务器DeviceB低1级。

[~DeviceD]dis ntp-service stat
 clock status: synchronized
 clock stratum: 4
 reference clock ID: 10.0.0.1 
 nominal frequency: 100.0000 Hz
 actual frequency: 100.0000 Hz
 clock precision: 2^18
 clock offset: -4.0495 ms
 root delay: 21.78 ms
 root dispersion: 3.37 ms
 peer dispersion: 3.37 ms
 reference time: 11:15:50.500 UTC Oct 30 2019(E163EF66.80000000)
 synchronization state: clock set but frequency not determined
[~DeviceD]

查看DeviceA的NTP状态。

[~DeviceA]dis ntp-service status
 clock status: synchronized
 clock stratum: 2
 reference clock ID: LOCAL(0) 
 nominal frequency: 100.0000 Hz
 actual frequency: 100.0000 Hz
 clock precision: 2^18
 clock offset: 0.0000 ms
 root delay: 0.00 ms
 root dispersion: 11.40 ms
 peer dispersion: 10.00 ms
 reference time: 11:16:09.361 UTC Oct 30 2019(E163EF79.5C988094)
 synchronization state: clock synchronized
[~DeviceA]

 

  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值