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

H3C S5830V2[S5820V2]系列以太网交换机 典型配置举例-Release22xx系列-6W100

目录

56-NTP典型配置举例

本章节下载 56-NTP典型配置举例  (337.99 KB)

docurl=/cn/Service/Document_Software/Document_Center/Switches/Catalog/S5800/S5830V2/Configure/Typical_Configuration_Example/H3C_S5830V2[S5820V2]-Release22xx-6W100/201403/819622_30005_0.htm

56-NTP典型配置举例

  录

1 NTP典型配置举例

1.1 简介

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

1.2.1 适用产品和版本

1.2.2 组网需求

1.2.3 配置步骤

1.2.4 验证配置

1.2.5 配置文件

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

1.3.1 适用产品和版本

1.3.2 组网需求

1.3.3 配置步骤

1.3.4 验证配置

1.3.5 配置文件

1.4 NTP对等体模式典型配置举例

1.4.1 适用产品和版本

1.4.2 组网需求

1.4.3 配置步骤

1.4.4 验证配置

1.4.5 配置文件

1.5 IPv6 NTP对等体模式典型配置举例

1.5.1 适用产品和版本

1.5.2 组网需求

1.5.3 配置步骤

1.5.4 验证配置

1.5.5 配置文件

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

1.6.1 适用产品和版本

1.6.2 组网需求

1.6.3 配置思路

1.6.4 配置步骤

1.6.5 验证配置

1.6.6 配置文件

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

1.7.1 适用产品和版本

1.7.2 组网需求

1.7.3 配置思路

1.7.4 配置步骤

1.7.5 验证配置

1.7.6 配置文件

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

1.8.1 适用产品和版本

1.8.2 组网需求

1.8.3 配置思路

1.8.4 配置步骤

1.8.5 验证配置

1.8.6 配置文件

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

1.9.1 适用产品和版本

1.9.2 组网需求

1.9.3 配置步骤

1.9.4 验证配置

1.9.5 配置文件

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

1.10.1 适用产品和版本

1.10.2 组网需求

1.10.3 配置步骤

1.10.4 验证配置

1.10.5 配置文件

1.11 SNTP典型配置举例

1.11.1 适用产品和版本

1.11.2 组网需求

1.11.3 配置步骤

1.11.4 验证配置

1.11.5 配置文件

 


1  NTP典型配置举例

1.1  简介

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

表1 NTP工作模式对比

工作模式

配置范围

时钟源

时钟可靠性

作用范围

特点

服务器/客户端模式

只需对客户端进行配置

·     客户端从指定的服务器获得时钟,并同步到本地

·     一个客户端可以指定多个时间服务器

客户端与服务器可在同一网段,也可以在不同网段

·     客户端只能同步到服务器的时钟,而服务器不能同步到客户端的时钟

·     如果时钟源IP改变,每个客户端都要重新配置服务器的IP地址

·     一般用于时钟源相对稳定的网络中

对等体模式

只需对主动对等体进行配置

·     进行时钟层数对比后,时钟层数取值大的对等体从时钟层数取值小的对等体处获取时钟,并同步到本地

·     一个主动对等体可以指定多个被动对等体

对等体可在同一网段,也可以在不同网段

该模式中对等体间可以互相同步时钟,设备之间互为备份

广播模式

服务器端和客户端都需要进行配置

客户端获取到服务器发送的广播报文后:

·     如报文中携带的时钟层数取值比自身的取值小,则将该服务器作为时钟源,并将小的时钟同步到本地

·     否则保持本地时钟

客户端与服务器必须处于同一网段

·     如果时钟源IP改变,只需重新配置服务器端,无需配置客户端,减少了管理员的工作量

·     一般用于设备较多,网络多变的环境中

组播模式

服务器端和客户端都需要进行配置

客户端获取到服务器发送的组播报文后:

·     如报文中携带的时钟层数取值比自身的取值更小,则将该服务器作为时钟源,并将小的时钟同步到本地

·     否则保持本地时钟

·     客户端与服务器可在同一网段,也可以在不同网段

·     当客户端与服务器在不同网段时,二者均需要支持三层组播协议

·     如果时钟源IP改变,只需重新配置服务器端,无需配置客户端,减少了管理员的工作量

·     一般用于设备较多,网络多变的环境中。相对于广播模式,此模式还可用于设备在不同网段中的网络环境

 

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

1.2.1  适用产品和版本

表2 适用产品和版本

产品

软件版本

S5830V2&S5820V2系列以太网交换机

