• 产品与解决方案
  • 行业解决方案
  • 服务
  • 支持
  • 合作伙伴
  • 新华三人才研学中心
  • 关于我们

02-典型配置举例

60-H3C MSR系列路由器 NTP典型配置举例

本章节下载  (248.93 KB)

docurl=/cn/Service/Document_Software/Document_Center/Home/Routers/00-Public/Configure/Typical_Configuration_Example/H3C_MSR_R6728-10884/99/202305/1843915_30005_0.htm

60-H3C MSR系列路由器 NTP典型配置举例

H3C MSR系列路由器

NTP配置举例

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Copyright © 2022-2023 新华三技术有限公司 版权所有,保留一切权利。

非经本公司书面许可,任何单位和个人不得擅自摘抄、复制本文档内容的部分或全部,并不得以任何形式传播。

除新华三技术有限公司的商标外,本手册中出现的其它公司的商标、产品标识及商品名称,由各自权利人拥有。

本文档中的信息可能变动,恕不另行通知。



1  简介

本章介绍了与NTP有关的各种典型配置举例。

2  配置前提

本文档适用于使用Comware V7软件版本的MSR系列路由器,如果使用过程中与产品实际情况有差异,请参考相关产品手册,或以设备实际情况为准。

本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。

本文档假设您已了解NTP特性。

3  IPv6 NTP服务器/客户端模式典型配置举例

3.1  组网需求

图1所示,IPv6网络中有一台时间服务器Device A,为网络中的其它设备提供精确的时间服务,为保证网络中所有设备的时间保持一致,现要求配置IPv6 NTP服务器/客户端模式,使所有设备能从时间服务器Device A上获得时钟同步。

图1 配置IPv6 NTP服务器/客户端模式组网图

 

3.2  使用版本

本举例是在R6728版本上进行配置和验证的。

3.3  配置步骤

3.3.1  Device A的配置

# 配置接口GigabitEthernet1/0/1的IP地址。

<DeviceA> system-view

[DeviceA] interface gigabitethernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] ipv6 address 3000::34 64

[DeviceA-GigabitEthernet1/0/1] quit

# 开启NTP功能。

[DeviceA] ntp-service enable

# 设置本地时钟作为参考时钟,层数为2。

[DeviceA] ntp-service refclock-master 2

3.3.2  Device B的配置

# 配置接口的IP地址,配置步骤这里省略。

# 开启NTP功能。

<DeviceB> system-view

[DeviceB] ntp-service enable

# 设置NTP Server为Device B的时间服务器。

[DeviceB] ntp-service ipv6 unicast-server 3000::34

3.3.3  Device C的配置

# 配置接口的IP地址,配置步骤这里省略。

# 开启NTP功能。

<DeviceC> system-view

[DeviceC] ntp-service enable

# 设置NTP Server为Device C的时间服务器。

[DeviceC] ntp-service ipv6 unicast-server 3000::34

3.4  验证配置

# 以上配置完成后,Device B和Device C向Device A进行时间同步。以Device B为例,查看NTP的运行状态。

[DeviceB] display ntp-service status

 Clock status: synchronized

 Clock stratum: 3

 System peer: 3000::34

 Local mode: client

 Reference clock ID: 95.197.17.40

 Leap indicator: 00

 Clock jitter: 0.003479 s

 Stability: 0.000 pps

 Clock precision: 2^-18

 Root delay: 1.95313 ms

 Root dispersion: 28.38135 ms

 Reference time: d5ed8cd5.577006ea  Wed, Sep 25 2013 16:24:53.341

此时Device B已经与Device A同步,层数比Device A的层数大1,为3。

# 查看Device B的NTP会话信息,可以看到Device B与Device A建立了连接。

[DeviceB] display ntp-service ipv6 sessions

     source          reference       stra reach poll  now offset  delay disper

********************************************************************************

[12345] 3000::34     127.127.1.0        2   127   64   67 -0.123 0.3356 5.3405

Notes: 1 source(master), 2 source(peer), 3 selected, 4 candidate, 5 configured.

 Total sessions: 1                                                             

3.5  配置文件

·     设备Device A:

#

interface GigabitEthernet1/0/1

 ipv6 address 3000::34/64

#

 ntp-service enable

 ntp-service refclock-master 2

#

·     设备Device B:

#

interface GigabitEthernet1/0/1

 ipv6 address 3000::35/64

#

 ntp-service enable

 ntp-service ipv6 unicast-server 3000::34

#

·     设备Device C:

#

interface GigabitEthernet1/0/1

 ipv6 address 3000::36/64

#

 ntp-service enable

 ntp-service ipv6 unicast-server 3000::34

#

4  IPv6 NTP组播模式典型配置举例

