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

11-网络管理和监控配置举例

目录

02-H3C_NTP典型配置举例

本章节下载 02-H3C_NTP典型配置举例  (329.18 KB)

docurl=/cn/Service/Document_Software/Document_Center/Switches/Catalog/S12500/S12500-S/Configure/Typical_Configuration_Example/H3C_S12500-S_CE-R7577P04-6W100/11/201904/1173276_30005_0.htm

02-H3C_NTP典型配置举例

H3C NTP典型配置举例

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

资料版本:6W100-20190330

产品版本:Release 7577P04

 

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

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

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

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

 


目  录

1 简介

2 配置前提

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

3.1 组网需求

3.2 使用版本

3.3 配置步骤

3.3.1 Switch A的配置

3.3.2 Switch B的配置

3.3.3 Switch C的配置

3.4 验证配置

3.5 配置文件

4 NTP广播模式典型配置举例

4.1 组网需求

4.2 使用版本

4.3 配置步骤

4.3.1 Switch C的配置

4.3.2 Switch A的配置

4.4 验证配置

4.5 配置文件

5 NTP组播模式典型配置举例

5.1 组网需求

5.2 使用版本

5.3 配置步骤

5.3.1 Switch C的配置

5.3.2 Switch D的配置

5.3.3 Switch B的配置

5.3.4 Switch A的配置

5.4 验证配置

5.5 配置文件

6 带身份验证的NTP客户端/服务器模式典型配置举例

6.1 组网需求

6.2 使用版本

6.3 配置步骤

6.3.1 Switch A的配置

6.3.2 Switch B的配置

6.3.3 Switch C的配置

6.4 验证配置

6.5 配置文件

7 SNTP典型配置举例

7.1 组网需求

7.2 使用版本

7.3 配置步骤

7.3.1 Switch A的配置

7.3.2 Switch B的配置

7.3.3 Switch C的配置

7.4 验证配置

7.5 配置文件

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

8.1 组网需求

8.2 使用版本

8.3 配置步骤

8.3.1 Switch A的配置

8.3.2 Switch B的配置

8.3.3 Switch C的配置

8.4 验证配置

8.5 配置文件

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

9.1 组网需求

9.2 使用版本

9.3 配置步骤

9.3.1 Switch C的配置

9.3.2 Switch D的配置

9.3.3 Switch B的配置

9.3.4 Switch A的配置

9.4 验证配置

9.5 配置文件

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

10.1 组网需求

10.2 使用版本

10.3 配置步骤

10.3.1 Switch C的配置

10.3.2 Switch A的配置

10.4 验证配置

10.5 配置文件

11 相关资料

 


1  简介

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

2  配置前提

本文档不严格与具体软、硬件版本对应,如果使用过程中与产品实际情况有差异,请参考相关产品手册,或以设备实际情况为准。

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

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

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

3.1  组网需求

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

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

 

3.2  使用版本

本举例是在S12500S-CMW710-R7577P01版本上进行配置和验证的。

3.3  配置步骤

3.3.1  Switch A的配置

# 配置接口Vlan-interface2的IP地址。

<SwitchA> system-view

[SwitchA] interface Vlan-interface 2

[SwitchA-Vlan-interface2] ip address 1.0.1.11 24

[SwitchA-Vlan-interface2] quit

# 开启NTP功能。

[SwitchA] ntp-service enable

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

[SwitchA] ntp-service refclock-master 2

3.3.2  Switch B的配置

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

# 开启NTP功能。

<SwitchB> system-view

[SwitchB] ntp-service enable

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

[SwitchB] ntp-service unicast-server 1.0.1.11

3.3.3  Switch C的配置

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

# 开启NTP功能。

<SwitchC> system-view

[SwitchC] ntp-service enable

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

[SwitchC] ntp-service unicast-server 1.0.1.11

3.4  验证配置

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

[SwitchB] display ntp-service status

 Clock status: synchronized

 Clock stratum: 3

 System peer: 1.0.1.11

 Local mode: client

 Reference clock ID: 1.0.1.11

 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

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

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