Release 2208P01,Release 2210

 

1.2.2  组网需求

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

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

 

1.2.3  配置步骤

·     Switch A的配置

# 开启NTP功能。

<SwitchA> system-view

[SwitchA] ntp-service enable

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

[SwitchA] ntp-service refclock-master 2

·     Switch B的配置

# 开启NTP功能。

<SwitchB> system-view

[SwitchB] ntp-service enable

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

[SwitchB] ntp-service unicast-server 1.0.1.11

·     Switch C的配置

# 开启NTP功能。

<SwitchC> system-view

[SwitchC] ntp-service enable

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

[SwitchC] ntp-service unicast-server 1.0.1.11

1.2.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^-15                                                        

 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

1.2.5  配置文件

·     Switch A上的配置

#

 ntp-service enable

 ntp-service refclock-master 2

#

·     Switch B上的配置

#

 ntp-service enable

 ntp-service unicast-server 1.0.1.11

#

·     Switch C上的配置

#

 ntp-service enable

 ntp-service unicast-server 1.0.1.11

#

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

1.3.1  适用产品和版本

表3 适用产品和版本

产品

软件版本

S5830V2&S5820V2系列以太网交换机

Release 2208P01,Release 2210

 

1.3.2  组网需求

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

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

 

1.3.3  配置步骤

·     Switch A的配置

# 开启NTP功能。

<SwitchA> system-view

[SwitchA] ntp-service enable

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

[SwitchA] ntp-service refclock-master 2

·     Switch B的配置

# 开启NTP功能。

<SwitchB> system-view

[SwitchB] ntp-service enable

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

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

·     Switch C的配置

# 开启NTP功能。

<SwitchC> system-view

[SwitchC] ntp-service enable

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

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

1.3.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.000046 s                                                      

 Stability: 0.000 pps                                                          

 Clock precision: 2^-15                                                        

 Root delay: 1.81580 ms                                                         

 Root dispersion: 387.78687 ms                                                 

 Reference time: d5f3c993.117a884a  Mon, Sep 30 2013  9:57:39.068

此时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

1.3.5  配置文件

·     Switch A上的配置

#

 ntp-service enable

 ntp-service refclock-master 2

#

·     Switch B上的配置

#

 ntp-service enable

 ntp-service ipv6 unicast-server 3000::34

#

·     Switch C上的配置

#

 ntp-service enable

 ntp-service ipv6 unicast-server 3000::34

#

1.4  NTP对等体模式典型配置举例

1.4.1  适用产品和版本

表4 适用产品和版本

产品

软件版本

S5830V2&S5820V2系列以太网交换机

Release 2208P01,Release 2210

 

1.4.2  组网需求

图3所示,网络中有一台时间服务器Switch A,为网络中的其它设备提供精确的时间服务,为保证网络中的所有设备的时钟保持一致,现要求在网络中配置NTP对等体模式,使所有设备能从时间服务器Switch A上获得时钟同步。并且在时间服务器出现故障时,网络中设备的时钟同步不受影响。

图3 配置NTP对等体模式组网图

 

1.4.3  配置步骤

1. Switch A的配置

# 开启NTP功能。

<SwitchA> system-view

[SwitchA] ntp-service enable

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

[SwitchA] ntp-service refclock-master 2

2. Switch B的配置

# 开启NTP功能。

<SwitchB> system-view

[SwitchB] ntp-service enable

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

[SwitchB] ntp-service unicast-server 3.0.1.31

# 查看Switch B的时钟状态(Switch B向Switch A同步后)。

[SwitchB] display ntp-service status

 Clock status: synchronized                                                    

 Clock stratum: 3                                                              

 System peer: 3.0.1.31                                                         

 Local mode: client                                                            

 Reference clock ID: 3.0.1.31                                                  

 Leap indicator: 00                                                            

 Clock jitter: 0.003479 s                                                      

 Stability: 0.000 pps                                                          

 Clock precision: 2^-15                                                        

 Root delay: 1.95313 ms                                                        

 Root dispersion: 28.38135 ms                                                  

 Reference time: d5ed8cd5.577006ea  Wed, Sep 25 2013 16:50:56.521

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

3. Switch C的配置

# 开启NTP功能。

<SwitchC> system-view

[SwitchC] ntp-service enable

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

[SwitchC] ntp-service unicast-server 3.0.1.31

# 设置Switch C为主动对等体,并从Switch C上指定被动对等体为Switch B。

[SwitchC] ntp-service unicast-peer 3.0.1.32

