• 全部
  • 经验案例
  • 典型配置
  • 技术公告
  • FAQ
  • 漏洞说明
  • 全部
  • 全部
  • 大数据引擎
  • 知了引擎
产品线
搜索
取消
案例类型
发布者
是否解决
是否官方
时间
搜索引擎
匹配模式
高级搜索

交换机配置多级NTP的方法

2024-01-25提问
  • 1关注
  • 0收藏,551浏览
粉丝:0人 关注:3人

问题描述:

请教一下各位老师,如何让交换机A向交换机B同步时间,交换机B又与交换机C或者时钟服务器去拿地址,该如何配置

最佳答案

粉丝:1人 关注:1人

参考官网交换机ntp配置手册

03-NTP配置-新华三集团-H3C


我这是三台设备,案例里面就两台

zhiliao_m7m4iI 发表时间:2024-01-25

第三台设备再去同步时间服务器时间,就和第二台设备一样配置,写同样的时间同步服务器地址

夏季的热风 发表时间:2024-01-25
1 个回答
已采纳
粉丝:19人 关注:9人

您好,请知:

以下是NTP的配置案例,请参考:

1.12  NTP典型配置举例

1.12.1  配置NTP客户端/服务器模式

1. 组网需求

为了通过NTP实现Device B与Device A的时间同步,要求:

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

·     配置Device B工作在客户端模式,指定Device A为NTP服务器。

2. 组网图

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

 

3. 配置步骤

(1)     按照图1-4配置各接口的IP地址,并确保路由可达,具体配置过程略。

(2)     配置Device A

# 开启NTP服务。

<DeviceA> system-view

[DeviceA] ntp-service enable

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

[DeviceA] ntp-service refclock-master 2

(3)     配置Device B

# 开启NTP服务。

<DeviceB> system-view

[DeviceB] ntp-service enable

# 配置通过NTP协议获取时间。

[DeviceB] clock protocol ntp

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

[DeviceB] ntp-service unicast-server 1.0.1.11

4. 验证配置

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

[DeviceB] 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.000977 s

 Stability: 0.000 pps

 Clock precision: 2^-19

 Root delay: 0.00383 ms

 Root dispersion: 16.26572 ms

 Reference time: d0c6033f.b9923965  Wed, Dec 29 2010 18:58:07.724

 System poll interval: 64 s

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

[DeviceB] display ntp-service sessions

       source          reference       stra reach poll  now offset  delay disper

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

[12345]1.0.1.11        127.127.1.0        2     1   64   15   -4.0 0.0038 16.262

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

 Total sessions: 1

1.12.2  配置IPv6 NTP客户端/服务器模式

1. 组网需求

为了通过IPv6 NTP实现Device B与Device A的时间同步,要求:

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

·     配置Device B工作在客户端模式,指定Device A为IPv6 NTP服务器。

2. 组网图

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

 

3. 配置步骤

(1)     按照图1-5配置各接口的IP地址,并确保路由可达,具体配置过程略。

(2)     配置Device A

# 开启NTP服务。

<DeviceA> system-view

[DeviceA] ntp-service enable

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

[DeviceA] ntp-service refclock-master 2

(3)     配置Device B

# 开启NTP服务。

<DeviceB> system-view

[DeviceB] ntp-service enable

# 配置通过NTP协议获取时间。

[DeviceB] clock protocol ntp

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

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

4. 验证配置

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

[DeviceB] display ntp-service status

 Clock status: synchronized

 Clock stratum: 3

 System peer: 3000::34

 Local mode: client

 Reference clock ID: 163.29.247.19

 Leap indicator: 00

 Clock jitter: 0.000977 s

 Stability: 0.000 pps

 Clock precision: 2^-19

 Root delay: 0.02649 ms

 Root dispersion: 12.24641 ms

 Reference time: d0c60419.9952fb3e  Wed, Dec 29 2010 19:01:45.598

 System poll interval: 64 s

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

[DeviceB] 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: 15              Poll interval: 64

 Last receive time: 19           Offset: 0.0

 Roundtrip delay: 0.0            Dispersion: 0.0

 

 Total sessions: 1