[SwitchB] display ntp-service sessions

        source          reference       stra reach poll  now offset  delay disper

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

[12345]1.0.1.11        127.127.1.0        2   255   64   38 -10.22 1.9531 3.3416

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

 Total sessions: 1

3.5  配置文件

·              Switch A上的配置

#

interface Vlan-interface2

 ip address 1.0.1.11 255.255.255.0

#

 ntp-service enable

 ntp-service refclock-master 2

#

·              Switch B上的配置

#

interface Vlan-interface2

 ip address 1.0.1.12 255.255.255.0

#

 ntp-service enable

 ntp-service unicast-server 1.0.1.11

#

·              Switch C上的配置

#

interface Vlan-interface2

 ip address 1.0.1.13 255.255.255.0

#

 ntp-service enable

 ntp-service unicast-server 1.0.1.11

#

4  NTP广播模式典型配置举例

4.1  组网需求

图2所示,网络中设备较多,所有设备都位于同一个网段(3.0.1.0/24)中,为了便于管理,现要求通过配置NTP广播模式,使网络中的设备拥有一致,统一的时间。

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

 

4.2  使用版本

本举例是在S12500S-CMW710-R7577P01版本上进行配置和验证的。

4.3  配置步骤

4.3.1  Switch C的配置

# 开启NTP功能。

<SwitchC> system-view

[SwitchC] ntp-service enable

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

[SwitchC] ntp-service refclock-master 2

# 配置接口Vlan-interface2的IP地址。

[SwitchC] interface Vlan-interface 2

[SwitchC-Vlan-interface2] ip address 3.0.1.31 24

# 配置Switch C为广播服务器,从Vlan-interface2向网络中发送NTP广播报文。

[SwitchC-Vlan-interface2] ntp-service broadcast-server

4.3.2  Switch A的配置

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

# 开启NTP功能。

<SwitchA> system-view

[SwitchA] ntp-service enable

# 设置为广播客户端,从Vlan-interface2监听广播消息。

[SwitchA-Vlan-interface2] ntp-service broadcast-client

Switch B、Switch D和Switch E的配置与Switch A相同,此处不再赘述。

 

4.4  验证配置

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

[SwitchA-Vlan-interface2] display ntp-service status

 Clock status: synchronized

 Clock stratum: 3

 System peer: 3.0.1.31

 Local mode: bclient

 Reference clock ID: 3.0.1.31

 Leap indicator: 00

 Clock jitter: 0.000061 s

 Stability: 0.000 pps

 Clock precision: 2^-18

 Root delay: 0.00000 ms

 Root dispersion: 7951.43127 ms

 Reference time: d5ee8d88.2faabed0  Thu, Sep 26 2013 10:40:08.186

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

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

[SwitchA-Vlan-interface2] display ntp-service sessions

      source          reference       stra reach poll  now offset  delay disper

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

 [1234]3.0.1.31        127.127.1.0        2   254   64   82 -2.190 0.0000 7937.5

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

 Total sessions: 1

4.5  配置文件

·              设备Switch C

#

interface Vlan-interface2

 ip address 3.0.1.31 255.255.255.0

 ntp-service broadcast-server

#

 ntp-service enable

 ntp-service refclock-master 2

#

·              设备Switch A

#

interface Vlan-interface2

 ip address 3.0.1.33 255.255.255.0

 ntp-service broadcast-client

#

 ntp-service enable

#

·              设备Switch B

#

interface Vlan-interface2

 ip address 3.0.1.30 255.255.255.0

 ntp-service broadcast-client

#

 ntp-service enable

#

·              设备Switch D

#

interface Vlan-interface2

 ip address 3.0.1.32 255.255.255.0

 ntp-service broadcast-client

#

 ntp-service enable

#

·              设备Switch E

#

interface Vlan-interface2

 ip address 3.0.1.34 255.255.255.0

 ntp-service broadcast-client

#

 ntp-service enable

#

5  NTP组播模式典型配置举例

5.1  组网需求

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

