27-H3C MSR係列路由器 OSPF典型配置舉例
本章節下載: 27-H3C MSR係列路由器 OSPF典型配置舉例 (256.94 KB)
H3C MSR係列路由器
OSPF配置舉例
Copyright © 2024 bobty下载软件 版權所有,保留一切權利。
非經本公司書麵許可,任何單位和個人不得擅自摘抄、複製本文檔內容的部分或全部,並不得以任何形式傳播。
除bobty下载软件 的商標外,本手冊中出現的其它公司的商標、產品標識及商品名稱,由各自權利人擁有。
本文檔中的信息可能變動,恕不另行通知。
目 錄
本文檔介紹了OSPF路由信息過濾的配置舉例。
本文檔適用於使用Comware V7軟件版本的MSR係列路由器,如果使用過程中與產品實際情況有差異,請參考相關產品手冊,或以設備實際情況為準。
本文檔中的配置均是在實驗室環境下進行的配置和驗證,配置前設備的所有參數均采用出廠時的缺省配置。如果您已經對設備進行了配置,為了保證配置效果,請確認現有配置和以下舉例中的配置不衝突。
本文檔假設您已了解OSPF路由信息過濾的特性。
如圖1所示,公司A使用OSPF路由協議實現公司設備全網互通,後來公司A擴張兼並了公司B,要求將公司B采用的RIP路由協議與公司A的OSPF協議互相引入,使得各個部門可以實現互通。Device A和Device B作為公司核心設備負責各個部門間的通信。由於業務需要,現要求通過下列措施控製並調整網絡中的路由信息:
· 在Device E上對引入的路由信息進行過濾,使得研發二部所在網段無法被引入到OSPF內。
· 在Device C上使用路由信息的過濾功能,使得市場一部所在網段無法訪問研發一部。
· 在Device D上使用路由信息的過濾功能,使得研發一部和售後服務部所在網段無法訪問市場二部。
圖1 OSPF路由信息過濾組網圖
設備 |
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
Device A |
GE1/0/1 |
10.1.1.1/24 |
Device B |
GE1/0/1 |
10.1.1.2/24 |
|
GE1/0/2 |
10.2.1.1/24 |
|
GE1/0/2 |
10.3.1.1/24 |
|
GE1/0/3 |
10.4.1.1/24 |
|
|
|
Device C |
GE1/0/1 |
10.2.1.2/24 |
Device D |
GE1/0/1 |
10.3.1.2/24 |
|
Loop0 |
192.168.3.1/24 (市場一部所在網段) |
|
Loop0 |
192.168.1.1/24 (售後服務部所在網段) |
|
|
|
|
Loop1 |
192.168.2.1/24 (研發一部所在網段) |
Device E |
GE1/0/1 |
10.4.1.2/24 |
Device F |
GE1/0/1 |
10.5.1.2/24 |
|
GE1/0/2 |
10.5.1.1/24 |
|
Loop0 |
192.168.4.1/24 (研發二部所在網段) |
|
|
|
|
Loop1 |
192.168.5.1/24 (市場二部所在網段) |
本配置舉例是在MSR3610-X1路由器Release 6749版本上進行配置和驗證的。
· 路由信息過濾功能中對於引入外部路由信息時采用export關鍵字進行過濾,該參數隻能在ASBR上生效。
· 路由信息過濾功能隻是對路由表中相關路由信息過濾,並不是過濾掉OSPF中通告的LSA。
· 由於路由通信是雙向的,使用路由信息過濾功能將某一目的網段過濾後,該路由器下聯的其它網段無法訪問這個目的網段的設備,這個目的網段的設備也不能訪問源地址網段的設備。
· 使用路由信息過濾功能配合ACL使用時,必須將最後一條規則設置為允許所有源地址通過才能避免將所有網段路由全部過濾掉。
# 配置接口GigabitEthernet1/0/1的IP地址。
<DeviceA> system-view
[DeviceA] interface GigabitEthernet 1/0/1
[DeviceA-GigabitEthernet1/0/1] ip address 10.1.1.1 24
[DeviceA-GigabitEthernet1/0/1] quit
# 請參考以上方法配置其它相關接口的IP地址,配置步驟這裏省略。
# 在Device A上使能指定網段的OSPF路由功能。
<DeviceA> system-view
[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] quit
[DeviceA-ospf-1] area 2
[DeviceA-ospf-1-area-0.0.0.2] network 10.2.1.0 0.0.0.255
[DeviceA-ospf-1-area-0.0.0.2] quit
[DeviceA-ospf-1] area 1
[DeviceA-ospf-1-area-0.0.0.1] network 10.4.1.0 0.0.0.255
[DeviceA-ospf-1-area-0.0.0.1] quit
[DeviceA-ospf-1] quit
# 在Device B上使能指定網段的OSPF路由功能。
<DeviceB> system-view
[DeviceB] ospf 1
[DeviceB-ospf-1] area 0
[DeviceB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[DeviceB-ospf-1-area-0.0.0.0] quit
[DeviceB-ospf-1] area 3
[DeviceB-ospf-1-area-0.0.0.3] network 10.3.1.0 0.0.0.255
[DeviceB-ospf-1-area-0.0.0.3] quit
[DeviceB-ospf-1] quit
# 在Device C上使能指定網段的OSPF路由功能。
<DeviceC> system-view
[DeviceC] ospf 1
[DeviceC-ospf-1] area 2
[DeviceC-ospf-1-area-0.0.0.2] network 10.2.1.0 0.0.0.255
[DeviceC-ospf-1-area-0.0.0.2] network 192.168.3.0 0.0.0.255
[DeviceC-ospf-1-area-0.0.0.2] quit
[DeviceC-ospf-1] quit
# 在Device D上使能指定網段的OSPF路由功能。
<DeviceD> system-view
[DeviceD] ospf 1
[DeviceD-ospf-1] area 3
[DeviceD-ospf-1-area-0.0.0.3] network 10.3.1.0 0.0.0.255
[DeviceD-ospf-1-area-0.0.0.3] network 192.168.1.0 0.0.0.255
[DeviceD-ospf-1-area-0.0.0.3] network 192.168.2.0 0.0.0.255
[DeviceD-ospf-1-area-0.0.0.3] quit
[DeviceD-ospf-1] quit
# 在Device E上使能指定網段的OSPF路由功能。
<DeviceE> system-view
[DeviceE] ospf 1
[DeviceE-ospf-1] area 1
[DeviceE-ospf-1-area-0.0.0.1] network 10.4.1.0 0.0.0.255
[DeviceE-ospf-1-area-0.0.0.1] quit
[DeviceE-ospf-1] quit
# 在Device E上使能指定網段的RIP功能。
<DeviceE> system-view
[DeviceE] rip 1
[DeviceE-rip-1] version 2
[DeviceE-rip-1] undo summary
[DeviceE-rip-1] network 10.5.1.0 0.0.0.255
[DeviceE-rip-1] quit
# 在Device F上使能指定網段的RIP功能。
<DeviceF> system-view
[DeviceF] rip 1
[DeviceF-rip-1] version 2
[DeviceF-rip-1] undo summary
[DeviceF-rip-1] network 10.5.1.0 0.0.0.255
[DeviceF-rip-1] network 192.168.4.0 0.0.0.255
[DeviceF-rip-1] network 192.168.5.0 0.0.0.255
[DeviceF-rip-1] quit
# 在Device E上將直連路由和OSPF路由引入到RIP網絡中。
<DeviceE> system-view
[DeviceE] rip 1
[DeviceE-rip-1] import-route direct
[DeviceE-rip-1] import-route ospf
[DeviceE-rip-1] quit
# 在Device E上將直連路由和RIP路由引入到OSPF網絡中。
[DeviceE] ospf 1
[DeviceE-ospf-1] import-route direct
[DeviceE-ospf-1] import-route rip
[DeviceE-ospf-1] quit
# 查看Device E的路由表信息。
[DeviceE] display ip routing-table
Destinations : 24 Routes : 24
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
10.1.1.0/24 OSPF 10 2 10.4.1.1 GE1/0/1
10.2.1.0/24 OSPF 10 2 10.4.1.1 GE1/0/1
10.3.1.0/24 OSPF 10 3 10.4.1.1 GE1/0/1
10.4.1.0/24 Direct 0 0 10.4.1.2 GE1/0/1
10.4.1.0/32 Direct 0 0 10.4.1.2 GE1/0/1
10.4.1.2/32 Direct 0 0 127.0.0.1 InLoop0
10.4.1.255/32 Direct 0 0 10.4.1.2 GE1/0/1
10.5.1.0/24 Direct 0 0 10.5.1.1 GE1/0/2
10.5.1.0/32 Direct 0 0 10.5.1.1 GE1/0/2
10.5.1.1/32 Direct 0 0 127.0.0.1 InLoop0
10.5.1.255/32 Direct 0 0 10.5.1.1 GE1/0/2
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.1/32 OSPF 10 3 10.4.1.1 GE1/0/1
192.168.2.1/32 OSPF 10 3 10.4.1.1 GE1/0/1
192.168.3.1/32 OSPF 10 2 10.4.1.1 GE1/0/1
192.168.4.0/24 RIP 100 1 10.5.1.2 GE1/0/2
192.168.5.0/24 RIP 100 1 10.5.1.2 GE1/0/2
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
以上顯示信息表明Device E擁有路由域內所有網段路由,然後依次查看其他所有設備的路由表信息,路由域內所有的網段均可互通。
# 在Device C上創建基本ACL並匹配需要拒絕訪問的目的網段192.168.2.0/24。
<DeviceC> system-view
[DeviceC] acl number 2000
[DeviceC-acl-basic-2000] rule 0 deny source 192.168.2.0 0.0.0.255
[DeviceC-acl-basic-2000] rule permit source any
[DeviceC-acl-basic-2000] quit
# 在Device C上通過指定訪問控製列表ACL 2000來對要加入到路由表的路由信息進行過濾。
[DeviceC] ospf 1
[DeviceC-ospf-1] filter-policy 2000 import
[DeviceC-ospf-1] quit
# 在Device D上創建基本ACL並匹配需要拒絕訪問的目的網段192.168.5.0/24。
<DeviceD> system-view
[DeviceD] acl number 2000
[DeviceD-acl-basic-2000] rule 0 deny source 192.168.5.0 0.0.0.255
[DeviceD-acl-basic-2000] rule permit source any
[DeviceD-acl-basic-2000] quit
# 在Device D上通過指定訪問控製列表ACL 2000來對要加入到路由表的路由信息進行過濾。
[DeviceD] ospf
[DeviceD-ospf-1] filter-policy 2000 import
[DeviceD-ospf-1] quit
# 在Device E上創建基本ACL並匹配需要拒絕訪問的目的網段192.168.4.0/24。
<DeviceE> system-view
[DeviceE] acl number 2000
[DeviceE-acl-basic-2000] rule 0 deny source 192.168.4.0 0.0.0.255
[DeviceE-acl-basic-2000] rule permit source any
[DeviceE-acl-basic-2000] quit
# 在Device E上通過指定訪問控製列表ACL 2000來對引入OSPF的RIP路由信息進行過濾。
[DeviceE] ospf 1
[DeviceE-ospf-1] filter-policy 2000 export rip 1
[DeviceE-ospf-1] quit
# 查看Device C的路由表信息。
[DeviceC] display ip routing-table
Destinations : 22 Routes : 22
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
10.1.1.0/24 OSPF 10 2 10.2.1.1 GE1/0/1
10.2.1.0/24 Direct 0 0 10.2.1.2 GE1/0/1
10.2.1.0/32 Direct 0 0 10.2.1.2 GE1/0/1
10.2.1.2/32 Direct 0 0 127.0.0.1 InLoop0
10.2.1.255/32 Direct 0 0 10.2.1.2 GE1/0/1
10.3.1.0/24 OSPF 10 3 10.2.1.1 GE1/0/1
10.4.1.0/24 OSPF 10 2 10.2.1.1 GE1/0/1
10.5.1.0/24 OSPF 150 1 10.2.1.1 GE1/0/1
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.1/32 OSPF 10 3 10.2.1.1 GE1/0/1
192.168.3.0/24 Direct 0 0 192.168.3.1 Loop0
192.168.3.0/32 Direct 0 0 192.168.3.1 Loop0
192.168.3.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.3.255/32 Direct 0 0 192.168.3.1 Loop0
192.168.5.0/24 OSPF 150 1 10.2.1.1 GE1/0/1
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
以上顯示信息表明Device C的路由表中已經沒有192.168.2.0/24網段的路由信息了。
# 在Device C上使用源地址192.168.3.1Ping目標地址192.168.2.1進行驗證。
[DeviceC] ping -a 192.168.3.1 192.168.2.1
Ping 192.168.2.1 (192.168.2.1) from 192.168.3.1: 56 data bytes, press CTRL_C to
break
Request time out
Request time out
Request time out
Request time out
Request time out
--- Ping statistics for 192.168.2.1 ---
5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
以上信息表明Device C通過過濾路由表中192.168.2.0/24網段的路由信息,使得市場一部所在網段無法訪問研發一部所在網段。
# 查看Device D的路由表信息。
[DeviceD] display ip routing-table
Destinations : 25 Routes : 25
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
10.1.1.0/24 OSPF 10 2 10.3.1.1 GE1/0/1
10.2.1.0/24 OSPF 10 3 10.3.1.1 GE1/0/1
10.3.1.0/24 Direct 0 0 10.3.1.2 GE1/0/1
10.3.1.0/32 Direct 0 0 10.3.1.2 GE1/0/1
10.3.1.2/32 Direct 0 0 127.0.0.1 InLoop0
10.3.1.255/32 Direct 0 0 10.3.1.2 GE1/0/1
10.4.1.0/24 OSPF 10 3 10.3.1.1 GE1/0/1
10.5.1.0/24 OSPF 150 1 10.3.1.1 GE1/0/1
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.0/24 Direct 0 0 192.168.1.1 Loop0
192.168.1.0/32 Direct 0 0 192.168.1.1 Loop0
192.168.1.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.255/32 Direct 0 0 192.168.1.1 Loop0
192.168.2.0/24 Direct 0 0 192.168.2.1 Loop1
192.168.2.0/32 Direct 0 0 192.168.2.1 Loop1
192.168.2.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.2.255/32 Direct 0 0 192.168.2.1 Loop1
192.168.3.1/32 OSPF 10 3 10.3.1.1 GE1/0/1
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
以上顯示信息表明Device D的路由表中已經沒有192.168.5.0/24網段的路由信息了。
# 在Device D上使用源地址192.168.1.1Ping目標地址192.168.5.1進行驗證。
[DeviceD] ping -a 192.168.1.1 192.168.5.1
Ping 192.168.5.1 (192.168.5.1) from 192.168.1.1: 56 data bytes, press CTRL_C to
break
Request time out
Request time out
Request time out
Request time out
Request time out
--- Ping statistics for 192.168.5.1 ---
5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
# 在Device D上使用源地址192.168.2.1 Ping目標地址192.168.5.1進行驗證。
[DeviceD] ping -a 192.168.2.1 192.168.5.1
Ping 192.168.5.1 (192.168.5.1) from 192.168.2.1: 56 data bytes, press CTRL_C to
break
Request time out
Request time out
Request time out
Request time out
Request time out
--- Ping statistics for 192.168.5.1 ---
5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
以上信息表明Device D通過過濾路由表中192.168.5.0/24網段的路由信息,使得研發一部和售後服務部所在網段無法訪問市場二部所在網段。
綜合Device C和Device D的路由表信息,發現路由表中均沒有192.168.4.0/24網段路由信息,說明設備已經將引入OSPF的RIP路由中研發二部所在網段過濾掉。
· Device A:
#
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
area 0.0.0.1
network 10.4.1.0 0.0.0.255
area 0.0.0.2
network 10.2.1.0 0.0.0.255
#
interface GigabitEthernet1/0/1
port link-mode route
ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet1/0/2
port link-mode route
ip address 10.2.1.1 255.255.255.0
#
interface GigabitEthernet1/0/3
port link-mode route
ip address 10.4.1.1 255.255.255.0
#
· Device B :
#
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
area 0.0.0.3
network 10.3.1.0 0.0.0.255
#
interface GigabitEthernet1/0/1
port link-mode route
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet1/0/2
port link-mode route
ip address 10.3.1.1 255.255.255.0
#
· Device C :
#
ospf 1
filter-policy 2000 import
area 0.0.0.2
network 10.2.1.0 0.0.0.255
network 192.168.3.0 0.0.0.255
#
interface LoopBack0
ip address 192.168.3.1 255.255.255.0
#
interface GigabitEthernet1/0/1
port link-mode route
ip address 10.2.1.2 255.255.255.0
#
acl number 2000
rule 0 deny source 192.168.2.0 0.0.0.255
rule 5 permit
#
· Device D :
#
ospf 1
filter-policy 2000 import
area 0.0.0.3
network 10.3.1.0 0.0.0.255
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
#
interface LoopBack0
ip address 192.168.1.1 255.255.255.0
#
interface LoopBack1
ip address 192.168.2.1 255.255.255.0
#
interface GigabitEthernet1/0/1
port link-mode route
ip address 10.3.1.2 255.255.255.0
#
acl number 2000
rule 0 deny source 192.168.5.0 0.0.0.255
rule 5 permit
#
· Device E:
#
ospf 1
import-route direct
import-route rip 1
filter-policy 2000 export rip 1
area 0.0.0.1
network 10.4.1.0 0.0.0.255
#
rip 1
undo summary
version 2
network 10.5.1.0 0.0.0.255
import-route direct
import-route ospf 1
#
interface GigabitEthernet1/0/1
port link-mode route
ip address 10.4.1.2 255.255.255.0
#
interface GigabitEthernet1/0/2
port link-mode route
ip address 10.5.1.1 255.255.255.0
#
acl number 2000
rule 0 deny source 192.168.4.0 0.0.0.255
rule 5 permit
#
· Device F:
#
rip 1
undo summary
version 2
network 10.5.1.0 0.0.0.255
network 192.168.4.0
network 192.168.5.0
#
interface LoopBack0
ip address 192.168.4.1 255.255.255.0
#
interface LoopBack1
ip address 192.168.5.1 255.255.255.0
#
interface GigabitEthernet1/0/1
port link-mode route
ip address 10.5.1.2 255.255.255.0
#
· 《H3C MSR 係列路由器 配置指導(V7)》中的“三層技術-IP路由配置指導”
· 《H3C MSR 係列路由器 命令參考(V7)》中的“三層技術-IP路由命令參考”
不同款型規格的資料略有差異, 詳細信息請向具體銷售和400谘詢。H3C保留在沒有任何通知或提示的情況下對資料內容進行修改的權利!