1.12.3  配置NTP对等体模式

1. 组网需求

网络中存在时间服务器Device A。为了通过NTP实现Device B与Device A进行时间同步,要求:

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

·     配置Device A工作在对等体模式,指定Device B为被动对等体,即Device A为主动对等体,Device B为被动对等体。

2. 组网图

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

 

3. 配置步骤

(1)     按照图1-6配置各接口的IP地址,并确保路由可达,具体配置过程略。

(2)     配置Device B

# 开启NTP服务。

<DeviceB> system-view

[DeviceB] ntp-service enable

# 配置通过NTP协议获取时间。

[DeviceB] clock protocol ntp

(3)     配置Device A

# 开启NTP服务。

<DeviceA> system-view

[DeviceA] ntp-service enable

# 配置通过NTP协议获取时间。

[DeviceA] clock protocol ntp

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

[DeviceA] ntp-service refclock-master 2

# 设置Device B为被动对等体。Device A处于主动对等体模式。

[DeviceA] ntp-service unicast-peer 3.0.1.32

4. 验证配置

# 完成上述配置后,Device B选择Device A作为参考时钟,与Device A进行时间同步。同步后查看Device B的状态。可以看出,Device B已经与Device A同步,层数比Device A的层数大1,为3。

[DeviceB] display ntp-service status

 Clock status: synchronized

 Clock stratum: 3

 System peer: 3.0.1.31

 Local mode: sym_passive

 Reference clock ID: 3.0.1.31

 Leap indicator: 00

 Clock jitter: 0.000916 s

 Stability: 0.000 pps

 Clock precision: 2^-19

 Root delay: 0.00609 ms

 Root dispersion: 1.95859 ms

 Reference time: 83aec681.deb6d3e5  Wed, Jan  8 2014 14:33:11.081

 System poll interval: 64 s

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

[DeviceB] display ntp-service sessions

       source          reference       stra reach poll  now offset  delay disper

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

   [12]3.0.1.31        127.127.1.0        2    62   64   34 0.4251 6.0882 1392.1

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

 Total sessions: 1

1.12.4  配置IPv6 NTP对等体模式

1. 组网需求

网络中存在时间服务器Device A。为了通过IPv6 NTP实现Device B与Device A进行时间同步,要求:

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

·     配置Device A工作在对等体模式,指定Device B为被动对等体,即Device A为主动对等体,Device B为被动对等体。

2. 组网图

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

 

3. 配置步骤

(1)     按照图1-7配置各接口的IP地址,并确保路由可达,具体配置过程略。

(2)     配置Device B

# 开启NTP服务。

<DeviceB> system-view

[DeviceB] ntp-service enable

# 配置通过NTP协议获取时间。

[DeviceB] clock protocol ntp

(3)     配置Device A

# 开启NTP服务。

<DeviceA> system-view

[DeviceA] ntp-service enable

# 配置通过NTP协议获取时间。

[DeviceA] clock protocol ntp

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

[DeviceA] ntp-service refclock-master 2

# 设置Device B为IPv6被动对等体。Device A处于主动对等体模式。

[DeviceA] ntp-service ipv6 unicast-peer 3000::36

4. 验证配置

# 完成上述配置后,Device B选择Device A作为参考时钟,与Device A进行时间同步。同步后查看Device B的状态。可以看出,Device B已经与Device A同步,层数比Device A的层数大1,为3。

[DeviceB] display ntp-service status

 Clock status: synchronized

 Clock stratum: 3

 System peer: 3000::35

 Local mode: sym_passive

 Reference clock ID: 251.73.79.32

 Leap indicator: 11

 Clock jitter: 0.000977 s

 Stability: 0.000 pps

 Clock precision: 2^-19

 Root delay: 0.01855 ms

 Root dispersion: 9.23483 ms

 Reference time: d0c6047c.97199f9f  Wed, Dec 29 2010 19:03:24.590

 System poll interval: 64 s

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