图3 配置NTP组播模式组网图

 

5.2  使用版本

本举例是在S12500S-CMW710-R7577P01版本上进行配置和验证的。

5.3  配置步骤

5.3.1  Switch C的配置

# 开启NTP功能。

<SwitchC> system-view

[SwitchC] ntp-service enable

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

[SwitchC] ntp-service refclock-master 2

# 配置接口Vlan-interface2的IP地址。

[SwitchC] interface Vlan-interface 2

[SwitchC-Vlan-interface2] ip address 3.0.1.31 24

# 设置Switch C为组播服务器,从VLAN接口2发送组播报文。

[SwitchC-Vlan-interface2] ntp-service multicast-server

5.3.2  Switch D的配置

# 开启NTP功能。

<SwitchD> system-view

[SwitchD] ntp-service enable

# 配置接口Vlan-interface2的IP地址。

[SwitchD] interface Vlan-interface 2

[SwitchD-Vlan-interface2] ip address 3.0.1.32 24

# 设置Switch D为组播客户端,从VLAN接口2监听组播报文。

[SwitchD-Vlan-interface2] ntp-service multicast-client

5.3.3  Switch B的配置

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

# 开启NTP功能。

<SwitchB> system-view

[SwitchB] ntp-service enable

# 设置Switch B为组播客户端,从VLAN接口2监听组播报文。

[SwitchB-Vlan-interface2] ntp-service multicast-client

[SwitchB-Vlan-interface2] quit

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

# 配置组播功能。

[SwitchB] multicast routing

[SwitchB] interface vlan-interface 2

[SwitchB-Vlan-interface2] pim dm

[SwitchB-Vlan-interface2] quit

[SwitchB] vlan 3

[SwitchB-vlan3] port Ten-GigabitEthernet 1/0/1

[SwitchB-vlan3] quit

[SwitchB] interface vlan-interface 3

[SwitchB-Vlan-interface3] ip address 1.0.1.10 24

[SwitchB-Vlan-interface3] igmp enable

[SwitchB-Vlan-interface3] igmp static-group 224.0.1.1

[SwitchB-Vlan-interface3] quit

[SwitchB] igmp-snooping

[SwitchB-igmp-snooping] quit

[SwitchB] interface Ten-GigabitEthernet 1/0/1

[SwitchB-Ten-GigabitEthernet1/0/1] igmp-snooping static-group 224.0.1.1 vlan 3

5.3.4  Switch A的配置

# 开启NTP功能。

<SwitchA> system-view

[SwitchA] ntp-service enable

# 配置接口Vlan-interface3的IP地址。

[SwitchA] interface Vlan-interface 3

[SwitchA-Vlan-interface3] ip address 1.0.1.11 24

# 设置Switch A为组播客户端,从VLAN接口3监听组播报文。

[SwitchA-Vlan-interface3] ntp-service multicast-client

5.4  验证配置

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

[SwitchA-Vlan-interface3] display ntp-service status

 Clock status: synchronized

 Clock stratum: 3

 System peer: 3.0.1.31

 Local mode: bclient

 Reference clock ID: 3.0.1.31

 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

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

5.5  配置文件

·              设备Switch A

#

 ntp-service enable

#

interface Vlan-interface3

 ip address 1.0.1.11 255.255.255.0

 ntp-service multicast-client

#

·              设备Switch B

#

ntp-service enable

#

multicast routing

#

igmp-snooping

#

interface Vlan-interface2

 ip address 3.0.1.30 255.255.255.0

 pim dm

 ntp-service multicast-client

#

interface Vlan-interface3

 ip address 1.0.1.10 255.255.255.0

 igmp enable

 igmp static-group 224.0.1.1

#

interface Ten-GigabitEthernet1/0/1

 port access vlan 3

 igmp-snooping static-group 224.0.1.1 vlan 3

#

·              设备Switch C

#

 ntp-service enable

ntp-service refclock-master 2

#

interface Vlan-interface2

 ip address 3.0.1.31 255.255.255.0

 ntp-service multicast-server

#

