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

H3C 中低端以太网交换机 网络管理和监控典型配置指导-6W100

02-NTP典型配置指导

本章节下载 02-NTP典型配置指导  (357.05 KB)

docurl=/cn/Service/Document_Software/Document_Center/Switches/Catalog/CE3000/CE3000-EI/Configure/Typical_Configuration_Example/H3C_WJ_CG-6W100/201111/733179_30005_0.htm

02-NTP典型配置指导


1 NTP典型配置指导

1.1  NTP简介

NTP(Network  Time Protocol,网络时间协议)是由RFC 1305定义的时间同步协议,用来在分布式时间服务器和客户端之间进行时间同步。NTP基于UDP报文进行传输,使用的UDP端口号为123。

l              使用NTP的目的:对网络内所有具有时钟的设备进行时钟同步,使网络内所有设备的时钟保持一致,从而使设备能够提供基于统一时间的多种应用。

l              时钟源同步:对于运行NTP的本地系统,既可以接受来自其他时钟源的同步,又可以作为时钟源同步其他的时钟,并且可以和其他设备互相同步。

l              时钟层数:时钟层数定义了时钟的准确度,层数为1的时钟准确度最高,准确度从1到16依次递减,层数为16的时钟处于未同步状态,不能作为参考时钟。实际网络中,通常将从权威时钟(如原子时钟)获得时钟同步的NTP服务器的层数设置为1。

1.2  NTP的工作模式

设备可以支持以下四种NTP工作模式进行时间同步:

l              客户端/服务器模式:客户端向服务器发送时钟同步报文,收到应答报文后,进行时钟过滤和选择,并同步服务器的时钟;

l              对等体模式:主动对等体向被动对等体发送时钟同步报文,被动对等体收到报文后自动工作在被动对等体模式,并发送应答报文,经过报文的交互,建立对等体模式。主动对等体和被动对等体可以互相同步;

l              广播模式:服务器端周期性地向广播地址255.255.255.255发送时钟同步报文,客户端侦听来自服务器的广播报文,根据报文对系统时钟进行同步。

l              组播模式:服务器端周期性地向用户配置的组播地址发送时钟同步报文,客户端侦听来自服务器的组播报文,根据报文对系统时钟进行同步。

设备虽可以采用多种NTP工作模式进行时间同步,但各种工作模式的特点各有不同,用户应该根据需要选择合适的工作模式:

表1-1 NTP工作模式对比

工作模式

配置范围

时钟源

时钟可靠性

作用范围

特点

客户端/服务器模式

只需对客户端进行配置

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

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

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

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

l      一般用于时钟源相对稳定,设备较少的网络中

对等体模式

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

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

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

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

广播模式

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

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

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

l      否则保持本地时钟

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

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

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

组播模式

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

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

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

l      否则保持本地时钟

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

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

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

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

 

1.3  NTP服务器/客户端模式典型配置指导

1.3.1  应用需求

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

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

 

1.3.2  配置思路

结合网络需求及NTP各工作模式的特点可以得出,此网络应该使用服务器/客户端模式:

l              Switch A是一台精确的时间服务器,不再需要从其它时钟源获得时钟同步,可配置Switch A本地时钟作为时钟源,时钟层数为2;

l              所有设备只能从Switch A上获得时钟同步,即网络中的NTP客户端直接指定Switch A为时间服务器。可以配置Switch B和Switch C工作在客户端模式,指定Switch A为时间服务器。

1.3.3  适用产品、版本

表1-2 配置适用的产品与软件版本关系

产品

软件版本

S7500E系列以太网交换机

Release 6100系列,Release 6300系列,Release 6600系列,Release 6610系列

S7600系列以太网交换机

Release 6600系列,Release 6610系列

S5800&S5820X系列以太网交换机

Release 1110,Release 1211

CE3000-32F以太网交换机

Release 1211

S5810系列以太网交换机

Release 1102

S5500-EI系列以太网交换机

Release 2202,Release 2208

S5500-EI-D系列以太网交换机

Release 2208

S5500-SI系列以太网交换机

Release 2202 ,Release 2208

S5120-EI系列以太网交换机

Release 2202,Release 2208

S5120-EI-D系列以太网交换机

Release 1505

S5120-SI系列以太网交换机

Release 1101,Release 1505

S5120-LI系列以太网交换机

Release 1107

E552&E528以太网交换机

Release 1103