[DeviceB] display ntp-service ipv6 sessions

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

 

 Source:  [1234]3000::35

 Reference: 127.127.1.0          Clock stratum: 2

 Reachabilities: 15              Poll interval: 64

 Last receive time: 19           Offset: 0.0

 Roundtrip delay: 0.0            Dispersion: 0.0

 

 Total sessions: 1

1.12.5  配置NTP广播模式

1. 组网需求

为了实现Switch C作为同一网段中多个设备的时间服务器,同时同步多个设备的时间,要求:

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

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

·     Switch A和Switch B工作在广播客户端模式,分别从各自的VLAN接口2监听NTP广播报文。

2. 组网图

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

 

3. 配置步骤

(1)     按照图1-8配置各接口的IP地址,并确保路由可达,具体配置过程略。

(2)     配置Switch C

# 开启NTP服务。

<SwitchC> system-view

[SwitchC] ntp-service enable

# 配置通过NTP协议获取时间。

[SwitchC] clock protocol ntp

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

[SwitchC] ntp-service refclock-master 2

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

[SwitchC] interface vlan-interface 2

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

(3)     配置Switch A

# 开启NTP服务。

<SwitchA> system-view

[SwitchA] ntp-service enable

# 配置通过NTP协议获取时间。

[SwitchA] clock protocol ntp

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

[SwitchA] interface vlan-interface 2

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

(4)     配置Switch B

# 开启NTP服务。

<SwitchB> system-view

[SwitchB] ntp-service enable

# 配置通过NTP协议获取时间。

[SwitchB] clock protocol ntp

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

[SwitchB] interface vlan-interface 2

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

4. 验证配置

# Switch A和Switch B接收到Switch C发出的广播报文后,与其同步。以Switch A为例,同步后查看Switch A的状态。可以看出,Switch A已经与Switch C同步,层数比Switch C的层数大1,为3。

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

 Stability: 0.000 pps

 Clock precision: 2^-19

 Root delay: 0.00229 ms

 Root dispersion: 4.12572 ms

 Reference time: d0d289fe.ec43c720  Sat, Jan  8 2011  7:00:14.922

 System poll interval: 64 s

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

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

       source          reference       stra reach poll  now offset  delay disper

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

 [1245]3.0.1.31        127.127.1.0        2     1   64  519   -0.0 0.0022 4.1257

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

 Total sessions: 1

1.12.6  配置NTP组播模式

1. 组网需求

为了实现Switch C作为不同网段中多个设备的时间服务器,同时同步多个设备的时间,要求:

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

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

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

2. 组网图

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

 

3. 配置步骤

(1)     按照图1-9配置各接口的IP地址,并确保路由可达,具体配置过程略。

(2)     配置Switch C

# 开启NTP服务。

<SwitchC> system-view

[SwitchC] ntp-service enable

# 配置通过NTP协议获取时间。

[SwitchC] clock protocol ntp

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