·              设备Switch D

#

 ntp-service enable

#

interface Vlan-interface2

 ip address 3.0.1.32 255.255.255.0

 ntp-service multicast-client

#

6  带身份验证的NTP客户端/服务器模式典型配置举例

6.1  组网需求

网络中有一台时间服务器Switch A,为网络中的其它设备提供精确的时间服务,为保证网络中的所有设备能保持一致、统一的时钟,现要求:

·              配置NTP服务器/客户端模式,使所有设备能从时间服务器Switch A上获得时钟同步。

·              设备在获得时钟同步前,需要通过Switch A的NTP验证。

图4 带身份验证的NTP客户端/服务器模式典型配置举例组网图

 

6.2  使用版本

本举例是在S12500S-CMW710-R7577P01版本上进行配置和验证的。

6.3  配置步骤

6.3.1  Switch A的配置

# 配置接口Vlan-interface2的IP地址。

<SwitchA> system-view

[SwitchA] interface Vlan-interface 2

[SwitchA-Vlan-interface2] ip address 1.0.1.11 24

# 开启NTP服务。

[SwitchA] ntp-service enable

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

[SwitchA] ntp-service refclock-master 2

# 在Switch A上启动NTP验证功能。

[SwitchA] ntp-service authentication enable

# 创建编号为42的NTP验证密钥,密钥值为aNiceKey,以明文形式输入。

[SwitchA] ntp-service authentication-keyid 42 authentication-mode md5 simple aNiceKey

# 配置编号为42的密钥为可信密钥。

[SwitchA] ntp-service reliable authentication-keyid 42

6.3.2  Switch B的配置

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

# 开启NTP服务。

<SwitchB> system-view

[SwitchB] ntp-service enable

# 在Switch B上启动NTP验证功能。

[SwitchB] ntp-service authentication enable

# 创建编号为42的NTP验证密钥,密钥值为aNiceKey,以明文形式输入。

[SwitchB] ntp-service authentication-keyid 42 authentication-mode md5 simple aNiceKey

# 配置编号为42的密钥为可信密钥。

[SwitchB] ntp-service reliable authentication-keyid 42

# 设置Switch A为Switch B的NTP服务器,并将该服务器与编号为42的密钥关联。

[SwitchB] ntp-service unicast-server 1.0.1.11 authentication-keyid 42

以上配置将使得Switch B与Switch A进行时间同步。

6.3.3  Switch C的配置

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

# 开启NTP服务。

<SwitchC> system-view

[SwitchC] ntp-service enable

# 在Switch C上启动NTP验证功能。

[SwitchC] ntp-service authentication enable

# 创建编号为42的NTP验证密钥,密钥值为aNiceKey,以明文形式输入。

[SwitchC] ntp-service authentication-keyid 42 authentication-mode md5 simple aNiceKey

# 配置编号为42的密钥为可信密钥。

[SwitchC] ntp-service reliable authentication-keyid 42

# 设置Switch A为Switch C的NTP服务器,并将该服务器与编号为42的密钥关联。

[SwitchC] ntp-service unicast-server 1.0.1.11 authentication-keyid 42

以上配置将使得Switch C与Switch A进行时间同步。

6.4  验证配置

# 完成上述配置后,Switch B、SwitchC可以与Switch A的时间同步。同步后查看Switch B的状态。可以看出,Switch B已经与Switch A同步,层数比Switch A的层数大1,为3。

[SwitchB] display ntp-service status

 Clock status: synchronized

 Clock stratum: 3

 System peer: 1.0.1.11

 Local mode: client

 Reference clock ID: 1.0.1.11

 Leap indicator: 00

 Clock jitter: 0.005096 s

 Stability: 0.000 pps

 Clock precision: 2^-18

 Root delay: 0.00655 ms

 Root dispersion: 1.15869 ms

 Reference time: d0c62687.ab1bba7d  Mon, Sep 30 2013 16:06:26.764

# 查看Switch B的NTP服务的所有IPv4会话信息,可以看到Switch B与Switch A建立了会话。

