14-GRE和OSPF結合使用典型配置舉例
本章節下載: 14-GRE和OSPF結合使用典型配置舉例 (189.76 KB)
H3C S6890產品 GRE和OSPF結合使用典型配置舉例
資料版本:6W100-20190628
Copyright © 2019 bobty下载软件 版權所有,保留一切權利。
非經本公司書麵許可,任何單位和個人不得擅自摘抄、複製本文檔內容的部分或全部,並不得以任何形式傳播。
除bobty下载软件 的商標外,本手冊中出現的其它公司的商標、產品標識及商品名稱,由各自權利人擁有。
本文檔中的信息可能變動,恕不另行通知。
目 錄
本文檔介紹了GRE隧道和OSPF相結合使用的典型配置舉例。
本文檔中的配置均是在實驗室環境下進行的配置和驗證,配置前設備的所有參數均采用出廠時的缺省配置。如果您已經對設備進行了配置,為了保證配置效果,請確認現有配置和以下舉例中的配置不衝突。
本文假設您已了解GRE隧道和OSPF的相關特性。
如圖1所示,Device A為某機構總部網關,Device B和Device C為分支網關,運營商為各網關分配了公網IP地址,並保證網關之間可以通信,要求:
· 總部和分支之間建立GRE隧道,通過隧道使各總部、分支機構可以實現互訪;
· 配置OSPF協議使網關上存在通過Tunnel接口到達目的地址的路由表項。
圖1 GRE和OSPF結合使用典型配置舉例組網圖
設備 |
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
Device A |
Vlan-int10 |
191.2.1.1/24 |
Device B |
Vlan-int10 |
191.3.1.1/24 |
|
Vlan-int20 |
10.1.1.1/24 |
|
Vlan-int20 |
10.7.1.1/24 |
|
Tunnel 1 |
10.5.1.1/24 |
|
Tunnel 1 |
10.5.1.2/24 |
|
Tunnel 2 |
10.6.1.1/24 |
|
|
|
Device C |
Vlan-int10 |
191.4.1.1/24 |
|
|
|
|
Vlan-int20 |
10.8.1.1/24 |
|
|
|
|
Tunnel 2 |
10.6.1.2/24 |
|
|
|
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的。
· 封裝後的報文不能根據目的地址和路由表進行第二次三層轉發,需要將封裝後的報文發送給業務環回組,由業務環回組將報文回送給轉發模塊後,再進行三層轉發。因此,需要創建tunnel類型的業務環回組,以實現隧道報文的接收和發送。
· 缺省情況下,S6890係列交換機的接口處於ADM(Administratively Down)狀態,請根據實際需要在對應接口視圖下使用undo shutdown命令開啟接口。
配置網關設備之間的IPv4路由協議,確保設備之間IPv4報文能夠正常交互,具體配置過程略。
# 配置接口VLAN-interface 10的IP地址。
<DeviceA> system-view
[DeviceA] vlan 10
[DeviceA-vlan10] port Ten-GigabitEthernet 1/0/1
[DeviceA-vlan10] quit
[DeviceA] interface vlan-interface 10
[DeviceA-vlan-interface10] ip address 191.2.1.1 255.255.255.0
[DeviceA-vlan-interface10] quit
# 請參考以上方法配置上圖中Device A其它接口的IP地址,配置步驟這裏省略。
# 創建業務環回組1,並配置服務類型為tunnel。
[DeviceA] service-loopback group 1 type tunnel
# 將接口Ten-GigabitEthernet 1/0/3加入業務環回組1。
[DeviceA] interface Ten-GigabitEthernet 1/0/3
[DeviceA-Ten-GigabitEthernet1/0/3] port service-loopback group 1
[DeviceA-Ten-GigabitEthernet1/0/3] quit
# 創建Tunnel1接口,並指定隧道模式為GRE over IPv4隧道。
[DeviceA] interface tunnel 1 mode gre
# 配置Tunnel1接口的IP地址。
[DeviceA-Tunnel1] ip address 10.5.1.1 24
# 配置Tunnel1接口的源接口為VLAN-interface 10。
[DeviceA-Tunnel1] source vlan-interface 10
# 配置Tunnel1接口的目的端地址。
[DeviceA-Tunnel1] destination 191.3.1.1
[DeviceA-Tunnel1] quit
# 創建Tunnel2接口,並指定隧道模式為GRE over IPv4隧道。
[DeviceA] interface tunnel 2 mode gre
# 配置Tunnel2接口的IP地址。
[DeviceA-Tunnel2] ip address 10.6.1.1 24
# 配置Tunnel2接口的源接口為VLAN-interface 10。
[DeviceA-Tunnel2] source vlan-interface 10
# 配置Tunnel2接口的目的端地址。
[DeviceA-Tunnel2] destination 191.4.1.1
[DeviceA-Tunnel2] quit
# 啟動OSPF,並配置其Router ID為10.6.1.1。
[DeviceA] router-id 10.6.1.1
[DeviceA] ospf 1
[DeviceA-ospf-1] area 0
[DeviceA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[DeviceA-ospf-1-area-0.0.0.0] network 10.5.1.0 0.0.0.255
[DeviceA-ospf-1-area-0.0.0.0] network 10.6.1.0 0.0.0.255
# 配置接口VLAN-interface10的IP地址。
<DeviceB> system-view
[DeviceB] vlan 10
[DeviceB-vlan10] port Ten-GigabitEthernet 1/0/1
[DeviceB-vlan10] quit
[DeviceB] interface vlan-interface 10
[DeviceB-vlan-interface10] ip address 191.3.1.1 255.255.255.0
[DeviceB-vlan-interface10] quit
# 請參考以上方法配置上圖中Device B其它接口的IP地址,配置步驟這裏省略。
# 創建業務環回組1,並配置服務類型為tunnel。
[DeviceB] service-loopback group 1 type tunnel
# 將接口Ten-GigabitEthernet1/0/3加入業務環回組1。
[DeviceB] interface Ten-GigabitEthernet 1/0/3
[DeviceB-Ten-GigabitEthernet1/0/3] port service-loopback group 1
[DeviceB-Ten-GigabitEthernet1/0/3] quit
# 創建Tunnel1接口,並指定隧道模式為GRE over IPv4隧道。
[DeviceB] interface tunnel 1 mode gre
# 配置Tunnel1接口的IP地址。
[DeviceB-Tunnel1] ip address 10.5.1.2 24
# 配置Tunnel1接口的源接口為VLAN-interface10。
[DeviceB-Tunnel1] source Vlan-interface 10
# 配置Tunnel1接口的目的端地址。
[DeviceB-Tunnel1] destination 191.2.1.1
[DeviceB-Tunnel1] quit
# 啟動OSPF,並配置其Router ID為10.7.1.1。
[DeviceB] router-id 10.7.1.1
[DeviceB] ospf 1
[DeviceB-ospf-1] area 0
[DeviceB-ospf-1-area-0.0.0.0] network 10.7.1.0 0.0.0.255
[DeviceB-ospf-1-area-0.0.0.0] network 10.5.1.0 0.0.0.255
# 配置接口VLAN-interface10的IP地址。
<DeviceC> system-view
[DeviceC] vlan 10
[DeviceC-vlan10] port Ten-GigabitEthernet 1/0/1
[DeviceC-vlan10] quit
[DeviceC] interface Vlan-interface 10
[DeviceC-Vlan-interface10] ip address 191.4.1.1 255.255.255.0
[DeviceC-Vlan-interface10] quit
# 請參考以上方法配置上圖中Device C其它接口的IP地址,配置步驟這裏省略。
# 創建業務環回組1,並配置服務類型為tunnel。
[DeviceC] service-loopback group 1 type tunnel
# 將接口Ten-GigabitEthernet1/0/3加入業務環回組1。
[DeviceC] interface Ten-GigabitEthernet 1/0/3
[DeviceC-Ten-GigabitEthernet1/0/3] port service-loopback group 1
[DeviceC-Ten-GigabitEthernet1/0/3] quit
# 創建Tunnel2接口,並指定隧道模式為GRE over IPv4隧道。
[DeviceC] interface tunnel 2 mode gre
# 配置Tunnel2接口的IP地址。
[DeviceC-Tunnel2] ip address 10.6.1.2 24
# 配置Tunnel1接口的源接口為VLAN-interface10。
[DeviceC-Tunnel2] source Vlan-interface 10
# 配置Tunnel2接口的目的端地址。
[DeviceC-Tunnel2] destination 191.2.1.1
[DeviceC-Tunnel2] quit
# 啟動OSPF,並配置其Router ID為10.8.1.1。
[DeviceC] router-id 10.8.1.1
[DeviceC] ospf 1
[DeviceC-ospf-1] area 0
[DeviceC-ospf-1-area-0.0.0.0] network 10.8.1.0 0.0.0.255
[DeviceC-ospf-1-area-0.0.0.0] network 10.6.1.0 0.0.0.255
(1) 從Host A可以ping通Host B。
C:\> ping 10.7.1.2
Pinging 10.7.1.2 with 32 bytes of data:
Reply from 10.7.1.2: bytes=32 time=19ms TTL=253
Reply from 10.7.1.2: bytes=32 time<1ms TTL=253
Reply from 10.7.1.2: bytes=32 time<1ms TTL=253
Reply from 10.7.1.2: bytes=32 time<1ms TTL=253
Ping statistics for 10.7.1.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 19ms, Average = 4ms
(2) 從Host A可以ping通Host C。
C:\> ping 10.8.1.2
Pinging 10.8.1.2 with 32 bytes of data:
Reply from 10.8.1.2: bytes=32 time=18ms TTL=253
Reply from 10.8.1.2: bytes=32 time<1ms TTL=253
Reply from 10.8.1.2: bytes=32 time<1ms TTL=253
Reply from 10.8.1.2: bytes=32 time<1ms TTL=253
Ping statistics for 10.8.1.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 19ms, Average = 4ms
(3) 從Host B可以ping通Host C。
C:\> ping 10.8.1.2
Pinging 10.8.1.2 with 32 bytes of data:
Reply from 10.8.1.2: bytes=32 time=20ms TTL=251
Reply from 10.8.1.2: bytes=32 time<1ms TTL=251
Reply from 10.8.1.2: bytes=32 time<1ms TTL=251
Reply from 10.8.1.2: bytes=32 time<1ms TTL=251
Ping statistics for 10.8.1.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 19ms, Average = 4ms
· Device A
#
service-loopback group 1 type tunnel
#
vlan 10
#
vlan 20
#
interface Vlan-interface10
ip address 191.2.1.1 255.255.255.0
#
interface Vlan-interface20
ip address 10.1.1.1 255.255.255.0
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port access vlan 10
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port access vlan 20
#
interface Ten-GigabitEthernet1/0/3
port link-mode bridge
port service-loopback group 1
#
interface Tunnel1 mode gre
source vlan-interface10
destination 191.3.1.1
ip address 10.5.1.1 255.255.255.0
#
interface Tunnel2 mode gre
source vlan-interface10
destination 191.4.1.1
ip address 10.6.1.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.5.1.0 0.0.0.255
network 10.6.1.0 0.0.0.255
#
· Device B
#
service-loopback group 1 type tunnel
#
vlan 10
#
vlan 20
#
interface Vlan-interface10
ip address 191.3.1.1 255.255.255.0
#
interface Vlan-interface20
ip address 10.7.1.1 255.255.255.0
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port access vlan 10
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port access vlan 20
#
interface Ten-GigabitEthernet1/0/3
port link-mode bridge
port service-loopback group 1
#
interface Tunnel1 mode gre
source Vlan-interface10
destination 191.2.1.1
ip address 10.5.1.2 255.255.255.0
#
ospf 1
area 0.0.0.0
network 10.7.1.0 0.0.0.255
network 10.5.1.0 0.0.0.255
#
· Device C
#
service-loopback group 1 type tunnel
#
vlan 10
#
vlan 20
#
interface Vlan-interface10
ip address 191.4.1.1 255.255.255.0
#
interface Vlan-interface20
ip address 10.8.1.1 255.255.255.0
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port access vlan 10
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port access vlan 20
#
interface Ten-GigabitEthernet1/0/3
port link-mode bridge
port service-loopback group 1
#
interface Tunnel2 mode gre
source Vlan-interface10
destination 191.2.1.1
ip address 10.6.1.2 255.255.255.0
#
ospf 1
area 0.0.0.0
network 10.8.1.0 0.0.0.255
network 10.6.1.0 0.0.0.255
#
· H3C S6890係列交換機 三層技術-IP業務配置指導(R27xx)
· H3C S6890係列交換機 三層技術-IP業務命令參考(R27xx)
· H3C S6890係列交換機 三層技術-IP路由配置指導(R27xx)
· H3C S6890係列交換機 三層技術-IP路由命令參考(R27xx)
不同款型規格的資料略有差異, 詳細信息請向具體銷售和400谘詢。H3C保留在沒有任何通知或提示的情況下對資料內容進行修改的權利!