4.1  组网需求

图2所示,IPv6网络中有一台时间服务器Device C,网络中设备较多,而且这些设备分布在不同网段中,为了便于管理,现要求配置IPv6 NTP组播模式,使网络中所有设备的时间保持一致。

图2 配置IPv6 NTP组播模式组网图

4.2  使用版本

本举例是在R6728版本上进行配置和验证的。

4.3  配置步骤

4.3.1  Device C的配置

# 配置路由协议,以保证各设备间能够路由可达,配置步骤这里省略。

# 开启NTP功能。

<DeviceC> system-view

[DeviceC] ntp-service enable

# 设置本地时钟作为参考时钟,层数为2。

[DeviceC] ntp-service refclock-master 2

# 配置接口GigabitEthernet1/0/1的IP地址。

[DeviceC] interface gigabitethernet 1/0/1

[DeviceC-GigabitEthernet1/0/1] ipv6 address 3000::2 64

# 设置Device C为IPv6组播服务器,从GigabitEthernet1/0/1向组播地址FF24::1发送NTP组播报文。

[DeviceC-GigabitEthernet1/0/1] ntp-service ipv6 multicast-server ff24::1

[DeviceC-GigabitEthernet1/0/1] quit

4.3.2  Device D的配置

# 配置路由协议,以及接口的IP地址,以保证各设备间能够路由可达,配置步骤这里省略。

# 开启NTP功能。

<DeviceD> system-view

[DeviceD] ntp-service enable

# 设置Device D为组播客户端,从GigabitEthernet1/0/1监听组播报文。

[DeviceD] interface gigabitethernet 1/0/1

[DeviceD-GigabitEthernet1/0/1] ntp-service ipv6 multicast-client ff24::1

[DeviceD-GigabitEthernet1/0/1] quit

4.3.3  Device B的配置

# 配置路由协议,以及接口的IP地址,以保证各设备间能够路由可达,配置步骤这里省略。

# 开启NTP功能。

<DeviceB> system-view

[DeviceB] ntp-service enable

# 设置Device B为组播客户端,从GigabitEthernet1/0/1监听组播报文。

[DeviceB] interface gigabitethernet 1/0/2

[DeviceB-GigabitEthernet1/0/1] ntp-service ipv6 multicast-client ff24::1

[DeviceB-GigabitEthernet1/0/1] quit

由于Device A与Device C不在同一网段,所以Device B上需要配置组播功能,否则Device A收不到Device C发出的组播报文。

# 配置组播功能。

[DeviceB] ipv6 multicast routing

[DeviceB-mrib6] quit

[DeviceB] interface gigabitethernet 1/0/2

[DeviceB-GigabitEthernet1/0/1] ipv6 pim dm

[DeviceB-GigabitEthernet1/0/1] quit

[DeviceB] interface gigabitethernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] mld enable

[DeviceB-GigabitEthernet1/0/1] mld static-group ff24::1

[DeviceB-GigabitEthernet1/0/1] quit

4.3.4  Device A的配置

# 配置路由协议,以及接口的IP地址,以保证各设备间能够路由可达,配置步骤这里省略。

# 开启NTP功能。

<DeviceA> system-view

[DeviceA] ntp-service enable

# 设置Device A为组播客户端,从GigabitEthernet1/0/1监听组播报文。

[DeviceA] interface gigabitethernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] ntp-service ipv6 multicast-client ff24::1

[DeviceA-GigabitEthernet1/0/1] quit

4.4  验证配置

# Device A为例,查看NTP的运行状态。

[DeviceA] display ntp-service status

 Clock status: synchronized

 Clock stratum: 3

 System peer: 3000::2

 Local mode: bclient

 Reference clock ID: 165.84.121.65

 Leap indicator: 00

 Clock jitter: 0.000061 s

 Stability: 0.000 pps

 Clock precision: 2^-18

 Root delay: 1.69373 ms

 Root dispersion: 1950.18005 ms

 Reference time: d5ee9b15.2f3a684d  Thu, Sep 26 2013 11:37:57.184

此时Device A已经与Device C同步,层数比Device C的层数大1,为3。

4.5  配置文件

·     设备Device A:

#

 ntp-service enable

#

interface GigabitEthernet1/0/1

 ipv6 address 2000::1/64

 ntp-service ipv6 multicast-client ff24::1

#

·     设备Device B:

#

ntp-service enable

#

ipv6 multicast routing

#

mld-snooping

#

interface GigabitEthernet1/0/1

 ipv6 address 3000::1/64

 ipv6 pim dm

 ntp-service ipv6 multicast-client ff24::1

#

interface GigabitEthernet1/0/1

 ipv6 address 2000::2/64

 mld enable

 mld static-group ff24::1