S3610&S5510系列以太网交换机

Release 5301,Release 5303,Release 5306,Release 5309

S3500-EA系列以太网交换机

Release 5303,Release 5309

S3100V2系列以太网交换机

Release 5103

E126B以太网交换机

Release 5103

 

1.3.4  配置过程和解释

l              配置各VLAN接口的IP地址,具体配置过程略。

l              配置Switch A

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

<SwitchA> system-view

[SwitchA] ntp-service refclock-master 2

l              配置Switch B

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

<SwitchB> system-view

[SwitchB] ntp-service unicast-server 1.0.1.11

l              配置Switch C

<SwitchC> system-view

[SwitchC] ntp-service unicast-server 1.0.1.11

l              验证与查看

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

[SwitchB] display ntp-service status

 Clock status: synchronized

 Clock stratum: 3

 Reference clock ID: 1.0.1.11

 Nominal frequency: 100.0000 Hz

 Actual frequency: 100.0000 Hz

 Clock precision: 2^18

 Clock offset: 0.0000 ms

 Root delay: 31.00 ms

 Root dispersion: 1.05 ms

 Peer dispersion: 7.81 ms

 Reference time: 14:53:27.371 UTC Sep 19 2005 (C6D94F67.5EF9DB22)

此时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    63    64    3    -75.5    31.0  16.5

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

Total associations :  1

1.3.5  完整配置

l              Switch A上的配置

#

 ntp-service refclock-master 2

l              Switch B上的配置

#

 ntp-service unicast-server 1.0.1.11

l              Switch C上的配置

#

 ntp-service unicast-server 1.0.1.11

1.3.6  配置注意事项

S7500E、S7600系列以太网交换机支持设置本身时钟作为参考时钟;其它系列以太网交换机均不支持设置本身时钟为参考时钟,只有当其时钟被同步后,才能作为时钟源去同步其他设备。

1.4  配置NTP对等体模式

1.4.1  应用需求

图1-2所示,网络中有一台时间服务器Switch A,为网络中的其它设备提供精确的时间服务,为保证网络中的所有设备能保持一致、统一的时钟,需要在网络中的设备上开启NTP功能,并且在NTP服务器出现故障时,网络中的设备时钟同步不受影响。

图1-2 配置NTP对等体模式组网图

 

1.4.2  配置思路

通过分析网络需求可以看出:

l              Switch A是一台精确的时间服务器,不再需要从外部时钟源获得时钟同步;

l              Switch A运行正常的情况下,网络中的设备可以从Switch A获得时钟同步,当Switch A出现故障时会对网络中的时间同步业务带来影响。

l              当Switch A出现故障时,网络中的设备可以运行在对等体模式,互为备份。

结合上述网络需求可见,此网络选用服务器/客户端模式与对等体模式相结合的方式,配置方法如下:

l              配置Switch A本地时钟作为时钟源,时钟层数为2;

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

l              配置Switch C工作在对等体模式,将Switch B设为对等体。Switch C为主动对等体,Switch B为被动对等体。

1.4.3  适用产品、版本

表1-3 配置适用的产品与软件版本关系

产品

软件版本

S7500E系列以太网交换机

Release 6100系列,Release 6300系列,Release 6600系列,Release 6610系列

S7600系列以太网交换机

Release 6600系列,Release 6610系列

S5800&S5820X系列以太网交换机

Release 1110,Release 1211

CE3000-32F以太网交换机

Release 1211

S5810系列以太网交换机

Release 1102

S5500-EI系列以太网交换机

Release 2202,Release 2208

S5500-EI-D系列以太网交换机

Release 2208

S5500-SI系列以太网交换机

Release 2202 ,Release 2208

S5120-EI系列以太网交换机

Release 2202,Release 2208

S5120-EI-D系列以太网交换机

Release 1505

S5120-SI系列以太网交换机

Release 1101,Release 1505

S5120-LI系列以太网交换机

Release 1107

E552&E528以太网交换机

Release 1103

S3610&S5510系列以太网交换机

Release 5301,Release 5303,Release 5306,Release 5309

S3500-EA系列以太网交换机

Release 5303,Release 5309

S3100V2系列以太网交换机

Release 5103

E126B以太网交换机

Release 5103

 

1.4.4  配置过程和解释

(1)        配置各VLAN接口的IP地址,具体配置过程略。

(2)        配置Switch A

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

<NTPServer> system-view