[SwitchB] display ntp-service sessions

       source          reference       stra reach poll  now offset  delay disper

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

 [1245]1.0.1.11        127.127.1.0        2     1   64  519   -0.0 0.0065    0.0

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

 Total sessions : 1

6.5  配置文件

·              设备Switch A

#

interface Vlan-interface2

 ip address 1.0.1.11 255.255.255.0

#

 ntp-service enable

 ntp-service authentication enable

 ntp-service authentication-keyid 42 authentication-mode md5 cipher $c$3$4j3SKCgQWBK3Un41B9U0JXzJX9i7IuNoSqi

 ntp-service reliable authentication-keyid 42

 ntp-service refclock-master 2

#

·              设备Switch B

#

interface Vlan-interface2

 ip address 1.0.1.12 255.255.255.0

#

 ntp-service enable

 ntp-service authentication enable

 ntp-service authentication-keyid 42 authentication-mode md5 cipher $c$3$22eIc8l796cpudZqiaAZ2SLzIfrgzFTVYn8X

 ntp-service reliable authentication-keyid 42

 ntp-service unicast-server 1.0.1.11 authentication-keyid 42

#

·              设备Switch C

#

interface Vlan-interface2

 ip address 1.0.1.13 255.255.255.0

#

 ntp-service enable

 ntp-service authentication enable

 ntp-service authentication-keyid 42 authentication-mode md5 cipher $c$3$XJzVmJ1TJbWyYAXpPXxF7JiEOZag8CehibM8

 ntp-service reliable authentication-keyid 42

 ntp-service unicast-server 1.0.1.11 authentication-keyid 42

#

7  SNTP典型配置举例

7.1  组网需求

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

图5 SNTP典型配置举例组网图

 

7.2  使用版本

本举例是在S12500S-CMW710-R7577P01版本上进行配置和验证的。

7.3  配置步骤

7.3.1  Switch A的配置

# 配置接口Vlan-interface2的IP地址。

<SwitchA> system-view

[SwitchA] interface Vlan-interface 2

[SwitchA-Vlan-interface2] ip address 1.0.1.11 24

# 开启NTP功能。

[SwitchA] ntp-service enable

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

[SwitchA] ntp-service refclock-master 2

7.3.2  Switch B的配置

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

# 开启SNTP功能。

<SwitchB> system-view

[SwitchB] sntp enable

# 设置Switch A为Switch B的时间服务器。

[SwitchB] sntp unicast-server 1.0.1.11

7.3.3  Switch C的配置

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

# 开启SNTP功能。

<SwitchC> system-view

[SwitchC] sntp enable

# 设置Switch A为Switch C的时间服务器。

[SwitchC] sntp unicast-server 1.0.1.11

7.4  验证配置

# 以上配置完成后,Switch B和Switch C向Switch A进行时间同步。以Switch B为例,查看Switch B的NTP会话信息,可以看到Switch B与Switch A建立了连接。

[SwitchB] display sntp sessions

SNTP server     Stratum   Version    Last receive time

1.0.1.11        2         4          Thu, Sep 26 2013 17:25:09.121 (Synced)

7.5  配置文件

·              Switch A上的配置

#

interface Vlan-interface2

 ip address 1.0.1.11 255.255.255.0

#

 ntp-service enable

 ntp-service refclock-master 2

#

·              Switch B上的配置

#

interface Vlan-interface2

 ip address 1.0.1.12 255.255.255.0

#

 sntp enable

 sntp unicast-server 1.0.1.11

#

·              Switch C上的配置

#

interface Vlan-interface2

 ip address 1.0.1.13 255.255.255.0

#

 sntp enable

 sntp unicast-server 1.0.1.11

#

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

8.1  组网需求

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

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

 

8.2  使用版本

本举例是在S12500S-CMW710-R7577P01版本上进行配置和验证的。

8.3  配置步骤

8.3.1  Switch A的配置

# 配置接口Vlan-interface2的IP地址。

<SwitchA> system-view

[SwitchA] interface vlan-interface 2

