配置带验证的单播NTP服务器/客户端模式示例
  

এ塔铃独语别黄昏এ 2215

{{ttag.title}}
组网图形

  • 组网需求
  • 配置思路
  • 操作步骤
  • 配置文件
组网需求
图1所示的组网中,SwitchA、SwitchB和SwitchC相连。SwitchA的时间已经同步到权威时钟(卫星定位系统)。
用户要求由SwitchB和SwitchC时间同步到SwitchA以保证计费业务的准确性。
配置思路
配置带验证的单播服务器/客户端模式来满足客户对局域网时间同步的需求。配置思路如下:
  • 选择SwitchA作为主时间服务器。
  • SwitchA与SwitchB和SwitchC之间采用单播NTP服务器/客户端模式实现时钟同步。SwitchA作为服务器,SwitchB和SwitchC作为客户端。
  • 为了加强NTP时钟同步的安全性,因此使能NTP认证功能。

                                                                                                                                                                                                                                                                                    
在单播服务器/客户端模式下配置NTP认证时,必须首先在客户端使能NTP认证,然后再指定NTP服务器地址,并同时指定发给服务器的验证密钥。否则将不进行验证,直接同步。
操作步骤
  • 配置SwitchA、SwitchB和SwitchC地址,保证SwitchA,SwitchB和SwitchC路由可达

    # 在SwitchA上配置IP地址和路由。
    <HUAWEI> system-view
    [HUAWEI] sysname SwitchA
    [SwitchA] vlan 100
    [SwitchA-vlan100] quit
    [SwitchA] interface vlanif 100
    [SwitchA-Vlanif100] ip address 10.1.1.1 24
    [SwitchA-Vlanif100] quit
    [SwitchA] interface gigabitethernet 1/0/1
    [SwitchA-GigabitEthernet1/0/1] port link-type trunk
    [SwitchA-GigabitEthernet1/0/1] port trunk allow-pass vlan 100
    [SwitchA-GigabitEthernet1/0/1] quit
    [SwitchA] ip route-static 10.1.2.0 24 10.1.1.2
    # 在SwitchB上配置IP地址。
    <HUAWEI> system-view
    [HUAWEI] sysname SwitchB
    [SwitchB] vlan 100
    [SwitchB-vlan100] quit
    [SwitchB] interface vlanif 100
    [SwitchB-Vlanif100] ip address 10.1.1.2 24
    [SwitchB-Vlanif100] quit
    [SwitchB] vlan 10
    [SwitchB-vlan10] quit
    [SwitchB] interface vlanif 10
    [SwitchB-Vlanif10] ip address 10.1.2.1 24
    [SwitchB-Vlanif10] quit
    [SwitchB] interface gigabitethernet 1/0/1
    [SwitchB-GigabitEthernet1/0/1] port link-type trunk
    [SwitchB-GigabitEthernet1/0/1] port trunk allow-pass vlan 100
    [SwitchB-GigabitEthernet1/0/1] quit
    [SwitchB] interface gigabitethernet 1/0/2
    [SwitchB-GigabitEthernet1/0/2] port link-type trunk
    [SwitchB-GigabitEthernet1/0/2] port trunk allow-pass vlan 10
    [SwitchB-GigabitEthernet1/0/2] quit
    # 在SwitchC上配置IP地址和路由。
    <HUAWEI> system-view
    [HUAWEI] sysname SwitchC
    [SwitchC] vlan 10
    [SwitchC-vlan10] quit
    [SwitchC] interface vlanif 10
    [SwitchC-Vlanif10] ip address 10.1.2.2 24
    [SwitchC-Vlanif10] quit
    [SwitchC] interface gigabitethernet 1/0/1
    [SwitchC-GigabitEthernet1/0/1] port link-type trunk
    [SwitchC-GigabitEthernet1/0/1] port trunk allow-pass vlan 10
    [SwitchC-GigabitEthernet1/0/1] quit
    [SwitchC] ip route-static 10.1.1.0 24 10.1.2.1
  • 在SwitchA上配置NTP主时钟并启动NTP认证功能

    # 在SwitchA上指定使用自己的本地时钟作为主时钟,层数为2。
    [SwitchA] ntp-service refclock-master 2
    # 使能NTP认证功能、配置验证密钥并声明该密钥可信。
    [SwitchA] ntp-service authentication enable
    [SwitchA] ntp-service authentication-keyid 42 authentication-mode hmac-sha256 cipher Hello123
    [SwitchA] ntp-service reliable authentication-keyid 42
    # SwitchA作为服务器需要使能NTP服务器功能。
    [SwitchA] undo ntp-service server disable
  • 在SwitchB上使能NTP认证功能并配置验证密钥并声明该密钥可信,指定SwitchA作为NTP服务器

    [SwitchB] ntp-service authentication enable
    [SwitchB] ntp-service authentication-keyid 42 authentication-mode hmac-sha256 cipher Hello123
    [SwitchB] ntp-service reliable authentication-keyid 42
    [SwitchB] ntp-service unicast-server 10.1.1.1 authentication-keyid 42
  • 在SwitchC上使能NTP认证功能并配置验证密钥并声明该密钥可信,指定SwitchA作为NTP服务器

    [SwitchC] ntp-service authentication enable
    [SwitchC] ntp-service authentication-keyid 42 authentication-mode hmac-sha256 cipher Hello123
    [SwitchC] ntp-service reliable authentication-keyid 42
    [SwitchC] ntp-service unicast-server 10.1.1.1 authentication-keyid 42
  • 验证配置结果