[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

# 开启NTP服务。

<SwitchD> system-view

[SwitchD] ntp-service enable

# 配置通过NTP协议获取时间。

[SwitchD] clock protocol ntp

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

[SwitchD] interface vlan-interface 2

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

(4)     验证配置一

# 由于Switch D和Switch C在同一个网段,不需要配置组播功能,Switch D就可以收到Switch C发出的组播报文,并与其同步。同步后查看Switch D的状态。可以看出,Switch D已经与Switch C同步,层数比Switch C的层数大1,为3。

[SwitchD-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.044281 s

 Stability: 0.000 pps

 Clock precision: 2^-19

 Root delay: 0.00229 ms

 Root dispersion: 4.12572 ms

 Reference time: d0d289fe.ec43c720  Sat, Jan  8 2011  7:00:14.922

 System poll interval: 64 s

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

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

       source          reference       stra reach poll  now offset  delay disper

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

 [1245]3.0.1.31        127.127.1.0        2     1   64  519   -0.0 0.0022 4.1257

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

 Total sessions: 1

(5)     配置Switch B

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

# 配置组播功能。

<SwitchB> system-view

[SwitchB] multicast routing

[SwitchB-mrib] quit

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

[SwitchB-igmp-snooping] quit

[SwitchB] interface gigabitethernet 1/0/1

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

(6)     配置Switch A

# 开启NTP服务。

<SwitchA> system-view

[SwitchA] ntp-service enable

# 配置通过NTP协议获取时间。

[SwitchA] clock protocol ntp

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

[SwitchA] interface vlan-interface 3

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

(7)     验证配置二

# 同步后查看Switch A的状态。可以看出,Switch A已经与Switch C同步,层数比Switch C的层数大1,为3。

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

 Stability: 0.000 pps

 Clock precision: 2^-19

 Root delay: 0.00534 ms

 Root dispersion: 4.51282 ms

 Reference time: d0c61289.10b1193f  Wed, Dec 29 2010 20:03:21.065

 System poll interval: 64 s

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

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

       source          reference       stra reach poll  now offset  delay disper

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

 [1234]3.0.1.31        127.127.1.0        2   247   64  381   -0.0 0.0053 4.5128

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

 Total sessions: 1

1.12.7  配置IPv6 NTP组播模式

1. 组网需求

为了实现Switch C作为不同网段中多个设备的时间服务器,同时同步多个设备的时间,要求:

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

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

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

2. 组网图

图1-10 配置IPv6 NTP组播模式组网图

 

3. 配置步骤

(1)     按照图1-10配置各接口的IP地址,并确保路由可达,具体配置过程略。

(2)     配置Switch C

# 开启NTP服务。

<SwitchC> system-view

[SwitchC] ntp-service enable

# 配置通过NTP协议获取时间。

[SwitchC] clock protocol ntp

# 设置本地时钟作为参考时钟,层数为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

(3)     配置Switch D

# 开启NTP服务。

<SwitchD> system-view

[SwitchD] ntp-service enable

# 配置通过NTP协议获取时间。

[SwitchD] clock protocol ntp

# 设置Switch D为IPv6组播客户端,在VLAN接口2监听目的地址为FF24::1的NTP组播报文。

[SwitchD] interface vlan-interface 2

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

(4)     验证配置一

# 由于Switch D和Switch C在同一个网段,不需要配置IPv6组播功能,Switch D就可以收到Switch C发出的IPv6组播报文,并与其同步。同步后查看Switch D的状态。Switch D已经与Switch C同步,层数比Switch C的层数大1,为3。

[SwitchD-Vlan-interface2] 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.000977 s

 Stability: 0.000 pps

 Clock precision: 2^-19

 Root delay: 0.00000 ms

 Root dispersion: 8.00578 ms

 Reference time: d0c60680.9754fb17  Wed, Dec 29 2010 19:12:00.591

 System poll interval: 64 s

# 查看Switch D的NTP服务的所有IPv6会话信息,可以看到Switch D与Switch C建立了会话。

[SwitchD-Vlan-interface2] display ntp-service ipv6 sessions

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

 

 Source:  [1234]3000::2

 Reference: 127.127.1.0           Clock stratum: 2

 Reachabilities: 111              Poll interval: 64

 Last receive time: 23            Offset: -0.0

 Roundtrip delay: 0.0             Dispersion: 0.0

 

 Total sessions: 1

(5)     配置Switch B

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

# 配置IPv6组播功能。

<SwitchB> system-view

[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 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 gigabitethernet 1/0/1

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

(6)     配置Switch A

# 开启NTP服务。

<SwitchA> system-view

[SwitchA] ntp-service enable

# 配置通过NTP协议获取时间。

[SwitchA] clock protocol ntp

# 设置Switch A为IPv6组播客户端,在VLAN接口3监听目的地址为FF24::1的NTP组播报文。

[SwitchA] interface vlan-interface 3

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

(7)     验证配置二

# 同步后查看Switch A的状态。可以看出,Switch A已经与Switch C同步,层数比Switch C的层数大1,为3。

[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^-19

 Root delay: 0.00534 ms

 Root dispersion: 4.51282 ms

 Reference time: d0c61289.10b1193f  Wed, Dec 29 2010 20:03:21.065

 System poll interval: 64 s

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

[SwitchA-Vlan-interface3] display ntp-service ipv6 sessions

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

 

 Source:   [124]3000::2

 Reference: 127.127.1.0           Clock stratum: 2

 Reachabilities: 2                Poll interval: 64

 Last receive time: 71            Offset: -0.0

 Roundtrip delay: 0.0             Dispersion: 0.0

 

 Total sessions: 1

1.12.8  配置带验证功能的NTP客户端/服务器模式

1. 组网需求

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

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

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

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

2. 组网图

图1-11 配置带身份验证的NTP客户端/服务器模式组网图

 

3. 配置步骤

(1)     按照图1-11配置各接口的IP地址,并确保路由可达,具体配置过程略。

(2)     配置Device A的本地时钟作为参考时钟

# 开启NTP服务。

<DeviceA> system-view

[DeviceA] ntp-service enable

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

[DeviceA] ntp-service refclock-master 2

(3)     配置Device B

# 开启NTP服务。

<DeviceB> system-view

[DeviceB] ntp-service enable

# 配置通过NTP协议获取时间。

[DeviceB] clock protocol ntp

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

[DeviceB] ntp-service authentication enable

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

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

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

[DeviceB] ntp-service reliable authentication-keyid 42

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

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

以上配置将使得Device B与Device A进行时间同步,但由于Device A没有开启NTP身份验证,所以,Device B还是无法与Device A同步。

(4)     在Device A上配置NTP验证功能。

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

[DeviceA] ntp-service authentication enable

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

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

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

[DeviceA] ntp-service reliable authentication-keyid 42

4. 验证配置

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

[DeviceB] 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^-19

 Root delay: 0.00655 ms

 Root dispersion: 1.15869 ms

 Reference time: d0c62687.ab1bba7d  Wed, Dec 29 2010 21:28:39.668

 System poll interval: 64 s

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

[DeviceB] 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.12.9  配置带验证功能的NTP广播模式

1. 组网需求

Switch C作为同一网段中多个设备的时间服务器,同时同步多个设备的时间。Switch A和Switch B要求对时间服务器进行验证,以保证时间同步的安全性。为了实现上述需求,要求:

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

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

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

·     在Switch A、Switch B和Switch C上配置NTP验证功能。

2. 组网图

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

 

3. 配置步骤

(1)     按照图1-12配置各接口的IP地址,并确保路由可达,具体配置过程略。

(2)     配置Switch A

# 开启NTP服务。

<SwitchA> system-view

[SwitchA] ntp-service enable

# 配置通过NTP协议获取时间。

[SwitchA] clock protocol ntp

# 开启NTP验证功能,创建ID为88的NTP验证密钥,密钥值为123456,以明文形式输入,并将密钥88指定为可信密钥。

[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广播客户端,从VLAN接口2监听广播报文。

[SwitchA] interface vlan-interface 2

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

(3)     配置Switch B

# 开启NTP服务。

<SwitchB> system-view

[SwitchB] ntp-service enable

# 配置通过NTP协议获取时间。

[SwitchB] clock protocol ntp

# 开启NTP验证功能,创建ID为88的NTP验证密钥,密钥值为123456,以明文形式输入,并将密钥88指定为可信密钥。

[SwitchB] ntp-service authentication enable

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

[SwitchB] ntp-service reliable authentication-keyid 88

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

[SwitchB] interface vlan-interface 2

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

(4)     配置Switch C作为NTP广播服务器

# 开启NTP服务。

<SwitchC> system-view

[SwitchC] ntp-service enable

# 配置通过NTP协议获取时间。

[SwitchC] clock protocol ntp

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

[SwitchC] ntp-service refclock-master 3

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

[SwitchC] interface vlan-interface 2

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

[SwitchC-Vlan-interface2] quit

(5)     验证配置一

# 由于Switch A和Switch B上开启了NTP验证功能,Switch C上没有开启NTP验证功能。因此,Switch A和Switch B无法与Switch C的时间同步。以Switch B为例,查看NTP服务的状态。

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

 Clock status: unsynchronized

 Clock stratum: 16

 Reference clock ID: none

(6)     在Switch C上配置NTP验证功能

# 在Switch C上开启NTP验证功能,创建ID为88的NTP验证密钥,密钥值为123456,以明文形式输入,并将密钥88指定为可信密钥。

[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广播服务器并指定关联的密钥编号为88。

[SwitchC] interface vlan-interface 2

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

(7)     验证配置二

# 在Switch C上开启NTP验证功能后,Switch A和Switch B可以与Switch C的时间同步。以Switch B为例,查看NTP服务的状态信息,可以看到Switch B已经与Switch C同步,层数比Switch C的层数大1,为4。

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

 Clock status: synchronized

 Clock stratum: 4

 System peer: 3.0.1.31

 Local mode: bclient

 Reference clock ID: 3.0.1.31

 Leap indicator: 00

 Clock jitter: 0.006683 s

 Stability: 0.000 pps

 Clock precision: 2^-19

 Root delay: 0.00127 ms

 Root dispersion: 2.89877 ms

 Reference time: d0d287a7.3119666f  Sat, Jan  8 2011  6:50:15.191

 System poll interval: 64 s

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

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

       source          reference       stra reach poll  now offset  delay disper

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

 [1245]3.0.1.31        127.127.1.0        3     3   64   68   -0.0 0.0000    0.0

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

 Total sessions: 1

编辑答案

你正在编辑答案

如果你要对问题或其他回答进行点评或询问,请使用评论功能。

分享扩散:

提出建议

    +

亲~登录后才可以操作哦!

确定

亲~检测到您登陆的账号未在http://hclhub.h3c.com进行注册

注册后可访问此模块

跳转hclhub

你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作

举报

×

侵犯我的权益 >
对根叔社区有害的内容 >
辱骂、歧视、挑衅等(不友善)

侵犯我的权益

×

泄露了我的隐私 >
侵犯了我企业的权益 >
抄袭了我的内容 >
诽谤我 >
辱骂、歧视、挑衅等(不友善)
骚扰我

泄露了我的隐私

×

您好,当您发现根叔知了上有泄漏您隐私的内容时,您可以向根叔知了进行举报。 请您把以下内容通过邮件发送到pub.zhiliao@h3c.com 邮箱,我们会尽快处理。
  • 1. 您认为哪些内容泄露了您的隐私?(请在邮件中列出您举报的内容、链接地址,并给出简短的说明)
  • 2. 您是谁?(身份证明材料,可以是身份证或护照等证件)

侵犯了我企业的权益

×

您好,当您发现根叔知了上有关于您企业的造谣与诽谤、商业侵权等内容时,您可以向根叔知了进行举报。 请您把以下内容通过邮件发送到 pub.zhiliao@h3c.com 邮箱,我们会在审核后尽快给您答复。
  • 1. 您举报的内容是什么?(请在邮件中列出您举报的内容和链接地址)
  • 2. 您是谁?(身份证明材料,可以是身份证或护照等证件)
  • 3. 是哪家企业?(营业执照,单位登记证明等证件)
  • 4. 您与该企业的关系是?(您是企业法人或被授权人,需提供企业委托授权书)
我们认为知名企业应该坦然接受公众讨论,对于答案中不准确的部分,我们欢迎您以正式或非正式身份在根叔知了上进行澄清。

抄袭了我的内容

×

原文链接或出处

诽谤我

×

您好,当您发现根叔知了上有诽谤您的内容时,您可以向根叔知了进行举报。 请您把以下内容通过邮件发送到pub.zhiliao@h3c.com 邮箱,我们会尽快处理。
  • 1. 您举报的内容以及侵犯了您什么权益?(请在邮件中列出您举报的内容、链接地址,并给出简短的说明)
  • 2. 您是谁?(身份证明材料,可以是身份证或护照等证件)
我们认为知名企业应该坦然接受公众讨论,对于答案中不准确的部分,我们欢迎您以正式或非正式身份在根叔知了上进行澄清。

对根叔社区有害的内容

×

垃圾广告信息
色情、暴力、血腥等违反法律法规的内容
政治敏感
不规范转载 >
辱骂、歧视、挑衅等(不友善)
骚扰我
诱导投票

不规范转载

×

举报说明