[SwitchA-Vlan-interface2] ipv6 address 3000::34 64

[SwitchA-Vlan-interface2] quit

# 开启NTP功能。

[SwitchA] ntp-service enable

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

[SwitchA] ntp-service refclock-master 2

8.3.2  Switch B的配置

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

# 开启NTP功能。

<SwitchB> system-view

[SwitchB] ntp-service enable

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

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

8.3.3  Switch C的配置

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

# 开启NTP功能。

<SwitchC> system-view

[SwitchC] ntp-service enable

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

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

8.4  验证配置

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

[SwitchB] 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

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

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

[SwitchB] display ntp-service ipv6 sessions

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

 

 Source: [12345] 3000::34

 Reference: 127.127.1.0           Clock stratum: 2

 Reachabilities: 3                Poll interval: 64

 Last receive time: 62            Offset: 0.1272

 Roundtrip delay: 1.8158          Dispersion: 188.47

 

 Total sessions: 1

8.5  配置文件

·              设备Switch A

#

interface Vlan-interface2

 ipv6 address 3000::34/64

#

 ntp-service enable

 ntp-service refclock-master 2

#

·              设备Switch B

#

interface Vlan-interface2

 ipv6 address 3000::35/64

#

 ntp-service enable

 ntp-service ipv6 unicast-server 3000::34

#

·              设备Switch C

#

interface Vlan-interface2

 ipv6 address 3000::36/64

#

 ntp-service enable

 ntp-service ipv6 unicast-server 3000::34

#

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

9.1  组网需求

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

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

 

9.2  使用版本

本举例是在S12500S-CMW710-R7577P01版本上进行配置和验证的。

9.3  配置步骤

9.3.1  Switch C的配置

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

# 开启NTP功能。

<SwitchC> system-view

[SwitchC] ntp-service enable

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

[SwitchC] ntp-service refclock-master 2

# 配置接口Vlan-interface2的IP地址。

[SwitchC] interface Vlan-interface 2

[SwitchC-Vlan-interface2] ipv6 address 3000::2 64

# 设置Switch C为IPv6组播服务器,从VLAN接口2向组播地址FF24::1发送NTP组播报文。

[SwitchC-Vlan-interface2] ntp-service ipv6 multicast-server ff24::1

[SwitchC-Vlan-interface2] quit

9.3.2  Switch D的配置

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

# 开启NTP功能。

<SwitchD> system-view

[SwitchD] ntp-service enable

# 设置Switch D为组播客户端,从VLAN接口2监听组播报文。

[SwitchD-Vlan-interface2] ntp-service ipv6 multicast-client ff24::1

[SwitchD-Vlan-interface2] quit

9.3.3  Switch B的配置

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

# 开启NTP功能。

<SwitchB> system-view

[SwitchB] ntp-service enable

# 设置Switch B为组播客户端,从VLAN接口2监听组播报文。

[SwitchB-Vlan-interface2] ntp-service ipv6 multicast-client ff24::1

[SwitchB-Vlan-interface2] quit

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

# 配置组播功能。

[SwitchB] ipv6 multicast routing

[SwitchB-mrib6] quit

[SwitchB] interface vlan-interface 2

[SwitchB-Vlan-interface2] ipv6 pim dm

[SwitchB-Vlan-interface2] quit

[SwitchB] vlan 3

[SwitchB-vlan3] port Ten-GigabitEthernet 1/0/1

[SwitchB-vlan3] quit

[SwitchB] interface vlan-interface 3

[SwitchB-Vlan-interface3] mld enable

[SwitchB-Vlan-interface3] mld static-group ff24::1

[SwitchB-Vlan-interface3] quit

[SwitchB] mld-snooping

[SwitchB-mld-snooping] quit

[SwitchB] interface Ten-GigabitEthernet 1/0/1

[SwitchB-Ten-GigabitEthernet1/0/1] mld-snooping static-group ff24::1 vlan 3

[SwitchB-mld-snooping] quit

9.3.4  Switch A的配置

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

# 开启NTP功能。