# 查看SwitchA的NTP状态。
[SwitchA] display 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^17            
clock offset: 0.0000 ms         
root delay: 0.00 ms               
root dispersion: 10.96 ms        
peer dispersion: 10.00 ms            
reference time: 08:54:40.010 UTC Nov 22 2013(D6399696.029E9079)
synchronization state: clock synchronized
# 查看SwitchB的NTP状态,可以看到时钟状态为“synchronized”,即,已经完成同步。时钟的层数为3,比服务器SwitchA低1级。
[SwitchB] display ntp-service status
clock status: synchronized
clock stratum: 3
reference clock ID: 10.1.1.1
nominal frequency: 100.0000 Hz        
actual frequency: 100.0000 Hz        
clock precision: 2^18        
clock offset: -1.6796 ms      
root delay: 2.71 ms         
root dispersion: 21.87 ms           
peer dispersion: 10.94 ms         
reference time: 08:54:44.160 UTC Nov 22 2013(D6399A54.29247CB7)   
synchronization state: clock synchronized
# 查看SwitchC的NTP状态,可以看到时钟状态为“synchronized”,即,已经完成同步。时钟的层数为3,比服务器SwitchA低1级。
[SwitchC] display ntp-service status
clock status: synchronized
clock stratum: 3
reference clock ID: 10.1.1.1
nominal frequency: 100.0000 Hz        
actual frequency: 100.0000 Hz        
clock precision: 2^18        
clock offset: 13.6320 ms      
root delay: 2.71 ms         
root dispersion: 2.76 ms           
peer dispersion: 10.94 ms         
reference time: 08:57:44.160 UTC Nov 22 2013(D6399E4E.052B2BFD)   
synchronization state: clock synchronized

打赏鼓励作者,期待更多好文!

打赏
12人已打赏

飞翔的苹果 发表于 2022-10-12 08:05
  
感谢分享,有助于工资和学习!!!
头像被屏蔽
新手078326 发表于 2022-10-16 15:31
  
提示: 作者被禁止或删除 内容自动屏蔽
暗夜星空 发表于 2022-10-17 09:22
  
坚持每日学习打卡
奔走的公牛 发表于 2022-10-17 09:43
  
楼主分享的经验很实用,具有典型性,希望有更多这样的干货供我们学习参考,非常感谢!感谢分享,有助于工资和学习!!!
头像被屏蔽
新手741261 发表于 2022-10-17 19:46
  
提示: 作者被禁止或删除 内容自动屏蔽
头像被屏蔽
新手031815 发表于 2022-10-17 19:52
  
提示: 作者被禁止或删除 内容自动屏蔽
头像被屏蔽
新手612152 发表于 2022-10-17 19:57
  
提示: 作者被禁止或删除 内容自动屏蔽
头像被屏蔽
司马缸砸了光 发表于 2022-10-17 20:01
  
提示: 作者被禁止或删除 内容自动屏蔽
白鹭先生 发表于 2022-10-17 20:27
  
学习了,感谢分享。。。。。。。。。
发表新帖
热门标签
全部标签>
每日一问
新版本体验
功能体验
纪元平台
产品连连看
安全效果
标准化排查
高手请过招
GIF动图学习
【 社区to talk】
信服课堂视频
社区新周刊
安装部署配置
畅聊IT
技术笔记
秒懂零信任
平台使用
每周精选
故障笔记
全能先锋系列
答题自测
专家问答
技术圆桌
在线直播
MVP
网络基础知识
升级
安全攻防
上网策略
测试报告
日志审计
问题分析处理
流量管理
每日一记
运维工具
用户认证
原创分享
解决方案
sangfor周刊
VPN 对接
项目案例
SANGFOR资讯
专家分享
技术顾问
信服故事
SDP百科
功能咨询
终端接入
授权
设备维护
资源访问
地址转换
虚拟机
存储
迁移
排障笔记本
产品预警公告
玩转零信任
S豆商城资讯
技术争霸赛
「智能机器人」
追光者计划
2023技术争霸赛专题
卧龙计划
华北区拉练
天逸直播
以战代练
技术晨报
技术盲盒
山东区技术晨报
文档捉虫
齐鲁TV
华北区交付直播
2024年技术争霸赛
北京区每日一练
场景专题
排障那些事
西北区每日一问
升级&主动服务
高频问题集锦
POC测试案例
云化安全能力
专家说
热门活动
产品动态
行业实践
产品解析
关键解决方案

本版达人

feeling

本周分享达人

新手29676...

本周提问达人