[NTPServer] ntp-service refclock-master 2

(3)        配置Switch B

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

<SwitchB> system-view

[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

 Reference clock ID: 3.0.1.31

 Nominal frequency: 100.0000 Hz

 Actual frequency: 100.0000 Hz

 Clock precision: 2^18

 Clock offset: -21.1982 ms

 Root delay: 15.00 ms

 Root dispersion: 775.15 ms

 Peer dispersion: 34.29 ms

 Reference time: 15:22:47.083 UTC Sep 19 2005 (C6D95647.153F7CED)

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

(4)        配置Switch C(Switch B向NTP Server同步后)

# 设置Switch B为对等体。

<SwitchC> system-view

[SwitchC] ntp-service unicast-peer 3.0.1.32

以上配置将Switch B和Switch C配置为对等体,Switch C处于主动对等体模式,Switch B处于被动对等体模式,由于Switch C系统时钟的层数为16,而Switch B的层数为3,所以Switch C向Switch B同步。

# 同步后查看Switch C的状态。

[SwitchC] display ntp-service status

 Clock status: synchronized

 Clock stratum: 4

 Reference clock ID: 3.0.1.32

 Nominal frequency: 100.0000 Hz

 Actual frequency: 100.0000 Hz

 Clock precision: 2^18

 Clock offset: -21.1982 ms

 Root delay: 15.00 ms

 Root dispersion: 775.15 ms

 Peer dispersion: 34.29 ms

 Reference time: 15:22:47.083 UTC Sep 19 2005 (C6D95647.153F7CED)

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

1.4.5  完整配置

l              Switch A上的配置

#

 ntp-service refclock-master 2

l              Switch B上的配置

#

 ntp-service unicast-server 3.0.1.31

l              Switch C上的配置

#

 ntp-service unicast-peer 3.0.1.32

1.4.6  配置注意事项

S7500E、S7600系列以太网交换机支持设置本身时钟作为参考时钟;其它系列以太网交换机均不支持设置本身时钟为参考时钟,只有当其时钟被同步后,才能作为时钟源去同步其他设备。

1.5  NTP广播模式典型配置指导

1.5.1  应用需求

图1-1所示,设备较多,所有设备都位于同一个网段(3.0.1.30/24)中,为了便于管理,现在需要网络中的设备拥有一致,统一的时间。

图1-3 NTP广播模式配置组网图

 

1.5.2  配置思路

通过分析网络需求可以看出:

l              所有设备都在同一个网段中;

l              设备较多,如果为每台设备配置固定的时间服务器的IP地址,管理员的工作量较大,且当服务器出故障时,网络中的设备还需重新指定NTP服务器,这给管理员的网络维护带来许多不便;

l              此网络中没有专门的时间服务器,可选取网络中某一时钟相对准确的设备作为时间服务器。

结合网络需求及NTP各工作模式的特点可以得出,此网络可选用广播模式,配置方法如下:

l              选取Switch C作为时间服务器,配置Switch C本地时钟作为参考时钟,时钟层数为2;

l              配置Switch C工作在广播服务器模式,从VLAN接口2向外发送广播报文;

l              配置Switch A和Switch B工作在广播客户端模式,Switch A和Switch B从VLAN接口2监听广播报文。

1.5.3  适用产品、版本

表1-4 配置适用的产品与软件版本关系

产品

软件版本

S7500E系列以太网交换机

Release 6100系列,Release 6300系列,Release 6600系列,Release 6610系列

S7600系列以太网交换机

Release 6600系列,Release 6610系列

S5800&S5820X系列以太网交换机

Release 1110,Release 1211

CE3000-32F以太网交换机

Release 1211

S5810系列以太网交换机

Release 1102

S5500-EI系列以太网交换机

Release 2202,Release 2208

S5500-EI-D系列以太网交换机

Release 2208

S5500-SI系列以太网交换机

Release 2202 ,Release 2208

S5120-EI系列以太网交换机

Release 2202,Release 2208

S5120-EI-D系列以太网交换机

Release 1505

S5120-SI系列以太网交换机

Release 1101,Release 1505

S5120-LI系列以太网交换机

Release 1107

E552&E528以太网交换机

Release 1103

S3610&S5510系列以太网交换机

Release 5301,Release 5303,Release 5306,Release 5309

S3500-EA系列以太网交换机

Release 5303,Release 5309

S3100V2系列以太网交换机

Release 5103

E126B以太网交换机

Release 5103

 

1.5.4  配置过程和解释

(1)        配置各VLAN接口的IP地址,具体配置过程略。

(2)        配置Switch C

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

<SwitchC> system-view

[SwitchC] ntp-service refclock-master 2

# 设置Switch C为广播服务器,从Vlan-interface2发送广播消息包

<SwitchC> system-view

[SwitchC] interface Vlan-interface 2

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

(3)        配置Switch A

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

<SwitchA> system-view

[SwitchA] interface Vlan-interface 2

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

(4)        配置Switch B和Switch D

# Switch BSwitch D和配置与Switch A相同,此处不再赘述。

(5)        检验配置结果

# Switch A为例,同步后查看Switch A的状态。

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

 Clock status: synchronized

 Clock stratum: 3

 Reference clock ID: 3.0.1.31

 Nominal frequency: 100.0000 Hz

 Actual frequency: 100.0000 Hz

 Clock precision: 2^18

 Clock offset: 0.0000 ms

 Root delay: 31.00 ms

 Root dispersion: 8.31 ms

 Peer dispersion: 34.30 ms

 Reference time: 16:01:51.713 UTC Sep 19 2005 (C6D95F6F.B6872B02)

此时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    62   -16.0    32.0   16.6

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

Total associations :  1

 

1.5.5  完整配置

l              Switch C上的配置

#

interface Vlan-interface2

 ip address 3.0.1.31 255.255.255.0

 ntp-service broadcast-server

l              Switch A上的配置

#

interface Vlan-interface2

 ip address 3.0.1.30 255.255.255.0

 ntp-service broadcast-client

l              Switch B上的配置

#

interface Vlan-interface2

 ip address 3.0.1.32 255.255.255.0

 ntp-service broadcast-client

l              Switch D上的配置

#

interface Vlan-interface2

 ip address 3.0.1.32 255.255.255.0

 ntp-service broadcast-client

1.5.6  配置注意事项

S7500E、S7600系列以太网交换机支持设置本身时钟作为参考时钟;其它系列以太网交换机均不支持设置本身时钟为参考时钟,只有当其时钟被同步后,才能作为时钟源去同步其他设备。

1.6  NTP组播模式典型配置指导

1.6.1  应用需求

图1-4所示,设备较多,所有网络设备分布在不同网段中,为了便于管理,现在需要网络中的设备拥有统一,一致的时间。

图1-4 配置NTP组播模式组网图

 

1.6.2  配置思路

通过分析网络需求可以看出:

l              设备位于不同的网段中;

l              设备较多,如果为每台设备配置固定的时间服务器的IP地址,管理员的工作量较大;且当服务器出故障时,网络中的设备还需重新指定NTP服务器,这给管理员的网络维护带来许多不便;

l              此网络中没有专门的时间服务器,可选取网络中某一时钟相对准确的设备作为时间服务器。

l              由于Switch A与Switch C不在同一网段,所以Switch B上需要配置组播功能,用来转发不同网段之间发出的组播报文。

结合网络需求及NTP各工作模式的特点可以得出,此网络可选用组播模式,配置方法如下:

l              选取Switch C作为时间服务器,配置Switch C本地时钟作为参考时钟,时钟层数为2;

l              Switch C工作在组播服务器模式,从VLAN接口2向外发送组播报文;

l              Switch A和Switch D工作在组播客户端模式,Switch A从VLAN接口3监听组播报文,Switch D从VLAN接口2监听组播报文。

1.6.3  适用产品、版本

表1-5 配置适用的产品与软件版本关系

产品

软件版本

S7500E系列以太网交换机

Release 6100系列,Release 6300系列,Release 6600系列,Release 6610系列

S7600系列以太网交换机

Release 6600系列,Release 6610系列

S5800&S5820X系列以太网交换机

Release 1110,Release 1211

CE3000-32F以太网交换机

Release 1211

S5810系列以太网交换机

Release 1102

S5500-EI系列以太网交换机

Release 2202,Release 2208

S5500-EI-D系列以太网交换机

Release 2208

S5500-SI系列以太网交换机

Release 2202 ,Release 2208

S5120-EI系列以太网交换机

Release 2202,Release 2208

S5120-EI-D系列以太网交换机

Release 1505

S5120-SI系列以太网交换机

Release 1101,Release 1505

S5120-LI系列以太网交换机

Release 1107

E552&E528以太网交换机

Release 1103

S3610&S5510系列以太网交换机

Release 5301,Release 5303,Release 5306,Release 5309

S3500-EA系列以太网交换机

Release 5303,Release 5309

S3100V2系列以太网交换机

Release 5103

E126B以太网交换机

Release 5103

 

1.6.4  配置过程和解释

(1)        配置各VLAN接口的IP地址,具体配置过程略。

(2)        配置Switch C

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

<SwitchC> system-view

[SwitchC] ntp-service refclock-master 2

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

[SwitchC] interface vlan-interface 2

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

(3)        配置Switch D

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

<SwitchD> system-view

[SwitchD] interface vlan-interface 2

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

(4)        配置Switch B

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

# 配置组播功能。

<SwitchB> system-view

[SwitchB] multicast routing-enable

[SwitchB] interface vlan-interface 2

[SwitchB-Vlan-interface2] pim dm

[SwitchB-Vlan-interface2] quit

[SwitchB] vlan 3

[SwitchB-vlan3] port 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] interface GigabitEthernet 1/0/1

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