以上配置将Switch B和Switch C配置为对等体,Switch C处于主动对等体模式,Switch B处于被动对等体模式。如果时间服务器出现故障,Switch B和Switch C之间会进行时间同步。

1.4.4  验证配置

# 时钟同步完成后,断开Switch A与网络的连接,模拟时间服务器出现故障,以Switch C为例,查看NTP的运行状态。

[SwitchC] display ntp-service status

 Clock status: synchronized                                                    

 Clock stratum: 4                                                              

 System peer: 3.0.1.32                                                          

 Local mode: sym_active                                                        

 Reference clock ID: 3.0.1.32                                                  

 Leap indicator: 00                                                             

 Clock jitter: 0.000031 s                                                      

 Stability: 0.000 pps                                                          

 Clock precision: 2^-15                                                        

 Root delay: 1.89209 ms                                                        

 Root dispersion: 7976.83716 ms                                                

 Reference time: d5ed991e.577a410f  Wed, Sep 25 2013 16:52:28.341

此时Switch C的时钟已经与Switch B同步,层数比Switch B的层数大1,为4。

1.4.5  配置文件

·     设备Switch A

#

 ntp-service enable

 ntp-service refclock-master 2

#

·     设备Switch B

#

 ntp-service enable

 ntp-service unicast-server 3.0.1.31

#

·     设备Switch C

#

 ntp-service enable

 ntp-service unicast-server 3.0.1.31

 ntp-service unicast-peer 3.0.1.32

#

1.5  IPv6 NTP对等体模式典型配置举例

1.5.1  适用产品和版本

表5 适用产品和版本

产品

软件版本

S5830V2&S5820V2系列以太网交换机

Release 2208P01,Release 2210

 

1.5.2  组网需求

图4所示,IPv6网络中有一台时间服务器Switch A,为网络中的其它设备提供精确的时间服务,为保证网络中的所有设备的时钟保持一致,现要求在网络中配置IPv6 NTP对等体模式,使所有设备能从时间服务器Switch A上获得时钟同步。并且在时间服务器出现故障时,网络中设备的时钟同步不受影响。

图4 配置IPv6 NTP对等体模式组网图

 

 

1.5.3  配置步骤

1. Switch A的配置

# 开启NTP功能。

<SwitchA> system-view

[SwitchA] ntp-service enable

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

[SwitchA] ntp-service refclock-master 2

2. Switch B的配置

# 开启NTP功能。

<SwitchB> system-view

[SwitchB] ntp-service enable

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

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

# 查看Switch B的时钟状态(Switch B向Switch A同步后)。

