17-H3C SR6600-F路由器 NTP典型配置举例
本章节下载: 17-H3C SR6600-F路由器 NTP典型配置举例 (255.37 KB)
H3C SR6600-F 路由器NTP典型配置举例
Copyright © 2018 新华三技术有限公司 版权所有,保留一切权利。 非经本公司书面许可,任何单位和个人不得擅自摘抄、复制本文档内容的部分或全部, 并不得以任何形式传播。本文档中的信息可能变动,恕不另行通知。 |
|
目 录
本章介绍了与NTP有关的各种典型配置举例。
本文档不严格与具体软、硬件版本对应,如果使用过程中与产品实际情况有差异,请参考相关产品手册,或以设备实际情况为准。
本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。
本文档假设您已了解NTP特性。
如图3-1所示,网络中有一台时间服务器Device A,为网络中的其它设备提供精确的时间服务,为保证网络中的所有设备能保持一致、统一的时钟,现要求配置NTP服务器/客户端模式,使所有设备能从时间服务器Device A上获得时钟同步。
图3-1 配置NTP服务器/客户端模式组网图
本举例是在R7607版本上进行配置和验证的。
# 配置接口GigabitEthernet2/1/1的IP地址。
<DeviceA> system-view
[DeviceA] interface gigabitethernet 2/1/1
[DeviceA-GigabitEthernet2/1/1] ip address 1.0.1.11 24
[DeviceA-GigabitEthernet2/1/1] quit
# 开启NTP功能。
[DeviceA] ntp-service enable
# 设置本地时钟作为参考时钟,层数为2。
[DeviceA] ntp-service refclock-master 2
# 配置接口的IP地址,配置步骤这里省略。
# 开启NTP功能。
<DeviceB> system-view
[DeviceB] ntp-service enable
# 设置NTP Server为Device B的时间服务器。
[DeviceB] ntp-service unicast-server 1.0.1.11
# 配置接口的IP地址,配置步骤这里省略。
# 开启NTP功能。
<DeviceC> system-view
[DeviceC] ntp-service enable
# 设置NTP Server为Device C的时间服务器。
[DeviceC] ntp-service unicast-server 1.0.1.11
# 以上配置完成后,Device B和Device C向Device A进行时间同步。以Device B为例,查看NTP的运行状态。
[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.003479 s
Stability: 0.000 pps
Clock precision: 2^-16
Root delay: 1.95313 ms
Root dispersion: 28.38135 ms
Reference time: d5ed8cd5.577006ea Wed, Sep 25 2017 16:24:53.341
此时Device B已经与Device A同步,层数比Device A的层数大1,为3。
# 查看Device B的NTP会话信息,可以看到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 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
· Device A上的配置
#
interface GigabitEthernet2/1/1
ip address 1.0.1.11 255.255.255.0
#
ntp-service enable
ntp-service refclock-master 2
#
· Device B上的配置
#
interface GigabitEthernet2/1/1
ip address 1.0.1.12 255.255.255.0
#
ntp-service enable
ntp-service unicast-server 1.0.1.11
#
· Device C上的配置
#
interface GigabitEthernet2/1/1
ip address 1.0.1.13 255.255.255.0
#
ntp-service enable
ntp-service unicast-server 1.0.1.11
#
如图4-1所示,网络中设备较多,所有设备都位于同一个网段(3.0.1.0/24)中,为了便于管理,现要求通过配置NTP广播模式,使网络中的设备拥有一致,统一的时间。
图4-1 NTP广播模式配置组网图
本举例是在R7607版本上进行配置和验证的。
# 开启NTP功能。
<DeviceC> system-view
[DeviceC] ntp-service enable
# 设置本地时钟作为参考时钟,层数为2。
[DeviceC] ntp-service refclock-master 2
# 配置接口的IP地址。
[DeviceC] interface gigabitethernet 2/1/1
[DeviceC-GigabitEthernet2/1/1] ip address 3.0.1.31 24
[DeviceC-GigabitEthernet2/1/1] quit
[DeviceC] interface gigabitethernet 2/1/2
[DeviceC-GigabitEthernet2/1/2] ip address 3.0.1.39 24
[DeviceC-GigabitEthernet2/1/2] quit
# 配置Device C为广播服务器,向网络中发送NTP广播报文。
[DeviceC] interface gigabitethernet 2/1/1
[DeviceC-GigabitEthernet2/1/1] ntp-service broadcast-server
[DeviceC-GigabitEthernet2/1/1] quit
[DeviceC] interface gigabitethernet 2/1/2
[DeviceC-GigabitEthernet2/1/2] ntp-service broadcast-server
[DeviceC-GigabitEthernet2/1/2] quit
# 配置接口的IP地址,配置步骤这里省略。
# 开启NTP功能。
<DeviceA> system-view
[DeviceA] ntp-service enable
# 设置为广播客户端,从GigabitEthernet2/1/1监听广播消息。
[DeviceA] interface gigabitethernet 2/1/1
[DeviceA-GigabitEthernet2/1/1] ntp-service broadcast-client
Device B、Device D和Device E的配置与Device A相同,此处不再赘述。
# 以Device A为例,查看NTP的运行状态。
[DeviceA-GigabitEthernet2/1/1] 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^-16
Root delay: 0.00000 ms
Root dispersion: 7951.43127 ms
Reference time: d5ee8d88.2faabed0 Thu, Sep 26 2017 10:40:08.186
此时Device A已经与Device C同步,层数比Device C的层数大1,为3。
# 查看Device A的NTP会话信息,可以看到Device A与Device C建立了连接。
[DeviceA-GigabitEthernet2/1/1] 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
· 设备Device C
#
interface GigabitEthernet2/1/1
ip address 3.0.1.31 255.255.255.0
ntp-service broadcast-server
#
interface GigabitEthernet2/1/2
ip address 3.0.1.39 255.255.255.0
ntp-service broadcast-server
#
ntp-service enable
ntp-service refclock-master 2
#
· 设备Device A
#
interface GigabitEthernet2/1/1
ip address 3.0.1.33 255.255.255.0
ntp-service broadcast-client
#
ntp-service enable
#
· 设备Device B
#
interface GigabitEthernet2/1/1
ip address 3.0.1.30 255.255.255.0
ntp-service broadcast-client
#
ntp-service enable
#
· 设备Device D
#
interface GigabitEthernet2/1/1
ip address 3.0.1.32 255.255.255.0
ntp-service broadcast-client
#
ntp-service enable
#
#
interface GigabitEthernet2/1/1
ip address 3.0.1.34 255.255.255.0
ntp-service broadcast-client
#
ntp-service enable
#
如图5-1所示,网络中有一台时间服务器Device C,网络中设备较多,而且这些设备分布在不同网段中,为了便于管理,现要求配置NTP组播模式,使网络中的设备拥有统一,一致的时间。
图5-1 配置NTP组播模式组网图
本举例是在R7607版本上进行配置和验证的。
# 开启NTP功能。
<DeviceC> system-view
[DeviceC] ntp-service enable
# 设置本地时钟作为参考时钟,层数为2。
[DeviceC] ntp-service refclock-master 2
# 配置接口GigabitEthernet2/1/1的IP地址。
[DeviceC] interface gigabitethernet 2/1/1
[DeviceC-GigabitEthernet2/1/1] ip address 3.0.1.31 24
# 设置Device C为组播服务器,从接口GigabitEthernet2/1/1发送组播报文。
[DeviceC-GigabitEthernet2/1/1] ntp-service multicast-server
# 开启NTP功能。
<DeviceD> system-view
[DeviceD] ntp-service enable
# 配置接口GigabitEthernet2/1/1的IP地址。
[DeviceD] interface gigabitethernet 2/1/1
[DeviceD-GigabitEthernet2/1/1] ip address 3.0.1.32 24
# 设置Device D为组播客户端,从接口 GigabitEthernet2/1/1监听组播报文。
[DeviceD-GigabitEthernet2/1/1] ntp-service multicast-client
# 配置接口的IP地址,配置步骤这里省略。
# 开启NTP功能。
<DeviceB> system-view
[DeviceB] ntp-service enable
# 设置Device B为组播客户端,从接口GigabitEthernet2/1/2监听组播报文。
[DeviceB] interface gigabitethernet 2/1/2
[DeviceB-GigabitEthernet2/1/2] ntp-service multicast-client
[DeviceB-GigabitEthernet2/1/2] quit
由于Device A与Device C不在同一网段,所以Device B上需要配置组播功能,否则Device A收不到Device C发出的组播报文。
# 配置组播功能。
[DeviceB] multicast routing
[DeviceB] interface gigabitethernet 2/1/2
[DeviceB-GigabitEthernet2/1/2] pim dm
[DeviceB-GigabitEthernet2/1/2] quit
[DeviceB] interface gigabitethernet 2/1/1
[DeviceB-GigabitEthernet2/1/1] ip address 1.0.1.10 24
[DeviceB-GigabitEthernet2/1/1] igmp enable
[DeviceB-GigabitEthernet2/1/1] igmp static-group 224.0.1.1
[DeviceB-GigabitEthernet2/1/1] quit
# 开启NTP功能。
<DeviceA> system-view
[DeviceA] ntp-service enable
# 配置接口GigabitEthernet2/1/1的IP地址。
[DeviceA] interface gigabitethernet 2/1/1
[DeviceA-GigabitEthernet2/1/1] ip address 1.0.1.11 24
# 设置Device A为组播客户端,从接口GigabitEthernet2/1/1监听组播报文。
[DeviceA-GigabitEthernet2/1/1] ntp-service multicast-client
# 以Device A为例,查看NTP的运行状态。
[DeviceA-GigabitEthernet2/1/1] 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^-16
Root delay: 1.69373 ms
Root dispersion: 1950.18005 ms
Reference time: d5ee9b15.2f3a684d Thu, Sep 26 2017 11:37:57.184
此时Device A已经与Device C同步,层数比Device C的层数大1,为3。
· 设备Device A
#
ntp-service enable
#
interface GigabitEthernet2/1/1
ip address 1.0.1.11 255.255.255.0
ntp-service multicast-client
#
· 设备Device B
#
ntp-service enable
#
multicast routing
#
interface GigabitEthernet2/1/2
ip address 3.0.1.30 255.255.255.0
pim dm
ntp-service multicast-client
#
interface GigabitEthernet2/1/1
ip address 1.0.1.10 255.255.255.0
igmp enable
igmp static-group 224.0.1.1
#
· 设备Device C
#
ntp-service enable
ntp-service refclock-master 2
#
interface GigabitEthernet2/1/1
ip address 3.0.1.31 255.255.255.0
ntp-service multicast-server
#
· 设备Device D
#
ntp-service enable
#
interface GigabitEthernet2/1/1
ip address 3.0.1.32 255.255.255.0
ntp-service multicast-client
#
网络中有一台时间服务器Device A,为网络中的其它设备提供精确的时间服务,为保证网络中的所有设备能保持一致、统一的时钟,现要求:
· 配置NTP服务器/客户端模式,使所有设备能从时间服务器Device A上获得时钟同步。
· 设备在获得时钟同步前,需要通过Device A的NTP验证。
图6-1 带身份验证的NTP客户端/服务器模式典型配置举例组网图
本举例是在R7607版本上进行配置和验证的。
# 配置接口GigabitEthernet2/1/1的IP地址。
<DeviceA> system-view
[DeviceA] interface gigabitethernet 2/1/1
[DeviceA-GigabitEthernet2/1/1] ip address 1.0.1.11 24
[DeviceA-GigabitEthernet2/1/1] quit
# 开启NTP服务。
[DeviceA] ntp-service enable
# 设置本地时钟作为参考时钟,层数为2。
[DeviceA] ntp-service refclock-master 2
# 在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
# 配置接口的IP地址,配置步骤这里省略。
# 开启NTP服务。
<DeviceB> system-view
[DeviceB] ntp-service enable
# 在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进行时间同步。
# 配置接口的IP地址,配置步骤这里省略。
# 开启NTP服务。
<DeviceC> system-view
[DeviceC] ntp-service enable
# 在Device C上启动NTP验证功能。
[DeviceC] ntp-service authentication enable
# 创建编号为42的NTP验证密钥,密钥值为aNiceKey,以明文形式输入。
[DeviceC] ntp-service authentication-keyid 42 authentication-mode md5 simple aNiceKey
# 配置编号为42的密钥为可信密钥。
[DeviceC] ntp-service reliable authentication-keyid 42
# 设置Device A为Device C的NTP服务器,并将该服务器与编号为42的密钥关联。
[DeviceC] ntp-service unicast-server 1.0.1.11 authentication-keyid 42
以上配置将使得Device C与Device A进行时间同步。
# 完成上述配置后,Device B、DeviceC可以与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^-16
Root delay: 0.00655 ms
Root dispersion: 1.15869 ms
Reference time: d0c62687.ab1bba7d Mon, Sep 30 2017 16:06:26.764
# 查看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
· 设备Device A
#
interface GigabitEthernet2/1/1
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
#
· 设备Device B
#
interface GigabitEthernet2/1/1
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
#
· 设备Device C
#
interface GigabitEthernet2/1/1
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-1所示,网络中有一台时间服务器Device A,为网络中的其它网络设备提供精确的时间服务,为保证网络中的所有设备能保持一致、统一的时钟,现要求配置所有网络设备为SNTP客户端,使所有设备能从时间服务器Device A上获得时钟同步。
图7-1 SNTP典型配置举例组网图
本举例是在R7607版本上进行配置和验证的。
# 配置接口GigabitEthernet2/1/1的IP地址。
<DeviceA> system-view
[DeviceA] interface gigabitethernet 2/1/1
[DeviceA-GigabitEthernet2/1/1 ip address 1.0.1.11 24
# 开启NTP功能。
[DeviceA] ntp-service enable
# 设置本地时钟作为参考时钟,层数为2。
[DeviceA] ntp-service refclock-master 2
# 配置接口的IP地址,配置步骤这里省略。
# 开启SNTP功能。
<DeviceB> system-view
[DeviceB] sntp enable
# 设置Device A为Device B的时间服务器。
[DeviceB] sntp unicast-server 1.0.1.11
# 配置接口的IP地址,配置步骤这里省略。
# 开启SNTP功能。
<DeviceC> system-view
[DeviceC] sntp enable
# 设置Device A为Device C的时间服务器。
[DeviceC] sntp unicast-server 1.0.1.11
# 以上配置完成后,Device B和Device C向Device A进行时间同步。以Device B为例,查看Device B的NTP会话信息,可以看到Device B与Device A建立了连接。
[DeviceB] display sntp sessions
SNTP server Stratum Version Last receive time
1.0.1.11 2 4 Thu, Sep 26 2017 17:25:09.121 (Synced)
· Device A上的配置
#
interface GigabitEthernet2/1/1
ip address 1.0.1.11 255.255.255.0
#
ntp-service enable
ntp-service refclock-master 2
#
· Device B上的配置
#
interface GigabitEthernet2/1/1
ip address 1.0.1.12 255.255.255.0
#
sntp enable
sntp unicast-server 1.0.1.11
#
· Device C上的配置
#
interface GigabitEthernet2/1/1
ip address 1.0.1.13 255.255.255.0
#
sntp enable
sntp unicast-server 1.0.1.11
#
· H3C SR6600-F 路由器 网络管理和监控配置指导-R7607
· H3C SR6600-F 路由器 网络管理和监控命令参考-R7607
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!