(5)        配置Switch A

<SwitchA> system-view

[SwitchA] interface vlan-interface 3

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

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

# 同步后查看Switch A的状态。

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

 Clock status: synchronized

 Clock stratum: 3

 Reference clock ID: 3.0.1.31

 Nominal frequency: 64.0000 Hz

 Actual frequency: 64.0000 Hz

 Clock precision: 2^7

 Clock offset: 0.0000 ms

 Root delay: 40.00 ms

 Root dispersion: 10.83 ms

 Peer dispersion: 34.30 ms

 Reference time: 16:02:49.713 UTC Sep 19 2005 (C6D95F6F.B6872B02)

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

1.6.5  完整配置

l              Switch A上的配置

#

interface Vlan-interface3

 ntp-service multicast-client

l              Switch B上的配置

#

 multicast routing-enable

#

interface Vlan-interface2

 pim dm

#

interface Vlan-interface3

 igmp enable

 igmp static-group 224.0.1.1

#

interface GigabitEthernet1/0/1

 port access vlan 3

 igmp-snooping static-group 224.0.1.1 vlan 3

l              Switch C上的配置

#

ntp-service refclock-master 2

#

interface Vlan-interface2

 ntp-service multicast-server

l              Switch D上的配置

#

interface Vlan-interface2

 ntp-service multicast-client

