04-GRE配置
本章節下載: 04-GRE配置 (672.76 KB)
GRE(Generic Routing Encapsulation,通用路由封裝)協議用來對某種協議(如IP、以太網)的數據報文進行封裝,使這些被封裝的數據報文能夠在另一個網絡(如IP)中傳輸。封裝前後數據報文的網絡層協議可以相同,也可以不同。封裝後的數據報文在網絡中傳輸的路徑,稱為GRE隧道。GRE隧道是一個虛擬的點到點的連接,其兩端的設備分別對數據報文進行封裝及解封裝。
如圖1-1所示,GRE封裝後的報文包括如下幾個部分:
· 淨荷數據(Payload packet):需要封裝和傳輸的數據報文。淨荷數據的協議類型,稱為乘客協議(Passenger Protocol)。乘客協議可以是任意的網絡層協議。
· GRE頭(GRE header):采用GRE協議對淨荷數據進行封裝所添加的報文頭,包括封裝層數、版本、乘客協議類型、校驗和信息、Key信息等內容。添加GRE頭後的報文稱為GRE報文。對淨荷數據進行封裝的GRE協議,稱為封裝協議(Encapsulation Protocol)。
· 傳輸協議的報文頭(Delivery header):在GRE報文上添加的報文頭,以便傳輸協議對GRE報文進行轉發處理。傳輸協議(Delivery Protocol或者Transport Protocol)是指負責轉發GRE報文的網絡層協議。設備支持IPv4和IPv6兩種傳輸協議:當傳輸協議為IPv4時,GRE隧道稱為GRE over IPv4隧道;當傳輸協議為IPv6時,GRE隧道稱為GRE over IPv6隧道。
圖1-1 GRE封裝後的報文格式
下麵以圖1-2的網絡為例說明IPv6協議的報文通過GRE隧道穿越IPv4網絡進行傳輸的過程。
(1) Device A從連接IPv6 network 1的接口收到IPv6報文後,查找路由表判定此報文需要通過GRE隧道模式的Tunnel接口(本例中為Tunnel0)轉發,並將報文發給相應的Tunnel接口。
(2) GRE隧道模式的Tunnel接口收到此IPv6報文後,先在報文前封裝上GRE頭,再封裝上IPv4頭。IPv4頭中的源地址為隧道的源端地址(本例中為Device A的Interface A接口的IP地址),目的地址為隧道的目的端地址(本例中為Device B的Interface B接口的IP地址)。
(3) Device A根據封裝的IPv4頭中的目的地址查找路由表,將封裝後的IPv4報文通過GRE隧道的實際物理接口(Interface A)轉發出去。
(4) 封裝後的IPv4報文通過GRE隧道到達隧道的目的端設備Device B後,由於報文的目的地是本設備,且IPv4頭中的協議號為47(表示封裝的報文為GRE報文),Device B將此報文交給GRE協議進行解封裝處理。
(5) GRE協議先剝離掉此報文的IPv4頭,再對報文進行GRE Key驗證、校驗和驗證、報文序列號檢查等處理,處理通過後再剝離掉報文的GRE頭,將報文交給IPv6協議進行後續的轉發處理。
圖1-2 IPv6協議網絡通過GRE隧道互連
GRE支持GRE Key驗證、校驗和驗證兩種安全機製。
通過GRE Key驗證可以檢查報文的合法性。
發送方在發送的報文中攜帶本地配置的GRE Key。接收方收到報文後,將報文中的GRE Key與接收方本地配置的GRE Key進行比較,如果一致則對報文進行進一步處理,否則丟棄該報文。
通過GRE校驗和驗證可以檢查報文的完整性。
發送方根據GRE頭及Payload信息計算校驗和,並將包含校驗和信息的報文發送給對端。接收方對接收到的報文計算校驗和,並與報文中的校驗和比較,如果一致則對報文進行進一步處理,否則丟棄該報文。
GRE主要有以下幾種應用場景。
如圖1-3所示,IPv6 network 1和IPv6 network 2是運行IPv6協議的網絡,IPv4 network 1和IPv4 network 2是運行IPv4協議的網絡。在Device A和Device B之間建立GRE隧道,可以使IPv6 network 1和IPv6 network 2、IPv4 network 1和IPv4 network 2通過骨幹網互不影響地進行通信,實現兩地互通。
在IP網絡中,報文的TTL值最大為255。如果兩台設備之間的跳數超過255,它們將無法通信。通過在網絡中使用GRE隧道可以隱藏一部分跳數,從而擴大網絡的工作範圍。如圖1-4所示,使用了GRE隧道之後,Host A和Host B之間的跳數減少為3跳,GRE隧道經過的設備中隻有隧道兩端的設備(Device A和Device D)參與跳數計算。
如圖1-5所示,屬於VPN 1的兩個站點Site 1和Site 2分別位於不同的城市,通過使用GRE隧道可以實現跨越廣域網連接VPN 1的兩個站點。
如圖1-6所示,GRE可以和IPsec(IP Security,IP安全)配合使用,通過建立GRE over IPsec隧道,對路由協議、語音、視頻等數據先進行GRE封裝,再對封裝後的報文進行IPsec處理。二者配合使用的優勢如下:
· 提高數據在隧道中傳輸的安全性。
· 解決IPsec隻能處理單播報文的問題。GRE可以支持組播、廣播和非IP報文,先對這些報文進行GRE封裝,使其成為普通的單播報文。然後,IPsec就可以對其進行進一步的處理。
· 簡化IPsec的配置。由於所有報文都先經過GRE封裝後再進行IPsec處理,因此隻要根據GRE隧道的源/目的端地址來定義需要IPsec保護的數據流即可,不需要關注原始報文的源/目的地址。
GRE和IPsec還有另外一種配合方式,即IPsec over GRE隧道。但這種方式不能充分利用二者的優勢,一般不推薦使用。
關於IPsec的詳細介紹請參見“安全配置指導”中的“IPsec”。
與GRE相關的協議規範有:
· RFC 1701:Generic Routing Encapsulation (GRE)
· RFC 1702:Generic Routing Encapsulation over IPv4 networks
· RFC 2784:Generic Routing Encapsulation (GRE)
· RFC 2890:Key and Sequence Number Extensions to GRE
· GRE收發雙方的加封裝、解封裝處理,以及由於封裝造成的數據量增加,會導致使用GRE後設備的數據轉發效率有一定程度的下降。
· 隧道兩端必須都配置隧道的源端地址和目的端地址,且本端配置的源端地址(目的端地址)應該與對端配置的目的端地址(源端地址)相同。
· 在同一台設備上,隧道模式相同的Tunnel接口建議不要同時配置完全相同的源端地址和目的端地址。
· GRE隧道和點到多點GRE隧道不能配置相同的源端地址和目的端地址。
· 隧道兩端可以根據各自的實際應用需要決定是否要開啟GRE報文校驗和功能。如果本端開啟了GRE報文校驗和功能,則會在發送的報文中攜帶校驗和信息,由對端來對報文進行校驗和驗證。對端是否對收到的報文進行校驗和驗證,取決於報文中是否攜帶校驗和信息,與對端的配置無關。
· 如果封裝前報文的目的地址與Tunnel接口的地址不在同一個網段,則必須配置通過Tunnel接口到達報文目的地址的路由,以便需要進行封裝的報文能正常轉發。用戶可以配置靜態路由,指定到達報文目的地址的路由出接口為本端Tunnel接口;也可以配置動態路由,在Tunnel接口、與私網相連的接口上分別使能動態路由協議,由動態路由協議來建立通過Tunnel接口轉發的路由表項。
本配置任務僅列出了配置GRE over IPv4隧道涉及的Tunnel接口相關的基礎配置命令(interface tunnel、source、destination和tunnel dfbit enable命令),關於Tunnel接口下更多配置命令的詳細介紹,請參見“VPN配置指導”中的“隧道”。
(1) 進入係統視圖。
system-view
(2) 創建模式為GRE over IPv4隧道的Tunnel接口,並進入該Tunnel接口視圖。
interface tunnel number mode gre
在隧道的兩端應配置相同的隧道模式,否則可能造成報文傳輸失敗。
(3) 根據乘客協議,設置Tunnel接口的IP地址。
(IPv4網絡)
IPv4地址的配置方法,請參見“三層技術-IP業務配置指導”中的“IP地址”。
(IPv6網絡)
IPv6地址的配置方法,請參見“三層技術-IP業務配置指導”中的“IPv6基礎”。
缺省情況下,Tunnel接口上未設置IP地址。
(4) 設置隧道的源端地址或源接口。
source { ip-address | interface-type interface-number }
缺省情況下,未設置隧道的源端地址和源接口。
如果設置的是隧道的源端地址,則該地址將作為封裝後隧道報文的源IPv4地址;如果設置的是隧道的源接口,則該接口的主IP地址將作為封裝後隧道報文的源IPv4地址。
(5) 設置隧道的目的端地址。
destination ip-address
缺省情況下,未設置隧道的目的端地址。
隧道的目的端地址是對端從GRE隧道上接收報文的實際物理接口的地址,該地址將作為封裝後隧道報文的目的IPv4地址。該地址不能與Tunnel接口的地址在同一網段。
(6) (可選)開啟GRE的keepalive功能,並配置keepalive報文發送周期、最大發送次數和是否隻檢查回應報文。
keepalive [ interval [ times ] | reply-check-only ]*
缺省情況下,GRE的keepalive功能處於關閉狀態。
(7) (可選)配置GRE安全功能。
¡ 開啟GRE報文校驗和功能。
gre checksum
缺省情況下,GRE報文校驗和功能處於關閉狀態。
¡ 設置GRE類型Tunnel接口的GRE Key。
gre key key
缺省情況下,未設置GRE類型Tunnel接口的GRE Key。
隧道兩端必須設置相同的GRE Key,或者都不設置GRE Key。
(8) (可選)設置封裝後隧道報文的DF(Don’t Fragment,不分片)標誌。
tunnel dfbit enable
缺省情況下,未設置隧道報文的不分片標誌,即轉發隧道報文時允許分片。
(9) (可選)配置GRE隧道轉發類。
service-class service-class-value
缺省情況下,未設置GRE隧道轉發類。
本配置任務僅列出了配置GRE over IPv6隧道涉及的Tunnel接口相關的基礎配置命令(interface tunnel和source、destination命令),關於Tunnel接口下更多配置命令的詳細介紹,請參見“VPN配置指導”中的“隧道”。
(1) 進入係統視圖。
system-view
(2) 創建模式為GRE over IPv6隧道的Tunnel接口,並進入該Tunnel接口視圖。
interface tunnel number mode gre ipv6
在隧道的兩端應配置相同的隧道模式,否則可能造成報文傳輸失敗。
(3) 根據乘客協議,設置Tunnel接口的IP地址。
(IPv4網絡)
IPv4地址的配置方法,請參見“三層技術-IP業務配置指導”中的“IP地址”。
(IPv6網絡)
IPv6地址的配置方法,請參見“三層技術-IP業務配置指導”中的“IPv6基礎”。
缺省情況下,Tunnel接口上未設置IP地址。
(4) 設置隧道的源端地址或源接口。
source { ipv6-address | interface-type interface-number }
缺省情況下,未設置隧道的源端地址和源接口。
如果設置的是隧道的源端地址,則該地址將作為封裝後隧道報文的源IPv6地址;如果設置的是隧道的源接口,則該接口的地址將作為封裝後隧道報文的源IPv6地址。
(5) 設置隧道的目的端地址。
destination ipv6-address
缺省情況下,未設置隧道的目的端地址。
隧道的目的端地址是對端從GRE隧道上接收報文的實際物理接口的地址,該地址將作為封裝後隧道報文的目的IPv6地址。該地址不能與Tunnel接口的地址在同一網段。
(6) (可選)配置GRE安全功能。
¡ 開啟GRE報文校驗和功能。
gre checksum
缺省情況下,GRE報文校驗和功能處於關閉狀態。
¡ 設置GRE類型Tunnel接口的GRE Key。
gre key key
缺省情況下,未設置GRE類型Tunnel接口的GRE Key。
隧道兩端必須設置相同的GRE Key,或者都不設置GRE Key。
(7) (可選)配置GRE隧道轉發類。
service-class service-class-value
缺省情況下,未設置GRE隧道轉發類。
開啟本功能後,對於從隧道接收的報文,如果解封裝後原始IPv6報文的源或目的地址為IPv4兼容IPv6地址,則丟棄該報文。
(1) 進入係統視圖。
system-view
(2) 配置丟棄含有IPv4兼容IPv6地址的IPv6報文。
tunnel discard ipv4-compatible-packet
缺省情況下,不會丟棄含有IPv4兼容IPv6地址的IPv6報文。
本命令詳細介紹,請參見“VPN命令參考”中的“隧道”。
在完成上述配置後,在任意視圖下執行display命令可以顯示配置後GRE的運行情況,通過查看顯示信息驗證配置的效果。
在用戶視圖下執行reset命令可以清除Tunnel接口的統計信息。
表1-1 GRE顯示和維護
操作 |
命令 |
顯示Tunnel接口的相關信息(本命令的詳細介紹,請參見“VPN命令參考”中的“隧道”) |
display interface [ tunnel [ number ] ] [ brief [ description | down ] ] |
顯示Tunnel接口的IPv6相關信息(本命令的詳細介紹,請參見“三層技術-IP業務命令參考”中的“IPv6基礎”) |
display ipv6 interface [ tunnel [ number ] ] [ brief ] |
清除Tunnel接口的統計信息(本命令的詳細介紹,請參見“VPN命令參考”中的“隧道”) |
reset counters interface [ tunnel [ number ] ] |
清除Tunnel接口的IPv6統計信息(本命令的詳細介紹,請參見“三層技術-IP業務命令參考”中的“IPv6基礎”) |
reset ipv6 statistics [ slot slot-number ] |
Device A和Device B分別連接IPv4私有網絡Group 1和Group 2。這兩個私有網絡都使用私網地址,且屬於同一個VPN。通過在Device A和Device B之間建立GRE隧道,實現兩個私有網絡的互聯。
圖1-7 GRE over IPv4隧道配置組網圖
(1) 配置Device A
# 根據組網圖中規劃的信息,配置各接口的IP地址,具體配置步驟如下。
<DeviceA> system-view
[DeviceA] interface gigabitethernet 1/0/1
[DeviceA-GigabitEthernet1/0/1] ip address 10.1.1.1 255.255.255.0
[DeviceA-GigabitEthernet1/0/1] quit
請參考以上步驟配置其他接口的IP地址,具體配置步驟略。
# 創建Tunnel0接口,並指定隧道模式為GRE over IPv4隧道。
[DeviceA] interface tunnel 0 mode gre
[DeviceA-Tunnel0] ip address 10.1.2.1 255.255.255.0
[DeviceA-Tunnel0] source 1.1.1.1
[DeviceA-Tunnel0] destination 2.2.2.2
[DeviceA-Tunnel0] quit
# 請根據組網圖中規劃的信息,配置靜態路由,本舉例假設下一跳IP地址為1.1.1.2,實際使用中請以具體組網情況為準,具體配置步驟如下。本舉例僅以靜態路由方式配置路由信息。實際組網中,請根據具體情況選擇相應的路由配置方式。
[DeviceA] ip route-static 2.2.2.2 24 1.1.1.2
[DeviceA] ip route-static 10.1.3.0 24 tunnel 0
# 請根據組網圖中規劃的信息,將接口加入對應的安全域,具體配置步驟如下。
[DeviceA] security-zone name Untrust
[DeviceA-security-zone-Untrust] import interface Tunnel 0
[DeviceA-security-zone-Untrust] import interface gigabitethernet 1/0/2
[DeviceA-security-zone-Untrust] quit
[DeviceA] security-zone name Trust
[DeviceA-security-zone-Trust] import interface gigabitethernet 1/0/1
[DeviceA-security-zone-Trust] quit
# 配置名稱為grelocalout的安全策規則,使Device A可以向Device B發送報文,具體配置步驟如下。
[DeviceA] security-policy ip
[DeviceA-security-policy-ip] rule name grelocalout
[DeviceA-security-policy-ip-1-grelocalout] source-zone local
[DeviceA-security-policy-ip-1-grelocalout] destination-zone untrust
[DeviceA-security-policy-ip-1-grelocalout] source-ip-host 1.1.1.1
[DeviceA-security-policy-ip-1-grelocalout] source-ip-host 10.1.2.1
[DeviceA-security-policy-ip-1-grelocalout] source-ip-host 10.1.1.1
[DeviceA-security-policy-ip-1-grelocalout] destination-ip-host 2.2.2.2
[DeviceA-security-policy-ip-1-grelocalout] destination-ip-host 10.1.2.2
[DeviceA-security-policy-ip-1-grelocalout] destination-ip-host 10.1.3.1
[DeviceA-security-policy-ip-1-grelocalout] action pass
[DeviceA-security-policy-ip-1-grelocalout] quit
# 配置名稱為grelocalin的安全策略規則,使Device A可以接收和處理來自Device B的報文,具體配置步驟如下。
[DeviceA-security-policy-ip] rule name grelocalin
[DeviceA-security-policy-ip-2-grelocalin] source-zone untrust
[DeviceA-security-policy-ip-2-grelocalin] destination-zone local
[DeviceA-security-policy-ip-2-grelocalin] source-ip-host 2.2.2.2
[DeviceA-security-policy-ip-2-grelocalin] source-ip-host 10.1.2.2
[DeviceA-security-policy-ip-2-grelocalin] source-ip-host 10.1.3.1
[DeviceA-security-policy-ip-2-grelocalin] destination-ip-host 1.1.1.1
[DeviceA-security-policy-ip-2-grelocalin] destination-ip-host 10.1.2.1
[DeviceA-security-policy-ip-2-grelocalin] destination-ip-host 10.1.1.1
[DeviceA-security-policy-ip-2-grelocalin] action pass
[DeviceA-security-policy-ip-2-grelocalin] quit
[DeviceA-security-policy-ip] quit
(2) 配置Device B
# 根據組網圖中規劃的信息,配置各接口的IP地址,具體配置步驟如下。
<DeviceB> system-view
[DeviceB] interface gigabitethernet 1/0/1
[DeviceB-GigabitEthernet1/0/1] ip address 10.1.3.1 255.255.255.0
[DeviceB-GigabitEthernet1/0/1] quit
請參考以上步驟配置其他接口的IP地址,具體配置步驟略。
# 創建Tunnel0接口,並指定隧道模式為GRE over IPv4隧道。
[DeviceB] interface tunnel 0 mode gre
[DeviceB-Tunnel0] ip address 10.1.2.2 255.255.255.0
[DeviceB-Tunnel0] source 2.2.2.2
[DeviceB-Tunnel0] destination 1.1.1.1
[DeviceB-Tunnel0] quit
# 請根據組網圖中規劃的信息,配置靜態路由,本舉例假設下一跳IP地址為2.2.2.3,實際使用中請以具體組網情況為準,具體配置步驟如下。本舉例僅以靜態路由方式配置路由信息。實際組網中,請根據具體情況選擇相應的路由配置方式。
[DeviceB] ip route-static 1.1.1.1 24 2.2.2.3
[DeviceB] ip route-static 10.1.1.0 24 tunnel 0
# 請根據組網圖中規劃的信息,將接口加入對應的安全域,具體配置步驟如下。
[DeviceB] security-zone name Untrust
[DeviceB-security-zone-Untrust] import interface Tunnel 0
[DeviceB-security-zone-Untrust] import interface gigabitethernet 1/0/1
[DeviceB-security-zone-Untrust] quit
[DeviceB] security-zone name Trust
[DeviceB-security-zone-Trust] import interface gigabitethernet 1/0/2
[DeviceB-security-zone-Trust] quit
# 配置名稱為grelocalout的安全策規則,使Device B可以向Device A發送報文,具體配置步驟如下。
[DeviceB] security-policy ip
[DeviceB-security-policy-ip] rule 1 name grelocalout
[DeviceB-security-policy-ip-1-grelocalout] source-zone local
[DeviceB-security-policy-ip-1-grelocalout] destination-zone untrust
[DeviceB-security-policy-ip-1-grelocalout] source-ip-host 2.2.2.2
[DeviceB-security-policy-ip-1-grelocalout] source-ip-host 10.1.2.2
[DeviceB-security-policy-ip-1-grelocalout] source-ip-host 10.1.3.1
[DeviceB-security-policy-ip-1-grelocalout] destination-ip-host 1.1.1.1
[DeviceB-security-policy-ip-1-grelocalout] destination-ip-host 10.1.2.1
[DeviceB-security-policy-ip-1-grelocalout] destination-ip-host 10.1.1.1
[DeviceB-security-policy-ip-1-grelocalout] action pass
[DeviceB-security-policy-ip-1-grelocalout] quit
# 配置名稱為grelocalin的安全策略規則,使Device B可以接收和處理來自Device A的報文,具體配置步驟如下。
[DeviceB-security-policy-ip] rule name grelocalin
[DeviceB-security-policy-ip-2-grelocalin] source-zone untrust
[DeviceB-security-policy-ip-2-grelocalin] destination-zone local
[DeviceB-security-policy-ip-2-grelocalin] source-ip-host 1.1.1.1
[DeviceB-security-policy-ip-2-grelocalin] source-ip-host 10.1.2.1
[DeviceB-security-policy-ip-2-grelocalin] source-ip-host 10.1.1.1
[DeviceB-security-policy-ip-2-grelocalin] destination-ip-host 2.2.2.2
[DeviceB-security-policy-ip-2-grelocalin] destination-ip-host 10.1.2.2
[DeviceB-security-policy-ip-2-grelocalin] destination-ip-host 10.1.3.1
[DeviceB-security-policy-ip-2-grelocalin] action pass
[DeviceB-security-policy-ip-2-grelocalin] quit
[DeviceB-security-policy-ip] quit
# 查看Device A的Tunnel接口狀態。
[DeviceA] display interface tunnel 0
Tunnel0
Current state: UP
Line protocol state: UP
Description: Tunnel0 Interface
Bandwidth: 64kbps
Maximum transmission unit: 1476
Internet address: 10.1.2.1/24 (primary)
Tunnel source 1.1.1.1, destination 2.2.2.2
Tunnel keepalive disabled
Tunnel TTL 255
Tunnel protocol/transport GRE/IP
GRE key disabled
Checksumming of GRE packets disabled
Last clearing of counters: Never
Last 300 seconds input rate: 0 bytes/sec, 0 bits/sec, 0 packets/sec
Last 300 seconds output rate: 0 bytes/sec, 0 bits/sec, 0 packets/sec
Input: 0 packets, 0 bytes, 0 drops
Output: 0 packets, 0 bytes, 0 drops
# 查看Device B的Tunnel接口狀態。
[DeviceB] display interface tunnel 0
Tunnel0
Current state: UP
Line protocol state: UP
Description: Tunnel0 Interface
Bandwidth: 64kbps
Maximum transmission unit: 1476
Internet address: 10.1.2.2/24 (primary)
Tunnel source 2.2.2.2, destination 1.1.1.1
Tunnel keepalive disabled
Tunnel TTL 255
Tunnel protocol/transport GRE/IP
GRE key disabled
Checksumming of GRE packets disabled
Last clearing of counters: Never
Last 300 seconds input rate: 0 bytes/sec, 0 bits/sec, 0 packets/sec
Last 300 seconds output rate: 0 bytes/sec, 0 bits/sec, 0 packets/sec
Input: 0 packets, 0 bytes, 0 drops
Output: 0 packets, 0 bytes, 0 drops
# 從Device B可以Ping通Device A上GigabitEthernet1/0/1接口的地址。
[DeviceB] ping -a 10.1.3.1 10.1.1.1
Ping 10.1.1.1 (10.1.1.1) from 10.1.3.1: 56 data bytes, press CTRL_C to break
56 bytes from 10.1.1.1: icmp_seq=0 ttl=255 time=11.000 ms
56 bytes from 10.1.1.1: icmp_seq=1 ttl=255 time=1.000 ms
56 bytes from 10.1.1.1: icmp_seq=2 ttl=255 time=0.000 ms
56 bytes from 10.1.1.1: icmp_seq=3 ttl=255 time=0.000 ms
56 bytes from 10.1.1.1: icmp_seq=4 ttl=255 time=0.000 ms
--- Ping statistics for 10.1.1.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.000/2.400/11.000/4.317 ms
運行IPv4協議的兩個子網Group 1和Group 2通過IPv6網絡相連。通過在Device A和Device B之間建立GRE over IPv6隧道,實現兩個子網穿越IPv6網絡互聯。
圖1-8 GRE over IPv6隧道配置組網圖
(1) 配置Device A
# 根據組網圖中規劃的信息,配置各接口的IP地址,具體配置步驟如下。
<DeviceA> system-view
[DeviceA] interface gigabitethernet 1/0/1
[DeviceA-GigabitEthernet1/0/1] ip address 10.1.1.1 255.255.255.0
[DeviceA-GigabitEthernet1/0/1] quit
[DeviceA] interface GigabitEthernet1/0/2
[DeviceA-GigabitEthernet1/0/2] ipv6 address 2002::1.1/64
[DeviceA-GigabitEthernet1/0/2] quit
# 創建Tunnel0接口,並指定隧道模式為GRE over IPv6隧道。
[DeviceA] interface tunnel 0 mode gre ipv6
[DeviceA-Tunnel0] ip address 10.1.2.1 255.255.255.0
[DeviceA-Tunnel0] source 2002::1:1
[DeviceA-Tunnel0] destination 2001::2:1
[DeviceA-Tunnel0] quit
# 請根據組網圖中規劃的信息,配置靜態路由,本舉例假設下一跳IP地址為2002::1:2,實際使用中請以具體組網情況為準,具體配置步驟如下。本舉例僅以靜態路由方式配置路由信息。實際組網中,請根據具體情況選擇相應的路由配置方式。
[DeviceA] ipv6 route-static 2001::2:1 64 2002::1:2
[DeviceA] ip route-static 10.1.3.0 24 tunnel 0
# 請根據組網圖中規劃的信息,將接口加入對應的安全域,具體配置步驟如下。
[DeviceA] security-zone name Untrust
[DeviceA-security-zone-Untrust] import interface Tunnel 0
[DeviceA-security-zone-Untrust] import interface gigabitethernet 1/0/1
[DeviceA-security-zone-Untrust] quit
[DeviceA] security-zone name Trust
[DeviceA-security-zone-Trust] import interface gigabitethernet 1/0/2
[DeviceA-security-zone-Trust] quit
# 配置名稱為grelocalout的安全策規則,使Device A可以向Device B發送報文,具體配置步驟如下。
[DeviceA] security-policy ip
[DeviceA-security-policy-ip] rule name grelocalout
[DeviceA-security-policy-ip-1-grelocalout] source-zone local
[DeviceA-security-policy-ip-1-grelocalout] destination-zone untrust
[DeviceA-security-policy-ip-1-grelocalout] source-ip-host 10.1.2.1
[DeviceA-security-policy-ip-1-grelocalout] source-ip-host 10.1.1.1
[DeviceA-security-policy-ip-1-grelocalout] destination-ip-host 10.1.2.2
[DeviceA-security-policy-ip-1-grelocalout] destination-ip-host 10.1.3.1
[DeviceA-security-policy-ip-1-grelocalout] action pass
[DeviceA-security-policy-ip-1-grelocalout] quit
[DeviceA-security-policy-ip] quit
[DeviceA] security-policy ipv6
[DeviceA-security-policy-ipv6] rule name grelocalout
[DeviceA-security-policy-ipv6-1-grelocalout] source-zone local
[DeviceA-security-policy-ipv6-1-grelocalout] destination-zone untrust
[DeviceA-security-policy-ipv6-1-grelocalout] source-ip-host 2002::1:1
[DeviceA-security-policy-ipv6-1-grelocalout] destination-ip-host 2001::2:1
[DeviceA-security-policy-ipv6-1-grelocalout] action pass
[DeviceA-security-policy-ipv6-1-grelocalout] quit
[DeviceA-security-policy-ipv6] quit
# 配置名稱為grelocalin的安全策略規則,使Device A可以接收和處理來自Device B的報文,具體配置步驟如下。
[DeviceA] security-policy ip
[DeviceA-security-policy-ip] rule name grelocalin
[DeviceA-security-policy-ip-2-grelocalin] source-zone untrust
[DeviceA-security-policy-ip-2-grelocalin] destination-zone local
[DeviceA-security-policy-ip-2-grelocalin] source-ip-host 10.1.2.2
[DeviceA-security-policy-ip-2-grelocalin] source-ip-host 10.1.3.1
[DeviceA-security-policy-ip-2-grelocalin] destination-ip-host 10.1.2.1
[DeviceA-security-policy-ip-2-grelocalin] destination-ip-host 10.1.1.1
[DeviceA-security-policy-ip-2-grelocalin] action pass
[DeviceA-security-policy-ip-2-grelocalin] quit
[DeviceA-security-policy-ip] quit
[DeviceA] security-policy ipv6
[DeviceA-security-policy-ipv6] rule name grelocalin
[DeviceA-security-policy-ipv6-2-grelocalin] source-zone untrust
[DeviceA-security-policy-ipv6-2-grelocalin] destination-zone local
[DeviceA-security-policy-ipv6-2-grelocalin] source-ip-host 2001::2:1
[DeviceA-security-policy-ipv6-2-grelocalin] destination-ip-host 2002::1:1
[DeviceA-security-policy-ipv6-2-grelocalin] action pass
[DeviceA-security-policy-ipv6-2-grelocalin] quit
[DeviceA-security-policy-ipv6] quit
(2) 配置Device B
# 根據組網圖中規劃的信息,配置各接口的IP地址,具體配置步驟如下。
[DeviceB] interface gigabitethernet 1/0/1
[DeviceB-GigabitEthernet1/0/1] ip address 10.1.3.1 255.255.255.0
[DeviceB-GigabitEthernet1/0/1] quit
[DeviceA] interface GigabitEthernet1/0/2
[DeviceA-GigabitEthernet1/0/2] ipv6 address 2001::2.1/64
[DeviceA-GigabitEthernet1/0/2] quit
# 創建Tunnel0接口,並指定隧道模式為GRE over IPv6隧道。
[DeviceB] interface tunnel 0 mode gre ipv6
[DeviceB-Tunnel0] ip address 10.1.2.2 255.255.255.0
[DeviceB-Tunnel0] source 2001::2:1
[DeviceB-Tunnel0] destination 2002::1:1
[DeviceB-Tunnel0] quit
# 請根據組網圖中規劃的信息,配置靜態路由,本舉例假設下一跳IP地址為2001::2:2,實際使用中請以具體組網情況為準,具體配置步驟如下。本舉例僅以靜態路由方式配置路由信息。實際組網中,請根據具體情況選擇相應的路由配置方式。
[DeviceB] ipv6 route-static 2002::1:1 64 2001::2:2
[DeviceB] ip route-static 10.1.1.0 24 tunnel 0
# 請根據組網圖中規劃的信息,將接口加入對應的安全域,具體配置步驟如下。
[DeviceB] security-zone name Untrust
[DeviceB-security-zone-Untrust] import interface Tunnel 0
[DeviceB-security-zone-Untrust] import interface gigabitethernet 1/0/1
[DeviceB-security-zone-Untrust] quit
[DeviceB] security-zone name Trust
[DeviceB-security-zone-Trust] import interface gigabitethernet 1/0/2
[DeviceB-security-zone-Trust] quit
# 配置名稱為grelocalout的安全策規則,使Device B可以向Device A發送報文,具體配置步驟如下。
[DeviceB] security-policy ip
[DeviceB-security-policy-ip] rule name grelocalout
[DeviceB-security-policy-ip-1-grelocalout] source-zone local
[DeviceB-security-policy-ip-1-grelocalout] destination-zone untrust
[DeviceB-security-policy-ip-1-grelocalout] source-ip-host 10.1.2.2
[DeviceB-security-policy-ip-1-grelocalout] source-ip-host 10.1.3.1
[DeviceB-security-policy-ip-1-grelocalout] destination-ip-host 10.1.2.1
[DeviceB-security-policy-ip-1-grelocalout] destination-ip-host 10.1.1.1
[DeviceB-security-policy-ip-1-grelocalout] action pass
[DeviceB-security-policy-ip-1-grelocalout] quit
[DeviceB-security-policy-ip] quit
[DeviceB] security-policy ipv6
[DeviceB-security-policy-ipv6] rule name grelocalout
[DeviceB-security-policy-ipv6-1-grelocalout] source-zone local
[DeviceB-security-policy-ipv6-1-grelocalout] destination-zone untrust
[DeviceB-security-policy-ipv6-1-grelocalout] source-ip-host 2001::2:1
[DeviceB-security-policy-ipv6-1-grelocalout] destination-ip-host 2002::1:1
[DeviceB-security-policy-ipv6-1-grelocalout] action pass
[DeviceB-security-policy-ipv6-1-grelocalout] quit
[DeviceB-security-policy-ipv6] quit
# 配置名稱為grelocalin的安全策略規則,使Device B可以接收和處理來自Device A的報文,具體配置步驟如下。
[DeviceB] security-policy ip
[DeviceB-security-policy-ip] rule name grelocalin
[DeviceB-security-policy-ip-2-grelocalin] source-zone untrust
[DeviceB-security-policy-ip-2-grelocalin] destination-zone local
[DeviceB-security-policy-ip-2-grelocalin] source-ip-host 10.1.2.1
[DeviceB-security-policy-ip-2-grelocalin] source-ip-host 10.1.1.1
[DeviceB-security-policy-ip-2-grelocalin] destination-ip-host 10.1.2.2
[DeviceB-security-policy-ip-2-grelocalin] destination-ip-host 10.1.3.1
[DeviceB-security-policy-ip-2-grelocalin] action pass
[DeviceB-security-policy-ip-2-grelocalin] quit
[DeviceB-security-policy-ip] quit
[DeviceB] security-policy ipv6
[DeviceB-security-policy-ipv6] rule name grelocalin
[DeviceB-security-policy-ipv6-2-grelocalin] source-zone untrust
[DeviceB-security-policy-ipv6-2-grelocalin] destination-zone local
[DeviceB-security-policy-ipv6-2-grelocalin] source-ip-host 2002::1:1
[DeviceB-security-policy-ipv6-2-grelocalin] destination-ip-host 2001::2:1
[DeviceB-security-policy-ipv6-2-grelocalin] action pass
[DeviceB-security-policy-ipv6-2-grelocalin] quit
[DeviceB-security-policy-ipv6] quit
# 查看Device A的Tunnel接口狀態。
[DeviceA] display interface tunnel 0
Tunnel0
Current state: UP
Line protocol state: UP
Description: Tunnel0 Interface
Bandwidth: 64kbps
Maximum transmission unit: 1456
Internet address: 10.1.2.1/24 (primary)
Tunnel source 2002::1:1, destination 2001::2:1
Tunnel TTL 255
Tunnel protocol/transport GRE/IPv6
GRE key disabled
Checksumming of GRE packets disabled
Last clearing of counters: Never
Last 300 seconds input rate: 1 bytes/sec, 8 bits/sec, 0 packets/sec
Last 300 seconds output rate: 1 bytes/sec, 8 bits/sec, 0 packets/sec
Input: 10 packets, 840 bytes, 0 drops
Output: 10 packets, 840 bytes, 0 drops
# 查看Device B的Tunnel接口狀態。
[DeviceB] display interface tunnel 0
Tunnel0
Current state: UP
Line protocol state: UP
Description: Tunnel0 Interface
Bandwidth: 64kbps
Maximum transmission unit: 1456
Internet address: 10.1.2.2/24 (primary)
Tunnel source 2001::2:1, destination 2002::1:1
Tunnel TTL 255
Tunnel protocol/transport GRE/IPv6
GRE key disabled
Checksumming of GRE packets disabled
Last clearing of counters: Never
Last 300 seconds input rate: 1 bytes/sec, 8 bits/sec, 0 packets/sec
Last 300 seconds output rate: 1 bytes/sec, 8 bits/sec, 0 packets/sec
Input: 10 packets, 840 bytes, 0 drops
Output: 10 packets, 840 bytes, 0 drops
# 從Device B可以Ping通Device A上GigabitEthernet1/0/1接口的地址。
[DeviceB] ping -a 10.1.3.1 10.1.1.1
Ping 10.1.1.1 (10.1.1.1) from 10.1.3.1: 56 data bytes, press CTRL_C to break
56 bytes from 10.1.1.1: icmp_seq=0 ttl=255 time=2.000 ms
56 bytes from 10.1.1.1: icmp_seq=1 ttl=255 time=1.000 ms
56 bytes from 10.1.1.1: icmp_seq=2 ttl=255 time=1.000 ms
56 bytes from 10.1.1.1: icmp_seq=3 ttl=255 time=0.000 ms
56 bytes from 10.1.1.1: icmp_seq=4 ttl=255 time=1.000 ms
--- Ping statistics for 10.1.1.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.000/1.000/2.000/0.632 ms
GRE的配置相對比較簡單,但要注意配置的一致性,大部分的錯誤都可以使用調試命令debugging gre和debugging tunnel定位。這裏僅就一種錯誤進行分析。
如圖1-9所示,Tunnel兩端接口配置正確且Tunnel兩端可以ping通,但Host A和Host B之間卻無法ping通。
圖1-9 GRE排錯示例
出現該故障的原因可能是Device A或Device C上沒有到達對端網絡的路由。
(1) 在Device A和Device C分別執行display ip routing-table命令,觀察在Device A是否有經過Tunnel0接口到10.2.0.0/16的路由;在Device C是否有經過Tunnel0接口到10.1.0.0/16的路由。
(2) 如果不存在上述路由,則在係統視圖下使用ip route-static命令添加靜態路由。以Device A為例,配置如下:
[DeviceA] ip route-static 10.2.0.0 255.255.0.0 tunnel 0
點到多點GRE隧道是一個虛擬的點到多點的連接,相對於傳統的GRE隧道,點到多點GRE隧道能夠提供一個中心節點到多個分支網絡的虛擬連接。
使用傳統的GRE隧道應用於如圖2-1所示的企業網時,需要在企業中心節點和各個分支機構之間建立多條點到點GRE隧道。當企業分支機構眾多時,配置工作量巨大;如果新增分支機構,則需要在中心節點上增加配置,增加了網絡維護的負擔;此外,分支機構采用ADSL等方式撥號上網時,分支機構公網地址的不確定性也增加了中心節點配置的複雜度。
點到多點GRE隧道很好地解決了上述問題,非常適用於分支機構眾多的企業網絡。點到多點GRE隧道組網中,需要在中心節點上配置點到多點GRE模式的隧道接口(以下簡稱為點到多點GRE隧道接口)、分支機構上配置傳統的點到點GRE over IPv4/IPv6模式的隧道接口(以下簡稱為點到點GRE隧道接口),這樣就可以實現在中心節點和多個分支機構之間建立點到多點GRE隧道。
圖2-1 點到多點GRE隧道應用
點到多點GRE隧道具有如下優點:
· 配置簡單。中心節點上隻需配置點到多點GRE隧道,無需在中心節點上創建到達每個分支機構的點到點GRE隧道。
· 維護代價小。增加分支機構時,中心節點會動態學習到新增分支機構的地址,並與其建立隧道,無需手工配置。
· 分支機構接入方式靈活。中心節點動態學習隧道的目的地址,分支機構是否動態獲取公網地址(如采用ADSL等撥號方式接入網絡)對中心節點的配置沒有影響。
· 對於分支機構使用的網關設備沒有特殊要求,隻要支持GRE協議,不需要特殊的協議或者私有協議來配合使用,具有較好的互通性,避免用戶網絡設備的重複投資。
· 支持分支機構和中心節點的GRE隧道備份,提高網絡的可靠性。
點到多點GRE隧道的報文加解封裝的過程與點到點GRE隧道相同。
通過點到多點GRE隧道轉發報文時,設備根據報文的目的IP地址,在點到多點GRE隧道表項中查找對應的隧道目的IP地址,使用此地址作為GRE封裝傳輸協議報文頭的目的IP地址。
點到多點GRE隧道表項分為點到多點GRE隧道動態表項和點到多點GRE隧道靜態表項,兩者不能同時存在。
如圖2-2所示,配置了點到多點GRE隧道接口的設備(Device A)接收到對端設備(Device B)發送的GRE報文後,從該報文中獲取傳輸協議報文頭的源IP地址和乘客協議報文頭的源IP地址,分別作為隧道的目的IP地址和報文的目的IP地址(即分支網絡的私網地址),建立一條點到多點GRE隧道動態表項。
圖2-2 動態建立GRE隧道表項
點到多點GRE隧道動態表項的建立需要由分支網絡的GRE報文觸發,如果沒有收到分支網絡的GRE報文,則無法在中心節點上建立點到多點GRE隧道動態表項,為解決此問題,用戶可以配置點到多點GRE隧道靜態表項,靜態表項包括隧道的目的IPv4地址、報文的目的IPv4地址(即分支網絡的私網地址)和分支網絡所屬的VPN實例。
目前僅支持配置點到多點GRE隧道的IPv4靜態表項。
點到多點GRE隧道支持在中心節點和分支網絡之間建立多條GRE隧道,形成備份關係,提高網絡的可靠性。根據備份節點的部署位置不同,可以分為分支機構的GRE隧道備份和中心節點的GRE隧道備份。
如圖2-3所示,分支機構內部署多台網關設備,與中心節點之間分別建立點到多點GRE隧道。
圖2-3 分支機構的GRE隧道備份
在分支機構的網關設備上創建GRE隧道時,可以設置GRE Key。中心節點根據分支機構發送的GRE報文創建點到多點GRE隧道動態表項,並從該GRE報文中獲取GRE Key,記錄在點到多點GRE隧道動態表項中。中心節點根據GRE Key來判斷點到多點GRE隧道動態表項的優先級,並根據優先級最高的點到多點GRE隧道動態表項轉發報文,優先級低的點到多點GRE隧道動態表項作為備份。
點到多點GRE隧道動態表項優先級的判斷原則為:
· 未記錄GRE Key的表項優先級最高;
· 記錄了GRE Key的表項,Key值越小優先級越高;
· 當表項GRE Key相同時,最新學到的表項優先級高。
如圖2-4所示,中心節點部署了兩台網關設備,網關設備均與分支機構的網關設備建立點到多點的GRE隧道,同時兩台網關設備之間建立GRE over IPv4/IPv6模式的隧道。主設備上的GRE over IPv4/IPv6模式的隧道接口作為備份接口。
圖2-4 中心節點的GRE隧道備份
當主設備與分支機構之間的鏈路出現故障時,發送給分支機構的報文在主設備上查找不到匹配的點到多點GRE隧道動態表項,主設備通過備份接口把該報文發送給備份設備(Device B),由備份設備將報文發送到分支機構。
當主設備上存在點到多點GRE隧道動態表項時,備份接口也可以參與轉發隧道的選擇,根據優先級決定是否采用備份接口轉發報文。如果沒有為備份接口配置GRE Key,則其優先級低於所有的點到多點隧道動態表項;如果為備份接口配置了GRE Key,則與點到多點隧道動態表項中記錄的GRE Key比較,Key值小的優先級高。
關於interface tunnel、source和tunnel discard ipv4-compatible-packet命令以及Tunnel接口下更多配置命令的詳細介紹,請參見“VPN配置指導”和“VPN命令參考”中的“隧道”。
· 在同一設備上配置多個點到多點GRE隧道時,各Tunnel接口不能配置完全相同的源端地址。
· GRE隧道和點到多點GRE隧道不能配置相同的源端地址和目的端地址。
· 中心節點的點到多點GRE隧道接口上不能配置GRE Key。
· 中心節點的網關設備可以根據各個分支設備的內網網段,隻建立一個隧道動態表項,從而降低中心設備的資源消耗。
· 點到多點GRE隧道組網中,分支網絡之間無法建立隧道,不能通信。
· 在分支節點上,需要將GRE over IPv4/IPv6隧道的目的端地址配置為點到多點GRE隧道接口的源端地址。
· Tunnel接口上配置的隧道目的端地址不能與Tunnel接口的地址在同一網段。
· 在分支節點的網關設備上創建GRE隧道時,可以設置GRE Key,中心節點根據GRE Key來判斷點到多點GRE隧道動態表項的優先級。
· 隧道兩端可以根據各自的實際應用需要決定是否要開啟GRE報文校驗和功能。如果本端開啟了GRE報文校驗和功能,則會在發送的報文中攜帶校驗和信息,由對端來對報文進行校驗和驗證。對端是否對收到的報文進行校驗和驗證,取決於報文中是否攜帶校驗和信息,與對端的配置無關。
· 如果封裝前報文的目的地址與Tunnel接口的地址不在同一個網段,則必須配置通過Tunnel接口到達報文目的地址的路由,以便需要進行封裝的報文能正常轉發。用戶可以配置靜態路由,指定到達報文目的地址的路由出接口為本端Tunnel接口;也可以配置動態路由,在Tunnel接口、與私網相連的接口上分別使能動態路由協議,由動態路由協議來建立通過Tunnel接口轉發的路由表項。
· 基於點到多點GRE隧道動態表項的GRE隧道不支持轉發私網流量。
點到多點GRE隧道配置任務如下:
請根據實際組網,選擇以下一項任務進行配置:
(1) 進入係統視圖。
system-view
(2) 創建模式為點到多點GRE隧道的Tunnel接口,並進入該Tunnel接口視圖。
interface tunnel number mode gre-p2mp [ ipv6 ]
此模式下,傳輸協議和乘客協議支持IPv4和IPv6。
對端設備的隧道接口應該配置為GRE over IPv4/IPv6隧道模式。
(3) 根據乘客協議,設置Tunnel接口的IP地址。
(IPv4網絡)
IPv4地址的配置方法,請參見“三層技術-IP業務配置指導”中的“IP地址”。
(IPv6網絡)
IPv6地址的配置方法,請參見“三層技術-IP業務配置指導”中的“IPv6基礎”。
缺省情況下,Tunnel接口上未設置IP地址。
(4) 設置隧道的源端地址或源接口。
source { ipv4-address | ipv6-address | interface-type interface-number }
缺省情況下,未配置隧道的源端地址和源接口。
如果配置的是隧道的源端地址,則該地址將作為封裝後隧道報文的源地址。
如果配置的是隧道的源接口,對於IPv4地址,該接口的主IP地址將作為封裝後隧道報文的源IP地址;對於IPv6地址則該接口下的最小地址將作為封裝後隧道報文的源IPv6地址。
(5) (可選)開啟GRE報文校驗和功能。
gre checksum
缺省情況下,GRE報文校驗和功能處於關閉狀態。
(6) (可選)配置點到多點GRE隧道的表項老化時間。
gre p2mp aging-time aging-time
缺省情況下,點到多點模式的GRE隧道的表項老化時間為5秒。
(7) (可選)配置點到多點GRE隧道Tunnel接口的備份接口。
gre p2mp backup-interface tunnel number
缺省情況下,未配置點到多點GRE隧道Tunnel接口的備份接口。
備份接口應為GRE over IPv4/IPv6模式的隧道接口,且指定的備份接口必須是已經存在的隧道接口。
(8) (可選)配置點到多點GRE隧道動態表項中分支內網IPv4地址掩碼或IPv6地址的前綴。
gre p2mp branch-network-mask { mask | mask-length | ipv6 prefix-length }
缺省情況下,分支內網IPv4地址的掩碼為255.255.255.255,即掩碼長度為32;分支內網IPv6地址的前綴長度為128。
通過合理的規劃各個分支設備的內網網段,使用此命令可以使得中心設備對應於每個分支設備隻建立一個隧道動態表項,從而降低中心設備的資源消耗。
(9) (可選)開啟下一跳主機路由學習功能。
gre p2mp nexthop-learning
缺省情況下,下一跳主機路由學習功能處於關閉狀態。
僅隧道模式為點到多點的GRE over IPv4隧道的Tunnel接口支持本功能。
(10) 退回係統視圖。
quit
(11) (可選)配置丟棄含有IPv4兼容IPv6地址的IPv6報文。
tunnel discard ipv4-compatible-packet
缺省情況下,不會丟棄含有IPv4兼容IPv6地址的IPv6報文。
(1) 進入係統視圖。
system-view
(2) 創建GRE P2MP隧道模板,並進入GRE P2MP隧道模板視圖。
gre p2mp-template template-name
(3) 配置GRE P2MP隧道的映射表項。
map [ vpn-instance vpn-instance-name ] branch-network-address branch-network-address { mask | mask-length } tunnel-destination tunnel-dest-address [ checksum-fill checksum-value ]
缺省情況下,未配置GRE P2MP隧道的映射表項。
使用checksum-fill參數填充IPv4地址至checksum字段會導致GRE報文校驗失敗,因此,請結合實際組網要求準確使用checksum-fill參數。
(4) 退回係統視圖。
quit
(5) 創建模式為點到多點GRE隧道的Tunnel接口,並進入該Tunnel接口視圖。
interface tunnel number mode gre-p2mp
對端設備的隧道接口應該配置為GRE over IPv4隧道模式。
(6) 配置Tunnel接口的IPv4地址。
IPv4地址的配置方法,請參見“三層技術-IP業務配置指導”中的“IP地址”
缺省情況下,Tunnel接口上未配置IPv4地址。
(7) 配置隧道的源端地址或源接口。
source { ipv4-address | interface-type interface-number }
缺省情況下,未配置隧道的源端地址和源接口。
如果配置的是隧道的源端地址,則該地址將作為封裝後隧道報文的源地址。
如果配置的是隧道的源接口,對於IPv4地址,該接口的主IP地址將作為封裝後隧道報文的源IP地址。
(8) 配置GRE P2MP隧道接口與指定的GRE P2MP隧道模板關聯。
gre p2mp-template template-name
缺省情況下,未配置GRE P2MP隧道接口與指定的GRE P2MP隧道模板關聯。
指定的GRE P2MP隧道模板必須是已創建GRE P2MP隧道模板。
(9) (可選)開啟GRE報文校驗和功能。
gre checksum
缺省情況下,GRE報文校驗和功能處於關閉狀態。
(10) (可選)配置GRE P2MP隧道模板映射表項下發靜態路由的優先級。
tunnel route-static [ preference preference-value ]
缺省情況下,隧道表項下發靜態路由優先級為60,參數preference取值範圍為1~255。
在完成上述配置後,在任意視圖下執行display命令可以顯示配置後點到多點GRE隧道的運行情況,通過查看顯示信息驗證配置的效果。
在用戶視圖下執行reset命令可以清除點到多點GRE隧道的相關信息。
表2-1 點到多點GRE隧道的顯示和維護
操作 |
命令 |
顯示點到多點GRE隧道接口的隧道動態表項信息 |
display gre p2mp tunnel-table interface tunnel number [ ipv4 | ipv6 ] |
顯示點到多點GRE隧道靜態表項的報文統計信息 |
display gre p2mp tunnel-table statistics interface tunnel number [ vpn-instance vpn-instance-name ] [ branch-network-address branch-network-address { mask | mask-length } ] |
清除點到多點GRE隧道動態表項信息 |
reset gre p2mp tunnel-table interface tunnel number [ destination { dest-address | ipv6 dest-ipv6-address } tunnel-destination { tunnel-dest-address | ipv6 unnel-dest-address } ] |
清除點到多點GRE隧道靜態表項的報文統計信息 |
reset gre p2mp tunnel-table statistics interface tunnel number [ vpn-instance vpn-instance-name ] [ branch-network-address branch-network-address { mask | mask-length } ] |
某企業擁有一個中心網絡和眾多分支機構;分支機構和中心網絡之間建立GRE隧道,實現隧道兩側內網主機互通;分支機構之間不會互相訪問。如圖2-5所示,為了簡化配置,在中心節點網關設備Device A上配置點到多點GRE隧道接口,使中心節點網絡可以與多個分支網絡動態建立GRE隧道。在各分支節點上配置GRE over IPv4隧道接口,使分支網絡可以和中心網絡建立GRE隧道。
圖2-5 基本點到多點GRE隧道配置組網圖
設備 |
接口 |
IP地址 |
安全域 |
Device A |
GE1/0/1 |
11.1.1.1/24 |
Untrust |
GE1/0/2 |
192.168.11.1/24 |
Trust |
|
Tunnel0 |
192.168.22.1/24 |
Untrust |
|
Device B |
GE1/0/1 |
11.1.2.2/24 |
Untrust |
GE1/0/2 |
192.168.12.1/24 |
Trust |
|
Tunnel0 |
192.168.22.2/24 |
Untrust |
|
Device C |
GE1/0/1 |
11.1.3.3/24 |
Untrust |
GE1/0/2 |
192.168.13.1/24 |
Trust |
|
Tunnel0 |
192.168.22.3/24 |
Untrust |
本舉例中僅以一個分支節點網關設備Device B為例說明分支節點的配置方法,其他分支節點的配置與Device B上的配置類似。
(1) 配置Device A
# 根據組網圖中規劃的信息,配置各接口的IP地址,具體配置步驟如下。
<DeviceA> system-view
[DeviceA] interface gigabitethernet 1/0/1
[DeviceA-GigabitEthernet1/0/1] ip address 11.1.1.1 255.255.255.0
[DeviceA-GigabitEthernet1/0/1] quit
請參考以上步驟配置其他接口的IP地址,具體配置步驟略。
# 創建Tunnel0接口,並指定隧道模式為點到多點GRE隧道。
[DeviceA] interface tunnel 0 mode gre-p2mp
[DeviceA-Tunnel0] ip address 192.168.22.1 255.255.255.0
[DeviceA-Tunnel0] source 11.1.1.1
[DeviceA-Tunnel0] gre p2mp branch-network-mask 255.255.255.0
[DeviceA-Tunnel0] gre p2mp aging-time 20
[DeviceA-Tunnel0] quit
# 請根據組網圖中規劃的信息,配置靜態路由,本舉例假設下一跳IP地址為11.1.1.2,實際使用中請以具體組網情況為準,具體配置步驟如下。本舉例僅以靜態路由方式配置路由信息。實際組網中,請根據具體情況選擇相應的路由配置方式。
[DeviceA] ip route-static 11.1.2.2 24 11.1.1.2
[DeviceA] ip route-static 192.168.12.0 255.255.255.0 tunnel 0
# 請根據組網圖中規劃的信息,將接口加入對應的安全域,具體配置步驟如下。
[DeviceA] security-zone name Untrust
[DeviceA-security-zone-Untrust] import interface Tunnel 0
[DeviceA-security-zone-Untrust] import interface gigabitethernet 1/0/1
[DeviceA-security-zone-Untrust] quit
[DeviceA] security-zone name Trust
[DeviceA-security-zone-Trust] import interface gigabitethernet 1/0/2
[DeviceA-security-zone-Trust] quit
# 配置名稱為grelocalout的安全策規則,使Device A可以向Device B發送報文,具體配置步驟如下。
[DeviceA] security-policy ip
[DeviceA-security-policy-ip] rule name grelocalout
[DeviceA-security-policy-ip-1-grelocalout] source-zone local
[DeviceA-security-policy-ip-1-grelocalout] destination-zone untrust
[DeviceA-security-policy-ip-1-grelocalout] source-ip-host 11.1.1.1
[DeviceA-security-policy-ip-1-grelocalout] source-ip-host 192.168.22.1
[DeviceA-security-policy-ip-1-grelocalout] source-ip-host 192.168.11.1
[DeviceA-security-policy-ip-1-grelocalout] destination-ip-host 11.1.2.2
[DeviceA-security-policy-ip-1-grelocalout] destination-ip-host 192.168.22.2
[DeviceA-security-policy-ip-1-grelocalout] destination-ip-host 192.168.12.1
[DeviceA-security-policy-ip-1-grelocalout] action pass
[DeviceA-security-policy-ip-1-grelocalout] quit
# 配置名稱為grelocalin的安全策略規則,使Device A可以接收和處理來自Device B的報文,具體配置步驟如下。
[DeviceA-security-policy-ip] rule name grelocalin
[DeviceA-security-policy-ip-2-grelocalin] source-zone untrust
[DeviceA-security-policy-ip-2-grelocalin] destination-zone local
[DeviceA-security-policy-ip-2-grelocalin] source-ip-host 11.1.2.2
[DeviceA-security-policy-ip-2-grelocalin] source-ip-host 192.168.22.2
[DeviceA-security-policy-ip-2-grelocalin] source-ip-host 192.168.12.1
[DeviceA-security-policy-ip-2-grelocalin] destination-ip-host 11.1.1.1
[DeviceA-security-policy-ip-2-grelocalin] destination-ip-host 192.168.22.1
[DeviceA-security-policy-ip-2-grelocalin] destination-ip-host 192.168.11.1
[DeviceA-security-policy-ip-2-grelocalin] action pass
[DeviceA-security-policy-ip-2-grelocalin] quit
[DeviceA-security-policy-ip] quit
(2) 配置Device B
# 根據組網圖中規劃的信息,配置各接口的IP地址,具體配置步驟如下。
[DeviceB] interface gigabitethernet 1/0/1
[DeviceB-GigabitEthernet1/0/1] ip address 11.1.2.2 255.255.255.0
[DeviceB-GigabitEthernet1/0/1] quit
請參考以上步驟配置其他接口的IP地址,具體配置步驟略。
# 創建Tunnel0接口,並指定隧道模式為GRE over IPv4隧道。
[DeviceB] interface tunnel 0 mode gre
[DeviceB-Tunnel0] ip address 192.168.22.2 255.255.255.0
[DeviceB-Tunnel0] source 11.1.2.2
[DeviceB-Tunnel0] destination 11.1.1.1
[DeviceB-Tunnel0] quit
# 請根據組網圖中規劃的信息,配置靜態路由,本舉例假設下一跳IP地址為11.1.2.3,實際使用中請以具體組網情況為準,具體配置步驟如下。本舉例僅以靜態路由方式配置路由信息。實際組網中,請根據具體情況選擇相應的路由配置方式。
[DeviceB] ip route-static 11.1.1.1 24 11.1.2.3
[DeviceB] ip route-static 192.168.11.0 24 tunnel 0
# 請根據組網圖中規劃的信息,將接口加入對應的安全域,具體配置步驟如下。
[DeviceB] security-zone name Untrust
[DeviceB-security-zone-Untrust] import interface Tunnel 0
[DeviceB-security-zone-Untrust] import interface gigabitethernet 1/0/1
[DeviceB-security-zone-Untrust] quit
[DeviceB] security-zone name Trust
[DeviceB-security-zone-Trust] import interface gigabitethernet 1/0/2
[DeviceB-security-zone-Trust] quit
# 配置名稱為grelocalout的安全策規則,使Device B可以向Device A發送報文,具體配置步驟如下。
[DeviceB] security-policy ip
[DeviceB-security-policy-ip] rule name grelocalout
[DeviceB-security-policy-ip-1-grelocalout] source-zone local
[DeviceB-security-policy-ip-1-grelocalout] destination-zone untrust
[DeviceB-security-policy-ip-1-grelocalout] source-ip-host 11.1.2.2
[DeviceB-security-policy-ip-1-grelocalout] source-ip-host 192.168.22.2
[DeviceB-security-policy-ip-1-grelocalout] source-ip-host 192.168.12.1
[DeviceB-security-policy-ip-1-grelocalout] destination-ip-host 11.1.1.1
[DeviceB-security-policy-ip-1-grelocalout] destination-ip-host 192.168.22.1
[DeviceB-security-policy-ip-1-grelocalout] destination-ip-host 192.168.11.1
[DeviceB-security-policy-ip-1-grelocalout] action pass
[DeviceB-security-policy-ip-1-grelocalout] quit
# 配置名稱為grelocalin的安全策略規則,使Device B可以接收和處理來自Device A的報文,具體配置步驟如下。
[DeviceB-security-policy-ip] rule name grelocalin
[DeviceB-security-policy-ip-2-grelocalin] source-zone untrust
[DeviceB-security-policy-ip-2-grelocalin] destination-zone local
[DeviceB-security-policy-ip-2-grelocalin] source-ip-host 11.1.1.1
[DeviceB-security-policy-ip-2-grelocalin] source-ip-host 192.168.22.1
[DeviceB-security-policy-ip-2-grelocalin] source-ip-host 192.168.11.1
[DeviceB-security-policy-ip-2-grelocalin] destination-ip-host 11.1.2.2
[DeviceB-security-policy-ip-2-grelocalin] destination-ip-host 192.168.22.2
[DeviceB-security-policy-ip-2-grelocalin] destination-ip-host 192.168.12.1
[DeviceB-security-policy-ip-2-grelocalin] action pass
[DeviceB-security-policy-ip-2-grelocalin] quit
[DeviceB-security-policy-ip] quit
# 完成以上配置後,查看Device A上的點到多點GRE隧道表項。此時Device A上不存在點到多點GRE隧道表項。
[DeviceA] display gre p2mp tunnel-table interface tunnel 0
Total number:0
Dest Addr Mask/Prefix Len Tunnel Dest Addr Gre Key Aging
# 在Host B上Ping Host A,可以Ping通。
# 再次查看Device A上的點到多點GRE隧道表項。此時,分支節點發往中心節點的報文已經觸發Device A建立點到多點GRE隧道表項。
[DeviceA] display gre p2mp tunnel-table interface tunnel 0
Total number:1
Dest Addr Mask/Prefix Len Tunnel Dest Addr Gre Key Aging
192.168.12.0 255.255.255.0 11.1.2.2 5
某企業中心機構在內網出口處采用雙網關進行備份,企業分支節點Device C上創建兩條GRE隧道,一條與中心節點網關Device A相連,另一條與中心節點的備份網關Device B相連。正常情況下,報文通過Device A和Device C之間的隧道轉發;當Device A和Device C之間的鏈路出現故障時,報文通過Device B和Device C之間的隧道轉發。
為了滿足上述需求,需要在Device A和Device B上分別創建連接分支網絡的點到多點GRE隧道,並在Device A和Device B之間創建一條GRE over IPv4隧道。Device A上該GRE over IPv4隧道接口作為點到多點GRE隧道接口的備份接口,當Device A找不到分支網絡對應的點到多點GRE隧道表項時,將報文發給Device B,由Device B負責將報文轉發給分支網絡。
為了避免出現環路,在Device B上不要將連接Device A的隧道接口Tunnel1配置為點到多點GRE隧道接口的備份接口。
圖2-6 中心節點備份的點到多點GRE隧道配置組網圖
設備 |
接口 |
IP地址 |
安全域 |
Device A |
GE1/0/1 |
11.1.1.1/24 |
Untrust |
GE1/0/2 |
10.1.1.1/24 |
Trust |
|
GE1/0/3 |
192.168.11.1/24 |
Trust |
|
Tunnel0 |
172.168.1.1/24 |
Untrust |
|
Tunnel1 |
192.168.22.1/24 |
Trust |
|
Device B |
GE1/0/1 |
11.1.2.2/24 |
Untrust |
GE1/0/2 |
10.1.1.2/24 |
Trust |
|
GE1/0/3 |
192.168.11.2/24 |
Trust |
|
Tunnel0 |
172.168.2.2/24 |
Untrust |
|
Tunnel1 |
192.168.22.2/24 |
Trust |
|
Device C |
GE1/0/1 |
11.1.3.3/24 |
Untrust |
GE1/0/2 |
192.168.12.1/24 |
Trust |
|
Tunnel0 |
172.168.1.3/24 |
Untrust |
|
Tunnel1 |
172.168.2.3/24 |
Untrust |
(1) 配置Device A
# 根據組網圖中規劃的信息,配置各接口的IP地址,具體配置步驟如下。
<DeviceA> system-view
[DeviceA] interface gigabitethernet 1/0/1
[DeviceA-GigabitEthernet1/0/1] ip address 11.1.1.1 255.255.255.0
[DeviceA-GigabitEthernet1/0/1] quit
請參考以上步驟配置其他接口的IP地址,具體配置步驟略。
# 創建Tunnel1接口,並指定隧道模式為GRE over IPv4隧道。
[DeviceA] interface tunnel 1 mode gre
[DeviceA-Tunnel1] ip address 192.168.22.1 255.255.255.0
[DeviceA-Tunnel1] source 10.1.1.1
[DeviceA-Tunnel1] destination 10.1.1.2
[DeviceA-Tunnel1] quit
# 創建Tunnel0接口,並指定隧道模式為點到多點GRE隧道。
[DeviceA] interface tunnel 0 mode gre-p2mp
[DeviceA-Tunnel0] ip address 172.168.1.1 255.255.255.0
[DeviceA-Tunnel0] source 11.1.1.1
[DeviceA-Tunnel0] gre p2mp branch-network-mask 255.255.255.0
[DeviceA-Tunnel0] gre p2mp aging-time 20
[DeviceA-Tunnel0] gre p2mp backup-interface tunnel 1
[DeviceA-Tunnel0] quit
# 請根據組網圖中規劃的信息,配置靜態路由,本舉例假設下一跳IP地址為11.1.1.2,實際使用中請以具體組網情況為準,具體配置步驟如下。本舉例僅以靜態路由方式配置路由信息。實際組網中,請根據具體情況選擇相應的路由配置方式。
[DeviceA] ip route-static 11.1.3.3 24 11.1.1.2
[DeviceA] ip route-static 192.168.12.0 255.255.255.0 tunnel 0
# 請根據組網圖中規劃的信息,將接口加入對應的安全域,具體配置步驟如下。
[DeviceA] security-zone name Untrust
[DeviceA-security-zone-Untrust] import interface Tunnel 0
[DeviceA-security-zone-Untrust] import interface gigabitethernet 1/0/1
[DeviceA-security-zone-Untrust] quit
[DeviceA] security-zone name Trust
[DeviceA-security-zone-Trust] import interface gigabitethernet 1/0/2
[DeviceA-security-zone-Trust] import interface gigabitethernet 1/0/2
[DeviceA-security-zone-Untrust] import interface Tunnel 1
[DeviceA-security-zone-Trust] quit
# 配置名稱為grelocalout的安全策規則,使Device A可以向Device C發送報文,具體配置步驟如下。
[DeviceA] security-policy ip
[DeviceA-security-policy-ip] rule name grelocalout
[DeviceA-security-policy-ip-1-grelocalout] source-zone local
[DeviceA-security-policy-ip-1-grelocalout] destination-zone untrust
[DeviceA-security-policy-ip-1-grelocalout] source-ip-host 11.1.1.1
[DeviceA-security-policy-ip-1-grelocalout] source-ip-host 172.168.1.1
[DeviceA-security-policy-ip-1-grelocalout] source-ip-host 192.168.11.1
[DeviceA-security-policy-ip-1-grelocalout] destination-ip-host 11.1.3.3
[DeviceA-security-policy-ip-1-grelocalout] destination-ip-host 172.168.1.3
[DeviceA-security-policy-ip-1-grelocalout] destination-ip-host 192.168.12.1
[DeviceA-security-policy-ip-1-grelocalout] action pass
[DeviceA-security-policy-ip-1-grelocalout] quit
# 配置名稱為grelocalin的安全策略規則,使Device A可以接收和處理來自Device C的報文,具體配置步驟如下。
[DeviceA-security-policy-ip] rule name grelocalin
[DeviceA-security-policy-ip-2-grelocalin] source-zone untrust
[DeviceA-security-policy-ip-2-grelocalin] destination-zone local
[DeviceA-security-policy-ip-2-grelocalin] source-ip-host 11.1.3.3
[DeviceA-security-policy-ip-2-grelocalin] source-ip-host 172.168.1.3
[DeviceA-security-policy-ip-2-grelocalin] source-ip-host 192.168.12.1
[DeviceA-security-policy-ip-2-grelocalin] destination-ip-host 11.1.1.1
[DeviceA-security-policy-ip-2-grelocalin] destination-ip-host 172.168.1.1
[DeviceA-security-policy-ip-2-grelocalin] destination-ip-host 192.168.11.1
[DeviceA-security-policy-ip-2-grelocalin] action pass
[DeviceA-security-policy-ip-2-grelocalin] quit
[DeviceA-security-policy-ip] quit
# 配置名稱為grelocalout的安全策規則,使Device A可以向Device B發送報文,具體配置步驟如下。
[DeviceA] security-policy ip
[DeviceA-security-policy-ip] rule name grelocalout
[DeviceA-security-policy-ip-3-grelocalout] source-zone local
[DeviceA-security-policy-ip-3-grelocalout] destination-zone trust
[DeviceA-security-policy-ip-3-grelocalout] source-ip-host 10.1.1.1
[DeviceA-security-policy-ip-3-grelocalout] source-ip-host 192.168.22.1
[DeviceA-security-policy-ip-3-grelocalout] source-ip-host 192.168.11.1
[DeviceA-security-policy-ip-3-grelocalout] destination-ip-host 10.1.1.2
[DeviceA-security-policy-ip-3-grelocalout] destination-ip-host 192.168.22.2
[DeviceA-security-policy-ip-3-grelocalout] destination-ip-host 192.168.12.1
[DeviceA-security-policy-ip-3-grelocalout] action pass
[DeviceA-security-policy-ip-3-grelocalout] quit
# 配置名稱為grelocalin的安全策略規則,使Device A可以接收和處理來自Device B的報文,具體配置步驟如下。
[DeviceA-security-policy-ip] rule 4 name grelocalin
[DeviceA-security-policy-ip-4-grelocalin] source-zone trust
[DeviceA-security-policy-ip-4-grelocalin] destination-zone local
[DeviceA-security-policy-ip-4-grelocalin] source-ip-host 10.1.1.2
[DeviceA-security-policy-ip-4-grelocalin] source-ip-host 192.168.22.2
[DeviceA-security-policy-ip-4-grelocalin] source-ip-host 192.168.12.1
[DeviceA-security-policy-ip-4-grelocalin] destination-ip-host 10.1.1.1
[DeviceA-security-policy-ip-4-grelocalin] destination-ip-host 192.168.22.1
[DeviceA-security-policy-ip-4-grelocalin] destination-ip-host 192.168.11.1
[DeviceA-security-policy-ip-4-grelocalin] action pass
[DeviceA-security-policy-ip-4-grelocalin] quit
[DeviceA-security-policy-ip] quit
(2) 配置Device B
# 根據組網圖中規劃的信息,配置各接口的IP地址,具體配置步驟如下。
[DeviceB] interface gigabitethernet 1/0/1
[DeviceB-GigabitEthernet1/0/1] ip address 11.1.2.2 255.255.255.0
[DeviceB-GigabitEthernet1/0/1] quit
請參考以上步驟配置其他接口的IP地址,具體配置步驟略。
# 創建Tunnel0接口,並指定隧道模式為點到多點GRE隧道。
[DeviceB] interface tunnel 0 mode gre-p2mp
[DeviceB-Tunnel0] ip address 172.168.2.2 255.255.255.0
[DeviceB-Tunnel0] source 11.1.2.2
[DeviceB-Tunnel0] gre p2mp branch-network-mask 255.255.255.0
[DeviceB-Tunnel0] gre p2mp aging-time 20
[DeviceB-Tunnel0] quit
# 創建Tunnel1接口,並指定隧道模式為GRE over IPv4隧道。
[DeviceB] interface tunnel 1 mode gre
[DeviceB-Tunnel1] ip address 192.168.22.2 255.255.255.0
[DeviceB-Tunnel1] source 10.1.1.2
[DeviceB-Tunnel1] destination 10.1.1.1
[DeviceB-Tunnel1] quit
# 請根據組網圖中規劃的信息,配置靜態路由,本舉例假設下一跳IP地址為11.1.2.3,實際使用中請以具體組網情況為準,具體配置步驟如下。本舉例僅以靜態路由方式配置路由信息。實際組網中,請根據具體情況選擇相應的路由配置方式。
[DeviceB] ip route-static 11.1.3.3 24 11.1.2.3
[DeviceB] ip route-static 192.168.12.1 24 tunnel 0
# 請根據組網圖中規劃的信息,將接口加入對應的安全域,具體配置步驟如下。
[DeviceB] security-zone name Untrust
[DeviceB-security-zone-Untrust] import interface Tunnel 0
[DeviceB-security-zone-Untrust] import interface gigabitethernet 1/0/1
[DeviceB-security-zone-Untrust] quit
[DeviceB] security-zone name Trust
[DeviceB-security-zone-Trust] import interface gigabitethernet 1/0/2
[DeviceB-security-zone-Trust] import interface gigabitethernet 1/0/2
[DeviceB-security-zone-trust] import interface Tunnel 1
[DeviceB-security-zone-Trust] quit
# 配置名稱為grelocalout的安全策規則,使Device B可以向Device C發送報文,具體配置步驟如下。
[DeviceB] security-policy ip
[DeviceB-security-policy-ip] rule name grelocalout
[DeviceB-security-policy-ip-1-grelocalout] source-zone local
[DeviceB-security-policy-ip-1-grelocalout] destination-zone untrust
[DeviceB-security-policy-ip-1-grelocalout] source-ip-host 11.1.2.2
[DeviceB-security-policy-ip-1-grelocalout] source-ip-host 172.168.2.2
[DeviceB-security-policy-ip-1-grelocalout] source-ip-host 192.168.11.1
[DeviceB-security-policy-ip-1-grelocalout] destination-ip-host 11.1.3.3
[DeviceB-security-policy-ip-1-grelocalout] destination-ip-host 172.168.2.3
[DeviceB-security-policy-ip-1-grelocalout] destination-ip-host 192.168.12.1
[DeviceB-security-policy-ip-1-grelocalout] action pass
[DeviceB-security-policy-ip-1-grelocalout] quit
# 配置名稱為grelocalin的安全策略規則,使Device B可以接收和處理來自Device C的報文,具體配置步驟如下。
[DeviceB-security-policy-ip] rule name grelocalin
[DeviceB-security-policy-ip-2-grelocalin] source-zone untrust
[DeviceB-security-policy-ip-2-grelocalin] destination-zone local
[DeviceB-security-policy-ip-2-grelocalin] source-ip-host 11.1.3.3
[DeviceB-security-policy-ip-2-grelocalin] source-ip-host 172.168.2.3
[DeviceB-security-policy-ip-2-grelocalin] source-ip-host 192.168.12.1
[DeviceB-security-policy-ip-2-grelocalin] destination-ip-host 11.1.2.2
[DeviceB-security-policy-ip-2-grelocalin] destination-ip-host 172.168.2.2
[DeviceB-security-policy-ip-2-grelocalin] destination-ip-host 192.168.11.1
[DeviceB-security-policy-ip-2-grelocalin] action pass
[DeviceB-security-policy-ip-2-grelocalin] quit
[DeviceB-security-policy-ip] quit
# 配置名稱為grelocalout的安全策規則,使Device B可以向Device A發送報文,具體配置步驟如下。
[DeviceB] security-policy ip
[DeviceB-security-policy-ip] rule name grelocalout
[DeviceB-security-policy-ip-3-grelocalout] source-zone local
[DeviceB-security-policy-ip-3-grelocalout] destination-zone trust
[DeviceB-security-policy-ip-3-grelocalout] source-ip-host 10.1.1.2
[DeviceB-security-policy-ip-3-grelocalout] source-ip-host 192.168.22.2
[DeviceB-security-policy-ip-3-grelocalout] source-ip-host 192.168.12.1
[DeviceB-security-policy-ip-3-grelocalout] destination-ip-host 10.1.1.1
[DeviceB-security-policy-ip-3-grelocalout] destination-ip-host 192.168.22.1
[DeviceB-security-policy-ip-3-grelocalout] destination-ip-host 192.168.11.1
[DeviceB-security-policy-ip-3-grelocalout] action pass
[DeviceB-security-policy-ip-3-grelocalout] quit
# 配置名稱為grelocalin的安全策略規則,使Device B可以接收和處理來自Device A的報文,具體配置步驟如下。
[DeviceB-security-policy-ip] rule name grelocalin
[DeviceB-security-policy-ip-4-grelocalin] source-zone trust
[DeviceB-security-policy-ip-4-grelocalin] destination-zone local
[DeviceB-security-policy-ip-4-grelocalin] source-ip-host 10.1.1.1
[DeviceB-security-policy-ip-4-grelocalin] source-ip-host 192.168.22.1
[DeviceB-security-policy-ip-4-grelocalin] source-ip-host 192.168.11.1
[DeviceB-security-policy-ip-4-grelocalin] destination-ip-host 10.1.1.2
[DeviceB-security-policy-ip-4-grelocalin] destination-ip-host 192.168.22.2
[DeviceB-security-policy-ip-4-grelocalin] destination-ip-host 192.168.12.1
[DeviceB-security-policy-ip-4-grelocalin] action pass
[DeviceB-security-policy-ip-4-grelocalin] quit
[DeviceB-security-policy-ip] quit
(3) 配置Device C
# 根據組網圖中規劃的信息,配置各接口的IP地址,具體配置步驟如下。
[DeviceC] interface gigabitethernet 1/0/1
[DeviceC-GigabitEthernet1/0/1] ip address 11.1.3.3 255.255.255.0
[DeviceC-GigabitEthernet1/0/1] quit
請參考以上步驟配置其他接口的IP地址,具體配置步驟略。
#創建Tunnel0接口,並指定隧道模式為GRE over IPv4隧道。
[DeviceC] interface tunnel 0 mode gre
[DeviceC-Tunnel0] ip address 172.168.1.3 255.255.255.0
[DeviceC-Tunnel0] source 11.1.3.3
[DeviceC-Tunnel0] destination 11.1.1.1
[DeviceC-Tunnel0] quit
[DeviceC] ip route-static 192.168.11.0 255.255.255.0 tunnel 0 preference 1
# 創建Tunnel1接口,並指定隧道模式為GRE over IPv4隧道。
[DeviceC] interface tunnel 1 mode gre
[DeviceC-Tunnel1] ip address 172.168.2.3 255.255.255.0
[DeviceC-Tunnel1] source 11.1.3.3
[DeviceC-Tunnel1] destination 11.1.2.2
[DeviceC-Tunnel1] quit
# 請根據組網圖中規劃的信息,配置靜態路由,本舉例假設下一跳IP地址為11.1.3.4,實際使用中請以具體組網情況為準,具體配置步驟如下。本舉例僅以靜態路由方式配置路由信息。實際組網中,請根據具體情況選擇相應的路由配置方式。
[DeviceC] ip route-static 11.1.1.1 24 11.1.3.4
[DeviceC] ip route-static 11.1.2.2 24 11.1.3.4
[DeviceC] ip route-static 192.168.11.0 255.255.255.0 tunnel 0 preference 1
[DeviceC] ip route-static 192.168.11.0 255.255.255.0 tunnel 1 preference 10
# 請根據組網圖中規劃的信息,將接口加入對應的安全域,具體配置步驟如下。
[DeviceC] security-zone name Untrust
[DeviceC-security-zone-Untrust] import interface Tunnel 0
[DeviceC-security-zone-Untrust] import interface Tunnel 1
[DeviceC-security-zone-Untrust] import interface gigabitethernet 1/0/1
[DeviceC-security-zone-Untrust] quit
[DeviceC] security-zone name Trust
[DeviceC-security-zone-Trust] import interface gigabitethernet 1/0/2
[DeviceC-security-zone-Trust] quit
# 配置名稱為grelocalout的安全策規則,使Device C可以向Device A和Device B發送報文,具體配置步驟如下。
[DeviceC] security-policy ip
[DeviceC-security-policy-ip] rule name grelocalout
[DeviceC-security-policy-ip-1-grelocalout] source-zone local
[DeviceC-security-policy-ip-1-grelocalout] destination-zone untrust
[DeviceC-security-policy-ip-1-grelocalout] source-ip-host 11.1.3.3
[DeviceC-security-policy-ip-1-grelocalout] source-ip-host 172.168.1.3
[DeviceC-security-policy-ip-1-grelocalout] source-ip-host 172.168.2.3
[DeviceC-security-policy-ip-1-grelocalout] source-ip-host 192.168.12.1
[DeviceC-security-policy-ip-1-grelocalout] destination-ip-host 11.1.1.1
[DeviceC-security-policy-ip-1-grelocalout] destination-ip-host 11.1.2.2
[DeviceC-security-policy-ip-1-grelocalout] destination-ip-host 172.168.1.1
[DeviceC-security-policy-ip-1-grelocalout] destination-ip-host 192.168.22.2
[DeviceC-security-policy-ip-1-grelocalout] destination-ip-host 192.168.11.1
[DeviceC-security-policy-ip-1-grelocalout] action pass
[DeviceC-security-policy-ip-1-grelocalout] quit
# 配置名稱為grelocalin的安全策略規則,使Device C可以接收和處理來自Device A和Device B的報文,具體配置步驟如下。
[DeviceC-security-policy-ip] rule name grelocalin
[DeviceC-security-policy-ip-2-grelocalin] source-zone untrust
[DeviceC-security-policy-ip-2-grelocalin] destination-zone local
[DeviceC-security-policy-ip-2-grelocalin] source-ip-host 11.1.1.1
[DeviceC-security-policy-ip-2-grelocalin] source-ip-host 11.1.2.2
[DeviceC-security-policy-ip-2-grelocalin] source-ip-host 172.168.1.1
[DeviceC-security-policy-ip-2-grelocalin] source-ip-host 192.168.22.2
[DeviceC-security-policy-ip-2-grelocalin] source-ip-host 192.168.11.1
[DeviceC-security-policy-ip-2-grelocalin] destination-ip-host 11.1.3.3
[DeviceC-security-policy-ip-2-grelocalin] destination-ip-host 172.168.1.3
[DeviceC-security-policy-ip-2-grelocalin] destination-ip-host 172.168.2.3
[DeviceC-security-policy-ip-2-grelocalin] destination-ip-host 192.168.12.1
[DeviceC-security-policy-ip-2-grelocalin] action pass
[DeviceC-security-policy-ip-2-grelocalin] quit
[DeviceC-security-policy-ip] quit
Device A和Device C之間的鏈路出現故障時,Device C必須能夠感知到該故障,並將轉發報文的路徑切換到Device B和Device C之間的鏈路上,否則Device B無法學習到點到多點GRE隧道表項。
如果Device A和Device C之間直連,則在Device C上配置靜態路由即可保證Device C能夠感知鏈路故障;如果Device A和Device C之間非直連,則需要采用以下兩種方式之一使得Device C能夠感知鏈路故障:
· 在Device A、Device B和Device C上配置動態路由協議。
· 在Device C上配置靜態路由與Track項關聯,通過Track項監測靜態路由是否有效。Track項的詳細介紹,請參見“網絡管理和監控配置指導”中的“Track”。
# 完成以上配置後,在Host C上Ping Host A,可以Ping通。查看Device A和Device B 上的點到多點GRE隧道表項。
[DeviceA] display gre p2mp tunnel-table interface tunnel 0
Total number:1
Dest Addr Mask/Prefix Len Tunnel Dest Addr Gre Key Aging
192.168.12.0 255.255.255.0 11.1.3.3 10
以上顯示信息表示Device A上存在到達分支網絡的點到多點GRE隧道表項,發往分支網絡的報文通過Device A轉發。
# 使Device A到Device C的隧道中斷。
[DeviceC] interface tunnel 0
[DeviceC-Tunnel0] shutdown
[DeviceC-Tunnel0] quit
# 經過點到多點GRE隧道表項老化時間(20秒)後,查看Device A上的點到多點GRE隧道表項。
[DeviceA] display gre p2mp tunnel-table interface tunnel 0
Total number:0
Dest Addr Mask/Prefix Len Tunnel Dest Addr Gre Key Aging
# 在Host C上Ping Host A。查看Device B上的點到多點GRE隧道表項。
[DeviceB] display gre p2mp tunnel-table interface tunnel 0
Total number:1
Dest Addr Mask/Prefix Len Tunnel Dest Addr Gre Key Aging
192.168.12.0 255.255.255.0 11.1.3.3 10
此後,在Host A上Ping Host C,可以Ping通。
以上驗證過程表示Device A和Device C之間的鏈路出現故障後,Device A上的點到多點GRE隧道表項在老化時間到達後被刪除,Device A通過備份接口將發往分支網絡的報文轉發給Device B,由Device B將報文發送到分支網絡。
某企業分支機構在內網出口處采用雙網關進行備份,企業中心節點Device A上配置點到多點GRE隧道接口,使得Device A可以與分支機構建立兩條GRE隧道:一條與分支網絡網關Device B相連,另一條與分支網絡的備份網關Device C相連。中心節點Device A能夠根據GRE Key決定通過哪條GRE隧道向分支網絡內的主機發送報文。
為了滿足上述需求,需要在Device B和Device C上分別為GRE隧道配置不同的GRE Key,以便Device A根據GRE Key選擇優先級高的隧道轉發報文。
本例中,要求Device A優先通過與Device B連接的GRE隧道向分支網絡內的主機發送報文。
圖2-7 分支節點備份的點到多點GRE隧道配置組網圖
設備 |
接口 |
IP地址 |
安全域 |
Device A |
GE1/0/1 |
11.1.1.1/24 |
Untrust |
GE1/0/2 |
172.17.17.1/24 |
Trust |
|
Tunnel0 |
192.168.22.1/24 |
Untrust |
|
Device B |
GE1/0/1 |
11.1.2.2/24 |
Untrust |
GE1/0/2 |
192.168.1.2/24 |
Trust |
|
Tunnel0 |
192.168.22.2/24 |
Untrust |
|
Device C |
GE1/0/1 |
11.1.3.3/24 |
Untrust |
GE1/0/2 |
192.168.1.3/24 |
Trust |
|
Tunnel0 |
192.168.22.3/24 |
Untrust |
(1) 配置Device A
# 根據組網圖中規劃的信息,配置各接口的IP地址,具體配置步驟如下。
<DeviceA> system-view
[DeviceA] interface gigabitethernet 1/0/1
[DeviceA-GigabitEthernet1/0/1] ip address 11.1.1.1 255.255.255.0
[DeviceA-GigabitEthernet1/0/1] quit
[DeviceA] interface GigabitEthernet1/0/2
[DeviceA-GigabitEthernet1/0/2] ip address 172.17.17.1 255.255.255.0
[DeviceA-GigabitEthernet1/0/2] quit
# 創建Tunnel0接口,並指定隧道模式為點到多點GRE隧道。
[DeviceA] interface tunnel 0 mode gre-p2mp
[DeviceA-Tunnel0] ip address 192.168.22.1 255.255.255.0
[DeviceA-Tunnel0] gre p2mp branch-network-mask 255.255.255.0
[DeviceA-Tunnel0] gre p2mp aging-time 20
[DeviceA-Tunnel0] source 11.1.1.1
[DeviceA-Tunnel0] quit
# 請根據組網圖中規劃的信息,配置靜態路由,本舉例假設下一跳IP地址為11.1.1.2,實際使用中請以具體組網情況為準,具體配置步驟如下。本舉例僅以靜態路由方式配置路由信息。實際組網中,請根據具體情況選擇相應的路由配置方式。
[DeviceA] ip route-static 11.1.2.2 24 11.1.1.2
[DeviceA] ip route-static 11.1.3.3 24 11.1.1.2
[DeviceA] ip route-static 192.168.1.0 24 tunnel 0
# 請根據組網圖中規劃的信息,將接口加入對應的安全域,具體配置步驟如下。
[DeviceA] security-zone name Untrust
[DeviceA-security-zone-Untrust] import interface Tunnel 0
[DeviceA-security-zone-Untrust] import interface gigabitethernet 1/0/1
[DeviceA-security-zone-Untrust] quit
[DeviceA] security-zone name Trust
[DeviceA-security-zone-Trust] import interface gigabitethernet 1/0/2
[DeviceA-security-zone-Trust] quit
# 配置名稱為grelocalout的安全策規則,使Device A可以向Device B和Device C發送報文,具體配置步驟如下。
[DeviceA] security-policy ip
[DeviceA-security-policy-ip] rule name grelocalout
[DeviceA-security-policy-ip-1-grelocalout] source-zone local
[DeviceA-security-policy-ip-1-grelocalout] destination-zone untrust
[DeviceA-security-policy-ip-1-grelocalout] source-ip-host 11.1.1.1
[DeviceA-security-policy-ip-1-grelocalout] source-ip-host 192.168.22.1
[DeviceA-security-policy-ip-1-grelocalout] source-ip-host 172.17.17.1
[DeviceA-security-policy-ip-1-grelocalout] destination-ip-host 11.1.2.2
[DeviceA-security-policy-ip-1-grelocalout] destination-ip-host 11.1.3.3
[DeviceA-security-policy-ip-1-grelocalout] destination-ip-host 192.168.22.2
[DeviceA-security-policy-ip-1-grelocalout] destination-ip-host 192.168.22.3
[DeviceA-security-policy-ip-1-grelocalout] destination-ip-host 192.168.1.2
[DeviceA-security-policy-ip-1-grelocalout] destination-ip-host 192.168.1.3
[DeviceA-security-policy-ip-1-grelocalout] action pass
[DeviceA-security-policy-ip-1-grelocalout] quit
# 配置名稱為grelocalin的安全策略規則,使Device A可以接收和處理來自Device B和Device C的報文,具體配置步驟如下。
[DeviceA-security-policy-ip] rule name grelocalin
[DeviceA-security-policy-ip-2-grelocalin] source-zone untrust
[DeviceA-security-policy-ip-2-grelocalin] destination-zone local
[DeviceA-security-policy-ip-2-grelocalin] source-ip-host 11.1.2.2
[DeviceA-security-policy-ip-2-grelocalin] source-ip-host 11.1.3.3
[DeviceA-security-policy-ip-2-grelocalin] source-ip-host 192.168.22.2
[DeviceA-security-policy-ip-2-grelocalin] source-ip-host 192.168.22.3
[DeviceA-security-policy-ip-2-grelocalin] source-ip-host 192.168.1.2
[DeviceA-security-policy-ip-2-grelocalin] source-ip-host 192.168.1.3
[DeviceA-security-policy-ip-2-grelocalin] destination-ip-host 11.1.1.1
[DeviceA-security-policy-ip-2-grelocalin] destination-ip-host 192.168.22.1
[DeviceA-security-policy-ip-2-grelocalin] destination-ip-host 172.17.17.1
[DeviceA-security-policy-ip-2-grelocalin] action pass
[DeviceA-security-policy-ip-2-grelocalin] quit
[DeviceA-security-policy-ip] quit
(2) 配置Device B
# 根據組網圖中規劃的信息,配置各接口的IP地址,具體配置步驟如下。
[DeviceB] interface gigabitethernet 1/0/1
[DeviceB-GigabitEthernet1/0/1] ip address 11.1.2.2 255.255.255.0
[DeviceB-GigabitEthernet1/0/1] quit
[DeviceB] interface GigabitEthernet1/0/2
[DeviceB-GigabitEthernet1/0/2] ip address 192.168.1.2 255.255.255.0
[DeviceB-GigabitEthernet1/0/2] quit
# 創建Tunnel0接口,並指定隧道模式為GRE over IPv4隧道。
[DeviceB] interface tunnel 0 mode gre
[DeviceB-Tunnel0] ip address 192.168.22.2 255.255.255.0
[DeviceB-Tunnel0] source 11.1.2.2
[DeviceB-Tunnel0] destination 11.1.1.1
[DeviceB-Tunnel0] gre key 1
[DeviceB-Tunnel0] quit
# 請根據組網圖中規劃的信息,配置靜態路由,本舉例假設下一跳IP地址為11.1.2.3,實際使用中請以具體組網情況為準,具體配置步驟如下。本舉例僅以靜態路由方式配置路由信息。實際組網中,請根據具體情況選擇相應的路由配置方式。
[DeviceB] ip route-static 11.1.1.1 24 11.1.2.3
[DeviceB] ip route-static 172.17.17.0 24 tunnel 0
# 請根據組網圖中規劃的信息,將接口加入對應的安全域,具體配置步驟如下。
[DeviceB] security-zone name Untrust
[DeviceB-security-zone-Untrust] import interface Tunnel 0
[DeviceB-security-zone-Untrust] import interface gigabitethernet 1/0/1
[DeviceB-security-zone-Untrust] quit
[DeviceB] security-zone name Trust
[DeviceB-security-zone-Trust] import interface gigabitethernet 1/0/2
[DeviceB-security-zone-Trust] quit
# 配置名稱為grelocalout的安全策規則,使Device B可以向Device A發送報文,具體配置步驟如下。
[DeviceB] security-policy ip
[DeviceB-security-policy-ip] rule name grelocalout
[DeviceB-security-policy-ip-1-grelocalout] source-zone local
[DeviceB-security-policy-ip-1-grelocalout] destination-zone untrust
[DeviceB-security-policy-ip-1-grelocalout] source-ip-host 11.1.2.2
[DeviceB-security-policy-ip-1-grelocalout] source-ip-host 192.168.22.2
[DeviceB-security-policy-ip-1-grelocalout] source-ip-host 192.168.1.2
[DeviceB-security-policy-ip-1-grelocalout] destination-ip-host 11.1.1.1
[DeviceB-security-policy-ip-1-grelocalout] destination-ip-host 192.168.22.1
[DeviceB-security-policy-ip-1-grelocalout] destination-ip-host 172.17.17.1
[DeviceB-security-policy-ip-1-grelocalout] action pass
[DeviceB-security-policy-ip-1-grelocalout] quit
# 配置名稱為grelocalin的安全策略規則,使Device B可以接收和處理來自Device A的報文,具體配置步驟如下。
[DeviceB-security-policy-ip] rule name grelocalin
[DeviceB-security-policy-ip-2-grelocalin] source-zone untrust
[DeviceB-security-policy-ip-2-grelocalin] destination-zone local
[DeviceB-security-policy-ip-2-grelocalin] source-ip-host 11.1.1.1
[DeviceB-security-policy-ip-2-grelocalin] source-ip-host 192.168.22.1
[DeviceB-security-policy-ip-2-grelocalin] source-ip-host 172.17.17.1
[DeviceB-security-policy-ip-2-grelocalin] destination-ip-host 11.1.2.2
[DeviceB-security-policy-ip-2-grelocalin] destination-ip-host 192.168.22.2
[DeviceB-security-policy-ip-2-grelocalin] destination-ip-host 192.168.1.2
[DeviceB-security-policy-ip-2-grelocalin] action pass
[DeviceB-security-policy-ip-2-grelocalin] quit
[DeviceB-security-policy-ip] quit
(3) 配置Device C
# 根據組網圖中規劃的信息,配置各接口的IP地址,具體配置步驟如下。
[DeviceC] interface gigabitethernet 1/0/1
[DeviceC-GigabitEthernet1/0/1] ip address 11.1.3.3 255.255.255.0
[DeviceC-GigabitEthernet1/0/1] quit
[DeviceC] interface GigabitEthernet1/0/2
[DeviceC-GigabitEthernet1/0/2] ip address 192.168.1.3 255.255.255.0
[DeviceC-GigabitEthernet1/0/2] quit
# 創建Tunnel0接口,並指定隧道模式為GRE over IPv4隧道。
[DeviceC] interface tunnel 0 mode gre
[DeviceC-Tunnel0] ip address 192.168.22.3 255.255.255.0
[DeviceC-Tunnel0] source 11.1.3.3
[DeviceC-Tunnel0] destination 11.1.1.1
[DeviceC-Tunnel0] gre key 2
[DeviceC-Tunnel0] quit
# 請根據組網圖中規劃的信息,配置靜態路由,本舉例假設下一跳IP地址為11.1.3.4,實際使用中請以具體組網情況為準,具體配置步驟如下。本舉例僅以靜態路由方式配置路由信息。實際組網中,請根據具體情況選擇相應的路由配置方式。
[DeviceC] ip route-static 11.1.1.1 24 11.1.3.4
[DeviceC] ip route-static 172.17.17.0 24 tunnel 0
# 請根據組網圖中規劃的信息,將接口加入對應的安全域,具體配置步驟如下。
[DeviceC] security-zone name Untrust
[DeviceC-security-zone-Untrust] import interface Tunnel 0
[DeviceC-security-zone-Untrust] import interface gigabitethernet 1/0/1
[DeviceC-security-zone-Untrust] quit
[DeviceC] security-zone name Trust
[DeviceC-security-zone-Trust] import interface gigabitethernet 1/0/2
[DeviceC-security-zone-Trust] quit
# 配置名稱為grelocalout的安全策規則,使Device C可以向Device A發送報文,具體配置步驟如下。
[DeviceC] security-policy ip
[DeviceC-security-policy-ip] rule name grelocalout
[DeviceC-security-policy-ip-1-grelocalout] source-zone local
[DeviceC-security-policy-ip-1-grelocalout] destination-zone untrust
[DeviceC-security-policy-ip-1-grelocalout] source-ip-host 11.1.3.3
[DeviceC-security-policy-ip-1-grelocalout] source-ip-host 192.168.22.3
[DeviceC-security-policy-ip-1-grelocalout] source-ip-host 192.168.1.3
[DeviceC-security-policy-ip-1-grelocalout] destination-ip-host 11.1.1.1
[DeviceC-security-policy-ip-1-grelocalout] destination-ip-host 192.168.22.1
[DeviceC-security-policy-ip-1-grelocalout] destination-ip-host 172.17.17.1
[DeviceC-security-policy-ip-1-grelocalout] action pass
[DeviceC-security-policy-ip-1-grelocalout] quit
# 配置名稱為grelocalin的安全策略規則,使Device C可以接收和處理來自Device A的報文,具體配置步驟如下。
[DeviceC-security-policy-ip] rule name grelocalin
[DeviceC-security-policy-ip-2-grelocalin] source-zone untrust
[DeviceC-security-policy-ip-2-grelocalin] destination-zone local
[DeviceC-security-policy-ip-2-grelocalin] source-ip-host 11.1.1.1
[DeviceC-security-policy-ip-2-grelocalin] source-ip-host 192.168.22.1
[DeviceC-security-policy-ip-2-grelocalin] source-ip-host 172.17.17.1
[DeviceC-security-policy-ip-2-grelocalin] destination-ip-host 11.1.3.3
[DeviceC-security-policy-ip-2-grelocalin] destination-ip-host 192.168.22.3
[DeviceC-security-policy-ip-2-grelocalin] destination-ip-host 192.168.1.3
[DeviceC-security-policy-ip-2-grelocalin] action pass
[DeviceC-security-policy-ip-2-grelocalin] quit
[DeviceC-security-policy-ip] quit
# 在Host B上配置Device C為默認網關。在Host B上Ping Host A,可以Ping通。查看Device A上的點到多點GRE隧道表項。
[DeviceA] display gre p2mp tunnel-table interface tunnel 0
Total number:1
Dest Addr Mask/Prefix Len Tunnel Dest Addr Gre Key Aging
192.168.1.0 255.255.255.0 11.1.3.3 2 20
# 在Host B上配置Device B為默認網關。在Host B上Ping Host A,可以Ping通。查看Device A上的點到多點GRE隧道表項。
[DeviceA] display gre p2mp tunnel-table interface tunnel 0
Total number:2
Dest Addr Mask/Prefix Len Tunnel Dest Addr Gre Key Aging
192.168.1.0 255.255.255.0 11.1.3.3 2 20
192.168.1.0 255.255.255.0 11.1.2.2 1 20
以上顯示信息表示Device A上存在兩條到達分支網絡的點到多點GRE隧道表項,Device A優先選擇GRE Key值小的點到多點GRE隧道表項,即通過Device B轉發報文。
# 使Device A到Device B的隧道中斷。
[DeviceB] interface tunnel 0
[DeviceB-Tunnel0] shutdown
# 將Host B的默認網關配置為Device C。Device B對應的點到多點GRE隧道表項老化後,在Host B上Ping Host A,仍然可以Ping通。查看Device A上的點到多點GRE隧道表項。
[DeviceA] display gre p2mp tunnel-table interface tunnel 0
Total number:1
Dest Addr Mask/Prefix Len Tunnel Dest Addr Gre Key Aging
192.168.1.0 255.255.255.0 11.1.3.3 2 10
以上顯示信息表示Device A和Device B之間的鏈路出現故障後,Device A上隻存在通過Device C將報文發送到分支網絡的點到多點GRE隧道表項。
不同款型規格的資料略有差異, 詳細信息請向具體銷售和400谘詢。H3C保留在沒有任何通知或提示的情況下對資料內容進行修改的權利!