#

·     设备Device C:

#

 ntp-service enable

ntp-service refclock-master 2

#

interface GigabitEthernet1/0/1

 ipv6 address 3000::2/64

 ntp-service ipv6 multicast-server ff24::1

#

·     设备Device D:

#

 ntp-service enable

#

interface GigabitEthernet1/0/1

 ipv6 address 3000::3/64

 ntp-service ipv6 multicast-client ff24::1

#

5  带身份验证的NTP广播模式典型配置举例

5.1  组网需求

图3所示,网络中设备较多,所有设备都位于同一个网段(3.0.1.0/24)中,为了使网络中所有设备的时间保持一致,现要求:

·     配置NTP广播模式。

·     NTP广播客户端与NTP广播服务器进行时间同步前,必须先进行身份验证,以保证时钟同步的安全性,防止攻击者将自己伪装成为一个时钟服务器而对客户时钟发起攻击。

图3 带身份验证的NTP广播模式典型配置举例组网图

 

5.2  使用版本

本举例是在R6728版本上进行配置和验证的。

5.3  配置步骤

5.3.1  Device A的配置

# 开启NTP功能。

<DeviceA> system-view

[DeviceA] ntp-service enable

# 设置本地时钟作为参考时钟,层数为2。

[DeviceA] ntp-service refclock-master 2

# 配置NTP验证,密钥编号为88,密钥为123456。

[DeviceA] ntp-service authentication enable

[DeviceA] ntp-service authentication-keyid 88 authentication-mode md5 simple 123456

[DeviceA] ntp-service reliable authentication-keyid 88

# 设置Device A为NTP广播服务器并指定密钥编号。

[DeviceA] interface gigabitethernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] ip address 3.0.1.30 24

[DeviceA-GigabitEthernet1/0/1] ntp-service broadcast-server authentication-keyid 88

[DeviceA-GigabitEthernet1/0/1] quit

5.3.2  Device B的配置

# 开启NTP功能。

<DeviceB> system-view

[DeviceB] ntp-service enable

# 配置NTP验证,密钥编号与密钥与Device A完全相同。

[DeviceB] ntp-service authentication enable

[DeviceB] ntp-service authentication-keyid 88 authentication-mode md5 simple 123456

[DeviceB] ntp-service reliable authentication-keyid 88

# 设置Device B为NTP广播客户端。

[DeviceB] interface gigabitethernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] ntp-service broadcast-client

[DeviceB-GigabitEthernet1/0/1] ip address 3.0.1.31 24

[DeviceB-GigabitEthernet1/0/1] quit

以上配置将Device B配置为从GigabitEthernet1/0/1监听广播报文,接收到Device A发出的广播报文后与自己的时钟进行同步。

说明

除IP地址外,Device C与DeviceB的其他配置完全相同,此处不再赘述。

 

5.4  验证配置

# Device B为例,查看NTP的运行状态。

[DeviceA] display ntp-service status

 Clock status: synchronized

 Clock stratum: 3

 System peer: 3.0.1.30

 Local mode: bclient

 Reference clock ID: 3.0.1.30

 Leap indicator: 00

 Clock jitter: 0.000092 s

 Stability: 0.000 pps

 Clock precision: 2^-18

 Root delay: 2.42615 ms

 Root dispersion: 1950.98877 ms

 Reference time: d5eed631.2f498d71  Thu, Sep 26 2013 15:50:09.184

此时Device B已经与Device A同步,层数比Device A的层数大1,为3。

5.5  配置文件

·     设备Device A:

#

interface GigabitEthernet1/0/1

 ip address 3.0.1.30 255.255.255.0

 ntp-service broadcast-server authentication-keyid 88

#

 ntp-service enable

 ntp-service authentication enable

 ntp-service authentication-keyid 88 authentication-mode md5 cipher $c$3$iJudDKiqCVO+gOaG53

63/fz4M3dQvHo2Fw==

 ntp-service reliable authentication-keyid 88

 ntp-service refclock-master 2

#

·     设备Device B、Device C:

#

interface GigabitEthernet1/0/1

 ip address 3.0.1.31 255.255.255.0

 ntp-service broadcast-client

#

 ntp-service enable

 ntp-service authentication enable

 ntp-service authentication-keyid 88 authentication-mode md5 cipher $c$3$pU6KvpS80MadhM2zM

CCSR07HX4qEbJhHvQ==

 ntp-service reliable authentication-keyid 88

#

6  相关资料

·     《H3C MSR 系列路由器 命令参考(V7)》中的“网络管理和监控命令参考

·     《H3C MSR 系列路由器 配置指导(V7)》中的“网络管理和监控配置指导”

不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!

新华三官网
联系我们