1.6.6  配置注意事项

l               S7500E、S7600系列以太网交换机支持设置本身时钟作为参考时钟;其它系列以太网交换机均不支持设置本身时钟为参考时钟,只有当其时钟被同步后,才能作为时钟源去同步其他设备。

l              S5810/S5500-SI/5120-EI/S5120-SI系列以太网交换机由于不支持三层组播功能,所以在本举例中不能充当Switch B。

1.7  带身份验证的NTP广播模式典型配置指导

1.7.1  应用需求

图1-1所示,设备较多,所有设备都位于同一个网段(3.0.1.30/24)中,为了便于管理,现在需要网络中的设备拥有统一,一致的时间。并要保证时钟同步的安全性,以防攻击者将自己伪装成为一个时钟服务器而对客户时钟发起攻击。

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

 

1.7.2  配置思路

通过分析网络需求可以看出:

l              所有设备都在同一个网段中;

l              设备较多,如果为每台设备配置固定的时间服务器的IP地址,管理员的工作量较大,且当服务器出故障时,网络中的设备还需重新指定NTP服务器,这给管理员的网络维护带来许多不便;

l              从安全方面考虑,由于客户不指定具体的服务器,攻击者很容易将自己伪装成为一个时钟服务器而对客户时钟发起攻击,因此采用广播模式时必须配置相关认证。

结合网络需求及NTP各工作模式的特点可以得出,此网络可选用广播模式,配置方法如下:

l              Switch C设置本地时钟作为参考时钟,层数为3;

l              Switch C工作在广播服务器模式,从VLAN接口2向外发送广播报文;

l              Switch A和Switch B工作在广播客户端模式,从VLAN接口2监听广播报文;

l              同时在Switch A、Switch B和Switch C上配置NTP验证。

1.7.3  适用产品、版本

表1-6 配置适用的产品与软件版本关系

产品

软件版本

S7500E系列以太网交换机