<SwitchA> system-view

[SwitchA] ntp-service enable

# 设置Switch A为组播客户端,从VLAN接口3监听组播报文。

[SwitchA-Vlan-interface3] ntp-service ipv6 multicast-client ff24::1

[SwitchA-Vlan-interface3] quit

9.4  验证配置

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

[SwitchA] 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

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

9.5  配置文件

·              设备Switch A

#

 ntp-service enable

#

interface Vlan-interface3

 ipv6 address 2000::1/64

 ntp-service ipv6 multicast-client ff24::1

#

·              设备Switch B

#

ntp-service enable

#

ipv6 multicast routing

#

mld-snooping

#

interface Vlan-interface2

 ipv6 address 3000::1/64

 ipv6 pim dm

 ntp-service ipv6 multicast-client ff24::1

#

interface Vlan-interface3

 ipv6 address 2000::2/64

 mld enable

 mld static-group ff24::1

#

interface Ten-GigabitEthernet1/0/1

 port access vlan 3

 mld-snooping static-group ff24::1 vlan 3

#

·              设备Switch C

#

 ntp-service enable

ntp-service refclock-master 2

#

interface Vlan-interface2

 ipv6 address 3000::2/64

 ntp-service ipv6 multicast-server ff24::1

#

·              设备Switch D

#

 ntp-service enable

#

interface Vlan-interface2

 ipv6 address 3000::3/64

 ntp-service ipv6 multicast-client ff24::1

#

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

10.1  组网需求

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

·              配置NTP广播模式。

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

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

 

10.2  使用版本

本举例是在S12500S-CMW710-R7577P01版本上进行配置和验证的。

10.3  配置步骤

10.3.1  Switch C的配置

# 开启NTP功能。

<SwitchC> system-view

[SwitchC] ntp-service enable

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

[SwitchC] ntp-service refclock-master 2

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

[SwitchC] ntp-service authentication enable

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

[SwitchC] ntp-service reliable authentication-keyid 88

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

[SwitchC] interface vlan-interface 2

[SwitchC-Vlan-interface2] ip address 3.0.1.31 24

[SwitchC-Vlan-interface2] ntp-service broadcast-server authentication-keyid 88

[SwitchC-Vlan-interface2] quit

10.3.2  Switch A的配置

# 开启NTP功能。

<SwitchA> system-view

[SwitchA] ntp-service enable

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

[SwitchA] ntp-service authentication enable

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

[SwitchA] ntp-service reliable authentication-keyid 88

# 设置Switch A为NTP广播客户端。

[SwitchA] interface vlan-interface 2

[SwitchA-Vlan-interface2] ntp-service broadcast-client

[SwitchA-Vlan-interface2] ip address 3.0.1.33 24

[SwitchA-Vlan-interface2] quit

以上配置将Switch A配置为从VLAN接口2监听广播报文,接收到Switch C发出的广播报文后与自己的时钟进行同步。

说明

除IP地址外,Switch B、Switch D和Switch E与SwitchA的其他配置完全相同,此处不再赘述。

 

10.4  验证配置

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

[SwitchA] display ntp-service status

 Clock status: synchronized

 Clock stratum: 3

 System peer: 3.0.1.31

 Local mode: bclient

 Reference clock ID: 3.0.1.31

 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

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

10.5  配置文件

·              设备Switch A、Switch B、Switch D和Switch E

#

interface Vlan-interface2

 ip address 3.0.1.33 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$pU6KvpS80MadhM2zMCCSR07HX4qEbJhHvQ==

 ntp-service reliable authentication-keyid 88

#

·              设备Switch C

#

interface Vlan-interface2

 ip address 3.0.1.31 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+gOaG5363/fz4M3dQvHo2Fw==

 ntp-service reliable authentication-keyid 88

 ntp-service refclock-master 3

#

11  相关资料

·              H3C S12500-S系列以太网交换机 网络管理和监控配置指导-R757X

·              H3C S12500-S系列以太网交换机 网络管理和监控命令参考-R757X

 

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

新华三官网
联系我们