41-NTP典型配置舉例
本章節下載: 41-NTP典型配置舉例 (362.71 KB)
資料版本:6W100-20190628
Copyright © 2019 bobty下载软件 版權所有,保留一切權利。
非經本公司書麵許可,任何單位和個人不得擅自摘抄、複製本文檔內容的部分或全部,並不得以任何形式傳播。
除bobty下载软件 的商標外,本手冊中出現的其它公司的商標、產品標識及商品名稱,由各自權利人擁有。
本文檔中的信息可能變動,恕不另行通知。
目 錄
本章介紹了與NTP有關的各種典型配置舉例。
本文檔不嚴格與具體軟、硬件版本對應,如果使用過程中與產品實際情況有差異,請參考相關產品手冊,或以設備實際情況為準。
本文檔中的配置均是在實驗室環境下進行的配置和驗證,配置前設備的所有參數均采用出廠時的缺省配置。如果您已經對設備進行了配置,為了保證配置效果,請確認現有配置和以下舉例中的配置不衝突。
本文檔假設您已了解NTP特性。
如圖1所示,網絡中有一台時間服務器Device A,為網絡中的其它設備提供精確的時間服務,為保證網絡中的所有設備能保持一致、統一的時鍾,現要求配置NTP服務器/客戶端模式,使所有設備能從時間服務器Device A上獲得時鍾同步。
圖1 配置NTP服務器/客戶端模式組網圖
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的。
# 配置接口Vlan-interface2的IP地址。
<DeviceA> system-view
[DeviceA] interface Vlan-interface 2
[DeviceA-Vlan-interface2] ip address 1.0.1.11 24
[DeviceA-Vlan-interface2] 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^-18
Root delay: 1.95313 ms
Root dispersion: 28.38135 ms
Reference time: d5ed8cd5.577006ea Wed, Sep 25 2018 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 Vlan-interface2
ip address 1.0.1.11 255.255.255.0
#
ntp-service enable
ntp-service refclock-master 2
#
· Device B上的配置
#
interface Vlan-interface2
ip address 1.0.1.12 255.255.255.0
#
ntp-service enable
ntp-service unicast-server 1.0.1.11
#
· Device C上的配置
#
interface Vlan-interface2
ip address 1.0.1.13 255.255.255.0
#
ntp-service enable
ntp-service unicast-server 1.0.1.11
#
如圖2所示,網絡中設備較多,所有設備都位於同一個網段(3.0.1.0/24)中,為了便於管理,現要求通過配置NTP廣播模式,使網絡中的設備擁有一致,統一的時間。
圖2 NTP廣播模式配置組網圖
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的。
# 開啟NTP功能。
<DeviceC> system-view
[DeviceC] ntp-service enable
# 設置本地時鍾作為參考時鍾,層數為2。
[DeviceC] ntp-service refclock-master 2
# 配置接口Vlan-interface2的IP地址。
[DeviceC] interface Vlan-interface 2
[DeviceC-Vlan-interface2] ip address 3.0.1.31 24
# 配置Device C為廣播服務器,從Vlan-interface2向網絡中發送NTP廣播報文。
[DeviceC-Vlan-interface2] ntp-service broadcast-server
# 配置接口的IP地址,配置步驟這裏省略。
# 開啟NTP功能。
<DeviceA> system-view
[DeviceA] ntp-service enable
# 配置接口Vlan-interface2的IP地址。
[DeviceA] interface Vlan-interface 2
[DeviceA-Vlan-interface2] ip address 3.0.1.33 24
# 設置為廣播客戶端,從Vlan-interface2監聽廣播消息。
[DeviceA-Vlan-interface2] ntp-service broadcast-client
Device B、Device D和Device E的配置與Device A相同,此處不再贅述。
# 以Device A為例,查看NTP的運行狀態。
[DeviceA-Vlan-interface2] display ntp-service status
Clock status: synchronized
Clock stratum: 3
System peer: 3.0.1.31
Local mode: bclient
Reference clock ID: 3.0.1.31
Leap indicator: 00
Clock jitter: 0.000061 s
Stability: 0.000 pps
Clock precision: 2^-18
Root delay: 0.00000 ms
Root dispersion: 7951.43127 ms
Reference time: d5ee8d88.2faabed0 Thu, Sep 26 2018 10:40:08.186
此時Device A已經與Device C同步,層數比Device C的層數大1,為3。
# 查看Device A的NTP會話信息,可以看到Device A與Device C建立了連接。
[DeviceA-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
· 設備Device C
#
interface Vlan-interface2
ip address 3.0.1.31 255.255.255.0
ntp-service broadcast-server
#
ntp-service enable
ntp-service refclock-master 2
#
· 設備Device A
#
interface Vlan-interface2
ip address 3.0.1.33 255.255.255.0
ntp-service broadcast-client
#
ntp-service enable
#
· 設備Device B
#
interface Vlan-interface2
ip address 3.0.1.30 255.255.255.0
ntp-service broadcast-client
#
ntp-service enable
#
· 設備Device D
#
interface Vlan-interface2
ip address 3.0.1.32 255.255.255.0
ntp-service broadcast-client
#
ntp-service enable
#
#
interface Vlan-interface2
ip address 3.0.1.34 255.255.255.0
ntp-service broadcast-client
#
ntp-service enable
#
如圖3所示,網絡中有一台時間服務器Device C,網絡中設備較多,而且這些設備分布在不同網段中,為了便於管理,現要求配置NTP組播模式,使網絡中的設備擁有統一,一致的時間。
圖3 配置NTP組播模式組網圖
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的。
# 開啟NTP功能。
<DeviceC> system-view
[DeviceC] ntp-service enable
# 設置本地時鍾作為參考時鍾,層數為2。
[DeviceC] ntp-service refclock-master 2
# 配置接口Vlan-interface2的IP地址。
[DeviceC] interface Vlan-interface 2
[DeviceC-Vlan-interface2] ip address 3.0.1.31 24
# 設置Device C為組播服務器,從VLAN接口2發送組播報文。
[DeviceC-Vlan-interface2] ntp-service multicast-server
# 開啟NTP功能。
<DeviceD> system-view
[DeviceD] ntp-service enable
# 配置接口Vlan-interface2的IP地址。
[DeviceD] interface Vlan-interface 2
[DeviceD-Vlan-interface2] ip address 3.0.1.32 24
# 設置Device D為組播客戶端,從VLAN接口2監聽組播報文。
[DeviceD-Vlan-interface2] ntp-service multicast-client
# 配置接口的IP地址,配置步驟這裏省略。
# 開啟NTP功能。
<DeviceB> system-view
[DeviceB] ntp-service enable
# 設置Device B為組播客戶端,從VLAN接口2監聽組播報文。
[DeviceB] interface Vlan-interface 2
[DeviceB-Vlan-interface2] ntp-service multicast-client
[DeviceB-Vlan-interface2] quit
由於Device A與Device C不在同一網段,所以Device B上需要配置組播功能,否則Device A收不到Device C發出的組播報文。
# 配置組播功能。
[DeviceB] multicast routing
[DeviceB] interface vlan-interface 2
[DeviceB-Vlan-interface2] pim dm
[DeviceB-Vlan-interface2] quit
[DeviceB] vlan 3
[DeviceB-vlan3] port Ten-GigabitEthernet 1/0/1
[DeviceB-vlan3] quit
[DeviceB] interface vlan-interface 3
[DeviceB-Vlan-interface3] ip address 1.0.1.10 24
[DeviceB-Vlan-interface3] igmp enable
[DeviceB-Vlan-interface3] igmp static-group 224.0.1.1
[DeviceB-Vlan-interface3] quit
[DeviceB] igmp-snooping
[DeviceB-igmp-snooping] quit
[DeviceB] interface Ten-GigabitEthernet 1/0/1
[DeviceB-Ten-GigabitEthernet1/0/1] igmp-snooping static-group 224.0.1.1 vlan 3
# 開啟NTP功能。
<DeviceA> system-view
[DeviceA] ntp-service enable
# 配置接口Vlan-interface3的IP地址。
[DeviceA] interface Vlan-interface 3
[DeviceA-Vlan-interface3] ip address 1.0.1.11 24
# 設置Device A為組播客戶端,從VLAN接口3監聽組播報文。
[DeviceA-Vlan-interface3] ntp-service multicast-client
# 以Device A為例,查看NTP的運行狀態。
[DeviceA-Vlan-interface3] display ntp-service status
Clock status: synchronized
Clock stratum: 3
System peer: 3.0.1.31
Local mode: bclient
Reference clock ID: 3.0.1.31
Leap indicator: 00
Clock jitter: 0.000061 s
Stability: 0.000 pps
Clock precision: 2^-18
Root delay: 1.69373 ms
Root dispersion: 1950.18005 ms
Reference time: d5ee9b15.2f3a684d Thu, Sep 26 2018 11:37:57.184
此時Device A已經與Device C同步,層數比Device C的層數大1,為3。
· 設備Device A
#
ntp-service enable
#
interface Vlan-interface3
ip address 1.0.1.11 255.255.255.0
ntp-service multicast-client
#
· 設備Device B
#
ntp-service enable
#
multicast routing
#
igmp-snooping
#
interface Vlan-interface2
ip address 3.0.1.30 255.255.255.0
pim dm
ntp-service multicast-client
#
interface Vlan-interface3
ip address 1.0.1.10 255.255.255.0
igmp enable
igmp static-group 224.0.1.1
#
interface Ten-GigabitEthernet1/0/1
port access vlan 3
igmp-snooping static-group 224.0.1.1 vlan 3
#
· 設備Device C
#
ntp-service enable
ntp-service refclock-master 2
#
interface Vlan-interface2
ip address 3.0.1.31 255.255.255.0
ntp-service multicast-server
#
· 設備Device D
#
ntp-service enable
#
interface Vlan-interface2
ip address 3.0.1.32 255.255.255.0
ntp-service multicast-client
#
網絡中有一台時間服務器Device A,為網絡中的其它設備提供精確的時間服務,為保證網絡中的所有設備能保持一致、統一的時鍾,現要求:
· 配置NTP服務器/客戶端模式,使所有設備能從時間服務器Device A上獲得時鍾同步。
· 設備在獲得時鍾同步前,需要通過Device A的NTP驗證。
圖4 帶身份驗證的NTP客戶端/服務器模式典型配置舉例組網圖
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的。
# 配置接口Vlan-interface2的IP地址。
<DeviceA> system-view
[DeviceA] interface Vlan-interface 2
[DeviceA-Vlan-interface2] ip address 1.0.1.11 24
# 開啟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^-18
Root delay: 0.00655 ms
Root dispersion: 1.15869 ms
Reference time: d0c62687.ab1bba7d Mon, Sep 30 2018 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 Vlan-interface2
ip address 1.0.1.11 255.255.255.0
#
ntp-service enable
ntp-service authentication enable
ntp-service authentication-keyid 42 authentication-mode md5 cipher $c$3$4j3SKCgQWBK3Un41B9U0JXzJX9i7IuNoSqi
ntp-service reliable authentication-keyid 42
ntp-service refclock-master 2
#
· 設備Device B
#
interface Vlan-interface2
ip address 1.0.1.12 255.255.255.0
#
ntp-service enable
ntp-service authentication enable
ntp-service authentication-keyid 42 authentication-mode md5 cipher $c$3$22eIc8l796cpudZqiaAZ2SLzIfrgzFTVYn8X
ntp-service reliable authentication-keyid 42
ntp-service unicast-server 1.0.1.11 authentication-keyid 42
#
· 設備Device C
#
interface Vlan-interface2
ip address 1.0.1.13 255.255.255.0
#
ntp-service enable
ntp-service authentication enable
ntp-service authentication-keyid 42 authentication-mode md5 cipher $c$3$XJzVmJ1TJbWyYAXpPXxF7JiEOZag8CehibM8
ntp-service reliable authentication-keyid 42
ntp-service unicast-server 1.0.1.11 authentication-keyid 42
#
如圖5所示,網絡中有一台時間服務器Device A,為網絡中的其它網絡設備提供精確的時間服務,為保證網絡中的所有設備能保持一致、統一的時鍾,現要求配置所有網絡設備為SNTP客戶端,使所有設備能從時間服務器Device A上獲得時鍾同步。
圖5 SNTP典型配置舉例組網圖
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的。
# 配置接口Vlan-interface2的IP地址。
<DeviceA> system-view
[DeviceA] interface Vlan-interface 2
[DeviceA-Vlan-interface2] 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 2018 17:25:09.121 (Synced)
· Device A上的配置
#
interface Vlan-interface2
ip address 1.0.1.11 255.255.255.0
#
ntp-service enable
ntp-service refclock-master 2
#
· Device B上的配置
#
interface Vlan-interface2
ip address 1.0.1.12 255.255.255.0
#
sntp enable
sntp unicast-server 1.0.1.11
#
· Device C上的配置
#
interface Vlan-interface2
ip address 1.0.1.13 255.255.255.0
#
sntp enable
sntp unicast-server 1.0.1.11
#
如3.1 圖1所示,IPv6網絡中有一台時間服務器Device A,為網絡中的其它設備提供精確的時間服務,為保證網絡中所有設備的時間保持一致,現要求配置IPv6 NTP服務器/客戶端模式,使所有設備能從時間服務器Device A上獲得時鍾同步。
圖6 配置IPv6 NTP服務器/客戶端模式組網圖
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的。
# 配置接口Vlan-interface2的IP地址。
<DeviceA> system-view
[DeviceA] interface vlan-interface 2
[DeviceA-Vlan-interface2] ipv6 address 3000::34 64
[DeviceA-Vlan-interface2] 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 ipv6 unicast-server 3000::34
# 配置接口的IP地址,配置步驟這裏省略。
# 開啟NTP功能。
<DeviceC> system-view
[DeviceC] ntp-service enable
# 設置NTP Server為Device C的時間服務器。
[DeviceC] ntp-service ipv6 unicast-server 3000::34
# 以上配置完成後,Device B和Device C向Device A進行時間同步。以Device B為例,查看NTP的運行狀態。
[DeviceB] display ntp-service status
Clock status: synchronized
Clock stratum: 3
System peer: 3000::34
Local mode: client
Reference clock ID: 95.197.17.40
Leap indicator: 00
Clock jitter: 0.003479 s
Stability: 0.000 pps
Clock precision: 2^-18
Root delay: 1.95313 ms
Root dispersion: 28.38135 ms
Reference time: d5ed8cd5.577006ea Wed, Sep 25 2018 16:24:53.341
此時Device B已經與Device A同步,層數比Device A的層數大1,為3。
# 查看Device B的NTP會話信息,可以看到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: 3 Poll interval: 64
Last receive time: 62 Offset: 0.1272
Roundtrip delay: 1.8158 Dispersion: 188.47
Total sessions: 1
· 設備Device A
#
interface Vlan-interface2
ipv6 address 3000::34/64
#
ntp-service enable
ntp-service refclock-master 2
#
· 設備Device B
#
interface Vlan-interface2
ipv6 address 3000::35/64
#
ntp-service enable
ntp-service ipv6 unicast-server 3000::34
#
· 設備Device C
#
interface Vlan-interface2
ipv6 address 3000::36/64
#
ntp-service enable
ntp-service ipv6 unicast-server 3000::34
#
如5.1 圖3所示,IPv6網絡中有一台時間服務器Device C,網絡中設備較多,而且這些設備分布在不同網段中,為了便於管理,現要求配置IPv6 NTP組播模式,使網絡中所有設備的時間保持一致。
圖7 配置IPv6 NTP組播模式組網圖
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的。
# 配置路由協議,以保證各設備間能夠路由可達,配置步驟這裏省略。
# 開啟NTP功能。
<DeviceC> system-view
[DeviceC] ntp-service enable
# 設置本地時鍾作為參考時鍾,層數為2。
[DeviceC] ntp-service refclock-master 2
# 配置接口Vlan-interface2的IP地址。
[DeviceC] interface Vlan-interface 2
[DeviceC-Vlan-interface2] ipv6 address 3000::2 64
# 設置Device C為IPv6組播服務器,從VLAN接口2向組播地址FF24::1發送NTP組播報文。
[DeviceC-Vlan-interface2] ntp-service ipv6 multicast-server ff24::1
[DeviceC-Vlan-interface2] quit
# 配置路由協議,以及接口的IP地址,以保證各設備間能夠路由可達,配置步驟這裏省略。
# 開啟NTP功能。
<DeviceD> system-view
[DeviceD] ntp-service enable
# 設置Device D為組播客戶端,從VLAN接口2監聽組播報文。
[DeviceD-Vlan-interface2] ntp-service ipv6 multicast-client ff24::1
[DeviceD-Vlan-interface2] quit
# 配置路由協議,以及接口的IP地址,以保證各設備間能夠路由可達,配置步驟這裏省略。
# 開啟NTP功能。
<DeviceB> system-view
[DeviceB] ntp-service enable
# 設置Device B為組播客戶端,從VLAN接口2監聽組播報文。
[DeviceB-Vlan-interface2] ntp-service ipv6 multicast-client ff24::1
[DeviceB-Vlan-interface2] quit
由於Device A與Device C不在同一網段,所以Device B上需要配置組播功能,否則Device A收不到Device C發出的組播報文。
# 配置組播功能。
[DeviceB] ipv6 multicast routing
[DeviceB-mrib6] quit
[DeviceB] interface vlan-interface 2
[DeviceB-Vlan-interface2] ipv6 pim dm
[DeviceB-Vlan-interface2] quit
[DeviceB] vlan 3
[DeviceB-vlan3] port Ten-GigabitEthernet 1/0/1
[DeviceB-vlan3] quit
[DeviceB] interface vlan-interface 3
[DeviceB-Vlan-interface3] mld enable
[DeviceB-Vlan-interface3] mld static-group ff24::1
[DeviceB-Vlan-interface3] quit
[DeviceB] mld-snooping
[DeviceB-mld-snooping] quit
[DeviceB] interface Ten-GigabitEthernet 1/0/1
[DeviceB-Ten-GigabitEthernet1/0/1] mld-snooping static-group ff24::1 vlan 3
[DeviceB-mld-snooping] quit
# 配置路由協議,以及接口的IP地址,以保證各設備間能夠路由可達,配置步驟這裏省略。
# 開啟NTP功能。
<DeviceA> system-view
[DeviceA] ntp-service enable
# 設置Device A為組播客戶端,從VLAN接口3監聽組播報文。
[DeviceA-Vlan-interface3] ntp-service ipv6 multicast-client ff24::1
[DeviceA-Vlan-interface3] quit
# 以Device A為例,查看NTP的運行狀態。
[DeviceA] display ntp-service status
Clock status: synchronized
Clock stratum: 3
System peer: 3000::2
Local mode: bclient
Reference clock ID: 165.84.121.65
Leap indicator: 00
Clock jitter: 0.000061 s
Stability: 0.000 pps
Clock precision: 2^-18
Root delay: 1.69373 ms
Root dispersion: 1950.18005 ms
Reference time: d5ee9b15.2f3a684d Thu, Sep 26 2018 11:37:57.184
此時Device A已經與Device C同步,層數比Device C的層數大1,為3。
· 設備Device A
#
ntp-service enable
#
interface Vlan-interface3
ipv6 address 2000::1/64
ntp-service ipv6 multicast-client ff24::1
#
· 設備Device B
#
ntp-service enable
#
ipv6 multicast routing
#
mld-snooping
#
interface Vlan-interface2
ipv6 address 3000::1/64
ipv6 pim dm
ntp-service ipv6 multicast-client ff24::1
#
interface Vlan-interface3
ipv6 address 2000::2/64
mld enable
mld static-group ff24::1
#
interface Ten-GigabitEthernet1/0/1
port access vlan 3
mld-snooping static-group ff24::1 vlan 3
#
· 設備Device C
#
ntp-service enable
ntp-service refclock-master 2
#
interface Vlan-interface2
ipv6 address 3000::2/64
ntp-service ipv6 multicast-server ff24::1
#
· 設備Device D
#
ntp-service enable
#
interface Vlan-interface2
ipv6 address 3000::3/64
ntp-service ipv6 multicast-client ff24::1
#
如6.1 圖4所示,網絡中設備較多,所有設備都位於同一個網段(3.0.1.0/24)中,為了使網絡中所有設備的時間保持一致,現要求:
· 配置NTP廣播模式。
· NTP廣播客戶端與NTP廣播服務器進行時間同步前,必須先進行身份驗證,以保證時鍾同步的安全性,防止攻擊者將自己偽裝成為一個時鍾服務器而對客戶時鍾發起攻擊。
圖8 帶身份驗證的NTP廣播模式典型配置舉例組網圖
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的。
# 開啟NTP功能。
<DeviceC> system-view
[DeviceC] ntp-service enable
# 設置本地時鍾作為參考時鍾,層數為2。
[DeviceC] ntp-service refclock-master 2
# 配置NTP驗證,密鑰編號為88,密鑰為123456。
[DeviceC] ntp-service authentication enable
[DeviceC] ntp-service authentication-keyid 88 authentication-mode md5 simple 123456
[DeviceC] ntp-service reliable authentication-keyid 88
# 設置Device C為NTP廣播服務器並指定密鑰編號。
[DeviceC] interface vlan-interface 2
[DeviceC-Vlan-interface2] ip address 3.0.1.31 24
[DeviceC-Vlan-interface2] ntp-service broadcast-server authentication-keyid 88
[DeviceC-Vlan-interface2] quit
# 開啟NTP功能。
<DeviceA> system-view
[DeviceA] ntp-service enable
# 配置NTP驗證,密鑰編號與密鑰與Device C完全相同。
[DeviceA] ntp-service authentication enable
[DeviceA] ntp-service authentication-keyid 88 authentication-mode md5 simple 123456
[DeviceA] ntp-service reliable authentication-keyid 88
# 設置Device A為NTP廣播客戶端。
[DeviceA] interface vlan-interface 2
[DeviceA-Vlan-interface2] ntp-service broadcast-client
[DeviceC-Vlan-interface2] ip address 3.0.1.33 24
[DeviceA-Vlan-interface2] quit
以上配置將Device A配置為從VLAN接口2監聽廣播報文,接收到Device C發出的廣播報文後與自己的時鍾進行同步。
除IP地址外,Device B、Device D和Device E與DeviceA的其他配置完全相同,此處不再贅述。
# 以Device A為例,查看NTP的運行狀態。
[DeviceA] display ntp-service status
Clock status: synchronized
Clock stratum: 3
System peer: 3.0.1.31
Local mode: bclient
Reference clock ID: 3.0.1.31
Leap indicator: 00
Clock jitter: 0.000092 s
Stability: 0.000 pps
Clock precision: 2^-18
Root delay: 2.42615 ms
Root dispersion: 1950.98877 ms
Reference time: d5eed631.2f498d71 Thu, Sep 26 2018 15:50:09.184
此時Device A已經與Device C同步,層數比Device C的層數大1,為3。
· 設備Device A、Device B、Device D和Device E
#
interface Vlan-interface2
ip address 3.0.1.33 255.255.255.0
ntp-service broadcast-client
#
ntp-service enable
ntp-service authentication enable
ntp-service authentication-keyid 88 authentication-mode md5 cipher $c$3$pU6KvpS80MadhM2zM
CCSR07HX4qEbJhHvQ==
ntp-service reliable authentication-keyid 88
· 設備Device C
#
interface Vlan-interface2
ip address 3.0.1.31 255.255.255.0
ntp-service broadcast-server authentication-keyid 88
#
ntp-service enable
ntp-service authentication enable
ntp-service authentication-keyid 88 authentication-mode md5 cipher $c$3$iJudDKiqCVO+gOaG53
63/fz4M3dQvHo2Fw==
ntp-service reliable authentication-keyid 88
ntp-service refclock-master 3
#
· H3C S6890係列以太網交換機 網絡管理和監控配置指導(R27xx)
· H3C S6890係列以太網交換機 網絡管理和監控命令參考(R27xx)
不同款型規格的資料略有差異, 詳細信息請向具體銷售和400谘詢。H3C保留在沒有任何通知或提示的情況下對資料內容進行修改的權利!