Release 6100系列,Release 6300系列,Release 6600系列,Release 6610系列

S7600系列以太网交换机

Release 6600系列,Release 6610系列

S5800&S5820X系列以太网交换机

Release 1110,Release 1211

CE3000-32F以太网交换机

Release 1211

S5810系列以太网交换机

Release 1102

S5500-EI系列以太网交换机

Release 2202,Release 2208

S5500-EI-D系列以太网交换机

Release 2208

S5500-SI系列以太网交换机

Release 2202 ,Release 2208

S5120-EI系列以太网交换机

Release 2202,Release 2208

S5120-EI-D系列以太网交换机

Release 1505

S5120-SI系列以太网交换机

Release 1101,Release 1505

S5120-LI系列以太网交换机

Release 1107

E552&E528以太网交换机

Release 1103

S3610&S5510系列以太网交换机

Release 5301,Release 5303,Release 5306,Release 5309

S3500-EA系列以太网交换机

Release 5303,Release 5309

S3100V2系列以太网交换机

Release 5103

E126B以太网交换机

Release 5103

 

1.7.4  配置过程和解释

(1)        配置各VLAN接口的IP地址,具体配置过程略。

(2)        配置Switch C

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

<SwitchC> system-view

[SwitchC] ntp-service refclock-master 3

# 配置NTP验证。

[SwitchC] ntp-service authentication enable

[SwitchC] ntp-service authentication-keyid 88 authentication-mode md5 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

(3)        配置Switch A

# 配置NTP验证。

<SwitchA> system-view

[SwitchA] ntp-service authentication enable

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

[SwitchA] ntp-service reliable authentication-keyid 88

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

[SwitchA] interface vlan-interface 2

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

(4)        配置Switch B

# 配置NTP验证。

<SwitchB> system-view

[SwitchB] ntp-service authentication enable

[SwitchB] ntp-service authentication-keyid 88 authentication-mode md5 123456

[SwitchB] ntp-service reliable authentication-keyid 88

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

[SwitchB] interface vlan-interface 2

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

以上配置将Switch B配置为从VLAN接口2监听广播报文,Switch C从VLAN接口2发送广播报文。Switch B接收到Switch C发出的广播报文后与其同步。

# 以Switch B为例,同步后查看Switch B的状态。

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

 Clock status: synchronized

 Clock stratum: 4

 Reference clock ID: 3.0.1.31

 Nominal frequency: 64.0000 Hz

 Actual frequency: 64.0000 Hz

 Clock precision: 2^7

 Clock offset: 0.0000 ms

 Root delay: 31.00 ms

 Root dispersion: 8.31 ms

 Peer dispersion: 34.30 ms

 Reference time: 16:01:51.713 UTC Sep 19 2005 (C6D95F6F.B6872B02)

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

1.7.5  完整配置

l              Switch C上的配置

#

interface Vlan-interface2

 ntp-service broadcast-server authentication-keyid 88