[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.000031 s                                                      

 Stability: 0.000 pps                                                          

 Clock precision: 2^-15                                                         

 Root delay: 1.90735 ms                                                        

 Root dispersion: 15.57922 ms                                                  

 Reference time: d5f403b3.1179ffb4  Mon, Sep 30 2013 14:05:39.068

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

3. Switch C的配置

# 开启NTP功能。

<SwitchC> system-view

[SwitchC] ntp-service enable

# 设置Switch C本地时钟作为备用参考时钟,层数为3。

[SwitchC] ntp-service refclock-master 3

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

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

# 设置Switch C为主动对等体,并从Switch C上指定被动对等体为Switch B。

[SwitchC] ntp-service ipv6 unicast-peer 3000::35

以上配置将Switch B和Switch C配置为对等体,Switch C处于主动对等体模式,Switch B处于被动对等体模式。如果时间服务器出现故障,Switch B和Switch C之间会进行时间同步。

1.5.4  验证配置

# 时钟同步完成后,断开Switch A与网络的连接,模拟时间服务器出现故障,以Switch B为例,查看NTP的运行状态。

[SwitchB] display ntp-service status

 Clock status: synchronized                                                    

 Clock stratum: 4                                                              

 System peer: 3000::36                                                         

 Local mode: sym_active                                                        

 Reference clock ID: 251.73.79.32                                              

 Leap indicator: 00                                                            

 Clock jitter: 0.000549 s                                                      

 Stability: 0.000 pps                                                           

 Clock precision: 2^-17                                                        

 Root delay: 4.21143 ms                                                        

 Root dispersion: 19.80591 ms                                                  

 Reference time: d5f4053f.bf8775ef  Mon, Sep 30 2013 14:12:15.748

此时Switch B的时钟已经与Switch C同步,层数比Switch C的层数大1,为4。

1.5.5  配置文件

·     设备Switch A

#

 ntp-service enable

 ntp-service refclock-master 2

#

·     设备Switch B

#

 ntp-service enable

 ntp-service ipv6 unicast-server 3000::34

#

·     设备Switch C

#

 ntp-service enable

 ntp-service refclock-master 3

 ntp-service ipv6 unicast-server 3000::34

 ntp-service ipv6 unicast-peer 3000::35

#

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

1.6.1  适用产品和版本

表6 适用产品和版本

产品

软件版本

S5830V2&S5820V2系列以太网交换机

Release 2208P01,Release 2210

 

1.6.2  组网需求

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

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

 

1.6.3  配置思路

当网络中设备较多,并且都在同一个网段中时,可以配置NTP广播模式,使网络中的设备拥有一致,统一的时间。

1.6.4  配置步骤

1. Switch C的配置

# 开启NTP功能。

<SwitchC> system-view

[SwitchC] ntp-service enable

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

[SwitchC] ntp-service refclock-master 2

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

[SwitchC] interface Vlan-interface 2

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

2. Switch A的配置

# 开启NTP功能。

<SwitchA> system-view

[SwitchA] ntp-service enable

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

[SwitchA] interface Vlan-interface 2

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

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

 

1.6.5  验证配置

# 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^-14                                                         

 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

1.6.6  配置文件

·     设备Switch C

#

 ntp-service enable

 ntp-service refclock-master 2

#

interface Vlan-interface2

 ntp-service broadcast-server

#

·     设备Switch A

#

 ntp-service enable

interface Vlan-interface2

 ntp-service broadcast-client

#

·     设备Switch B

#

 ntp-service enable

interface Vlan-interface2

 ntp-service broadcast-client

#

·     设备Switch D

#

 ntp-service enable

interface Vlan-interface2

 ntp-service broadcast-client

#

·     设备Switch E

#

 ntp-service enable

interface Vlan-interface2

 ntp-service broadcast-client

#

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

1.7.1  适用产品和版本

表7 适用产品和版本

产品

软件版本

S5830V2&S5820V2系列以太网交换机

Release 2208P01,Release 2210

 

1.7.2  组网需求

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

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

 

1.7.3  配置思路

网络中设备较多,并且NTP组播服务器与客户端不在同一个网段,可以配置NTP组播模式,使网络中的设备拥有一致的时间。

1.7.4  配置步骤

1. Switch C的配置

# 开启NTP功能。

<SwitchC> system-view

[SwitchC] ntp-service enable

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

[SwitchC] ntp-service refclock-master 2

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

[SwitchC] interface vlan-interface 2

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

2. Switch D的配置

# 开启NTP功能。

<SwitchD> system-view

[SwitchD] ntp-service enable

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

[SwitchD] interface vlan-interface 2

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

3. Switch B的配置

# 开启NTP功能。

<SwitchB> system-view

[SwitchB] ntp-service enable

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

[SwitchB] interface vlan-interface 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-enable

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

4. Switch A的配置

# 开启NTP功能。

<SwitchA> system-view

[SwitchA] ntp-service enable

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

[SwitchA] interface vlan-interface 3

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

1.7.5  验证配置

# 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^-14                                                         

 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。

1.7.6  配置文件

·     设备Switch A

#

 ntp-service enable

#

interface Vlan-interface3

 ntp-service multicast-client

#

·     设备Switch B

#

ntp-service enable

#

multicast routing-enable

#

igmp-snooping

#

interface Vlan-interface2

 pim dm

 ntp-service multicast-client

#

interface Vlan-interface3

 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

 ntp-service multicast-server

#

·     设备Switch D

#

 ntp-service enable

#

interface Vlan-interface2

 ntp-service multicast-client

#

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

1.8.1  适用产品和版本

表8 适用产品和版本

产品

软件版本

S5830V2&S5820V2系列以太网交换机

Release 2208P01,Release 2210

 

1.8.2  组网需求

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

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

 

1.8.3  配置思路

网络中设备较多,并且NTP组播服务器与客户端不在同一个网段,可以配置NTP组播模式,使网络中的设备拥有一致的时间。

1.8.4  配置步骤

1. Switch C的配置

# 开启NTP功能。

<SwitchC> system-view

[SwitchC] ntp-service enable

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

[SwitchC] ntp-service refclock-master 2

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

[SwitchC] interface vlan-interface 2

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

2. Switch D的配置

# 开启NTP功能。

<SwitchD> system-view

[SwitchD] ntp-service enable

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

[SwitchD] interface vlan-interface 2

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

3. Switch B的配置

# 开启NTP功能。

<SwitchB> system-view

[SwitchB] ntp-service enable

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

[SwitchB] interface vlan-interface 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-enable

[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

4. Switch A的配置

# 开启NTP功能。

<SwitchA> system-view

[SwitchA] ntp-service enable

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

[SwitchA] interface vlan-interface 3

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

1.8.5  验证配置

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

[SwitchA-Vlan-interface3] 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.165741 s

 Stability: 0.000 pps

 Clock precision: 2^-10

 Root delay: 0.00534 ms

 Root dispersion: 4.51282 ms

 Reference time: d0c61289.10b1193f  Mon, Sep 30 2013 18:32:15.748

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

1.8.6  配置文件

·     设备Switch A

#

 ntp-service enable

#

interface Vlan-interface3

 ntp-service ipv6 multicast-client ff24::1

#

·     设备Switch B

#

ntp-service enable

#

ipv6 multicast routing-enable

#

mld-snooping

#

interface Vlan-interface2

 ipv6 pim dm

 ntp-service ipv6 multicast-client ff24::1

#

interface Vlan-interface3

 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

 ntp-service ipv6 multicast-server ff24::1

#

·     设备Switch D

#

 ntp-service enable

#

interface Vlan-interface2

 ntp-service ipv6 multicast-client ff24::1

#

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

1.9.1  适用产品和版本

表9 配置适用的产品与软件版本关系

产品

软件版本

S5830V2&S5820V2系列以太网交换机

Release 2208P01,Release 2210

 

1.9.2  组网需求

为了通过NTP实现Switch B与Switch A的时间同步,并保证时间同步的安全性,要求:

·     在Switch A上设置本地时钟作为参考时钟,层数为2;

·     Switch B工作在客户端模式,指定Switch A为NTP服务器;

·     Switch A和Switch B上同时配置NTP验证。

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

 

1.9.3  配置步骤

1. Switch A的配置

# 开启NTP服务。

<SwitchA> system-view

[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

2. Switch B的配置

# 开启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进行时间同步。

3. Switch C的配置

# 开启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进行时间同步。

1.9.4  验证配置

# 完成上述配置后,Switch B可以与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^-10

 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  

1.9.5  配置文件

·     设备Switch A

#

 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

#

 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

#

 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

#

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

1.10.1  适用产品和版本

表10 配置适用的产品与软件版本关系

产品

软件版本

S5830V2&S5820V2系列以太网交换机

Release 2208P01,Release 2210

 

1.10.2  组网需求

图9所示,设备较多,所有设备都位于同一个网段(3.0.1.0/24)中,为了便于管理,现要求配置带身份验证的NTP广播模式,使网络中的设备拥有统一,一致的时间,并要保证时钟同步的安全性,以防攻击者将自己伪装成为一个时钟服务器而对客户时钟发起攻击。

图9 配置带身份验证的NTP广播模式组网图

 

1.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] ntp-service broadcast-server authentication-keyid 88

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

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

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

 

1.10.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.000092 s                                                      

 Stability: 0.000 pps                                                          

 Clock precision: 2^-14                                                        

 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。

1.10.5  配置文件

·     设备Switch C

#

interface Vlan-interface2

 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 3

#

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

#

interface Vlan-interface2

 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

#

1.11  SNTP典型配置举例

1.11.1  适用产品和版本

表11 适用产品和版本

产品

软件版本

S5830V2&S5820V2系列以太网交换机

Release 2208P01,Release 2210

 

1.11.2  组网需求

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

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

 

1.11.3  配置步骤

·     Switch A的配置

# 开启NTP功能。

<SwitchA> system-view

[SwitchA] ntp-service enable

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

[SwitchA] ntp-service refclock-master 2

·     Switch B的配置

# 开启SNTP功能。

<SwitchB> system-view

[SwitchB] sntp enable

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

[SwitchB] sntp unicast-server 1.0.1.11

·     Switch C的配置

# 开启SNTP功能。

<SwitchC> system-view

[SwitchC] sntp enable

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

[SwitchC] sntp unicast-server 1.0.1.11

1.11.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)

1.11.5  配置文件

·     Switch A上的配置

#

 ntp-service enable

 ntp-service refclock-master 2

#

·     Switch B上的配置

#

 sntp enable

 sntp unicast-server 1.0.1.11

#

·     Switch C上的配置

#

 sntp enable

 sntp unicast-server 1.0.1.11

#

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

新华三官网
联系我们