#

 ntp-service authentication enable

 ntp-service authentication-keyid 88 authentication-mode md5 OUM!K%F<+$[Q=^Q`MAF4<1!!

 ntp-service reliable authentication-keyid 88

 ntp-service refclock-master 3

#

l              Switch A上的配置

#

interface Vlan-interface2

 ntp-service broadcast-client

#

 ntp-service authentication enable

 ntp-service authentication-keyid 88 authentication-mode md5 OUM!K%F<+$[Q=^Q`MAF4<1!!

 ntp-service reliable authentication-keyid 88

#

l              Switch B上的配置

#

interface Vlan-interface2

 ntp-service broadcast-client

#

 ntp-service authentication enable

 ntp-service authentication-keyid 88 authentication-mode md5 OUM!K%F<+$[Q=^Q`MAF4<1!!

 ntp-service reliable authentication-keyid 88

#

1.7.6  配置注意事项

S7500E、S7600系列以太网交换机支持设置本身时钟作为参考时钟;其它系列以太网交换机均不支持设置本身时钟为参考时钟,只有当其时钟被同步后,才能作为时钟源去同步其他设备。

 

1.8  当NTP服务器为Windows 2003 Server 时的配置

1.8.1  应用需求

在某一组网中使用Windows 2003 Server作为NTP服务器,网络中的交换机作为客户端,要求网络中所有客户端都统一从NTP服务器获得时钟同步,以达到网络中所有交换机的时钟都能保持一致。

图1-6 NTP服务器为Windows 2003 Server 时的配置组网图

 

1.8.2  配置思路

l              配置Windows 2003 Server作为NTP服务器;

l              配置网络中的交换机作为NTP客户端。

1.8.3  适用产品、版本

表1-7 配置适用的产品与软件版本关系

产品

软件版本

S7500E系列以太网交换机

Release 6100系列,Release 6300系列,Release 6600系列,Release 6610系列

S7600系列以太网交换机

Release 6600系列,Release 6610系列

S5800&S5820X系列以太网交换机

Release 1110,Release 1211

CE3000-32F以太网交换机

Release 1211

S5810系列以太网交换机

Release 1102

S5500-EI系列以太网交换机

Release 2202,Release 2208

S5500-EI-D系列以太网交换机

Release 2208

S5500-SI系列以太网交换机

Release 2202 ,Release 2208

S5120-EI系列以太网交换机

Release 2202,Release 2208

S5120-EI-D系列以太网交换机

Release 1505

S5120-SI系列以太网交换机

Release 1101,Release 1505

S5120-LI系列以太网交换机

Release 1107

E552&E528以太网交换机

Release 1103

S3610&S5510系列以太网交换机

Release 5301,Release 5303,Release 5306,Release 5309

S3500-EA系列以太网交换机

Release 5303,Release 5309

S3100V2系列以太网交换机

Release 5103

E126B以太网交换机

Release 5103

 

1.8.4  配置过程和解释

(1)        配置Windows 2003 server服务器

# 单击“开始”-“运行”,输入regedit打开注册表,单击“HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters”项,修改

字符串值“NtpServer”为“18.103.0.198”,修改“Type”值为“AllSync”,如下图:

 

# 单击“HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient”项,修改字符串值“Enabled”为“0x00000001(1)”,修改字符串值“InputProvider”为“0x00000001(1)”,如下图:

 

# 单击“HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer”项,修改字符串值“Enabled”为“0x00000001(1)”,修改字符串值“InputProvider”为“0x00000001(1)”,如下图:

 

# 关闭注册表,重新启动Windows time服务,单击“开始”-“程序”-“附件”-“命令提示符”,打开命令提示符窗口,执行命令“net stop w32time && net start w32time”。

# 单击“开始”-“运行”,输入gpedit.msc打开组策略窗口,单击“Computer Configuration”-“Administrative Templates”-“System”-“Windows Time Service”-“Time Providers”,如下图:

 

# 单击“Enable Windows NTP Client”,修改“Setting”为“Enabled”,如下图:

 

# 单击“Configure Windows NTP Client”,修改“Setting”为“Enabled”,修改“NtpServer”为“18.103.0.198”,修改“Type”为“AllSync”,如下图:

 

# 单击“Enable Windows NTP Server”,修改“Setting”为“Enabled”,如下图:

 

# 关闭注册表单击“开始”-“程序”-“附件”-“命令提示符”,打开命令提示符窗口,执行命令“w32tm /resync /rediscover”及命令“w32tm /monitor”。

(2)        交换机配置

l              配置各VLAN接口的IP地址,具体配置过程略。

l              配置Switch A

# 设置Windows 2003 Server 为Switch A的NTP服务器。

<SwitchA> system-view

[SwitchA] ntp-service unicast-server 1.0.1.11

l              配置Switch B

<SwitchB> system-view

[SwitchB] ntp-service unicast-server 1.0.1.11

# 以上配置将Switch B向Switch A进行时间同步,同步后查看Switch B的NTP状态。

[SwitchB] display ntp-service status

 Clock status: synchronized

 Clock stratum: 3

 Reference clock ID: 1.0.1.11

 Nominal frequency: 100.0000 Hz

 Actual frequency: 100.0000 Hz

 Clock precision: 2^18

 Clock offset: 0.0000 ms

 Root delay: 31.00 ms

 Root dispersion: 1.05 ms

 Peer dispersion: 7.81 ms

 Reference time: 14:53:27.371 UTC Sep 19 2005 (C6D94F67.5EF9DB22)

此时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    63    64    3    -75.5    31.0  16.5

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

Total associations :  1

1.8.5  完整配置

l              Switch A上的配置

#

 ntp-service unicast-server 1.0.1.11

l              Switch B上的配置

#

 ntp-service unicast-server 1.0.1.11

1.8.6  配置注意事项

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

新华三官网
联系我们