华为路由器ospf的路由控制及安全

ospf的路由聚合
 

华为路由器ospf的路由控制及安全

文章插图
 
这个拓扑中AR1上3个loopback在area1中宣告,AR4上的2个loopback模拟lsa5(lsa7)重分布进ospf中,现在分别在ABR(AR2)和ASBR(AR4)上做内部路由聚合以及外部路由聚合,当area2区域被配置成NSSA时,那么在AR4上聚合的路由就是lsa7型,普通区域则聚合lsa5型 。
ospf内部路由聚合配置实例如下,AR1上配置
ospf 1 router-id 1.1.1.1
area 0.0.0.1
abr-summary 1.1.1.0 255.255.255.0 聚合路由将3条32位主机路由聚合成一条24位网路路由(由AR2)发布出去,聚合那个区域的路由就进入那个区域进行配置
network 1.1.1.1 0.0.0.0
network 1.1.1.2 0.0.0.0
network 1.1.1.3 0.0.0.0
network 12.1.1.1 0.0.0.0
#
聚合后在AR4上查看lsdb和路由
<AR4>display ospf lsdb
OSPF Process 1 with Router ID 4.4.4.4
Link State Database
Area: 0.0.0.2
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 4.4.4.4 4.4.4.4 1144 36 80000005 1
Router 3.3.3.3 3.3.3.3 1145 36 80000004 1
Network 34.1.1.4 4.4.4.4 1144 32 80000001 0
Sum-Net 12.1.1.0 3.3.3.3 1186 28 80000001 2
Sum-Net 23.1.1.0 3.3.3.3 1186 28 80000001 1
Sum-Net 1.1.1.0 3.3.3.3 665 28 80000001 2
AS External Database
Type LinkState ID AdvRouter Age Len Sequence Metric
External 4.4.4.4 4.4.4.4 1019 36 80000008 1
External 34.1.1.0 4.4.4.4 1019 36 80000008 1
<AR4>
<AR4>display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 3 Routes : 3
OSPF routing table status : <Active>
Destinations : 3 Routes : 3
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.0/24 OSPF 10 3 D 34.1.1.3 GigabitEthernet0/0/0
12.1.1.0/24 OSPF 10 3 D 34.1.1.3 GigabitEthernet0/0/0
23.1.1.0/24 OSPF 10 2 D 34.1.1.3 GigabitEthernet0/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
<AR4>
ospf外部路由聚合配置实例如下,AR4上配置
ospf 1 router-id 4.4.4.4
asbr-summary 4.4.4.0 255.255.255.0
聚合lsa5类外部路由,这里不在ospf任何区域内不用进入区域中配置
import-route direct
area 0.0.0.2
network 34.1.1.4 0.0.0.0
#
在AR1上查看聚合的外部路由
[Huawei]display ospf 1 lsdb
OSPF Process 1 with Router ID 1.1.1.1
Link State Database
Area: 0.0.0.1
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 2.2.2.2 2.2.2.2 1223 36 8000000D 1
Router 1.1.1.1 1.1.1.1 479 72 80000011 1
Network 12.1.1.1 1.1.1.1 1220 32 8000000B 0
Sum-Net 23.1.1.0 2.2.2.2 1217 28 8000000A 1
Sum-Net 34.1.1.0 2.2.2.2 1645 28 80000010 2
Sum-Asbr 4.4.4.4 2.2.2.2 158 28 80000001 2这条lsa3是告知r-id为4.4.4.4这个asbr怎么去的,从2.2.2.2这个abr走
AS External Database
Type LinkState ID AdvRouter Age Len Sequence Metric
External 4.4.4.0 4.4.4.4 160 36 80000001 2
External 34.1.1.0 4.4.4.4 160 36 80000001 1
[Huawei]
[Huawei]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 3 Routes : 3
OSPF routing table status : <Active>
Destinations : 3 Routes : 3
Destination/Mask Proto Pre Cost Flags NextHop Interface
4.4.4.0/24 O_ASE 150 2 D 12.1.1.2 GigabitEthernet0/0/0
23.1.1.0/24 OSPF 10 2 D 12.1.1.2 GigabitEthernet0/0/0
34.1.1.0/24 OSPF 10 3 D 12.1.1.2 GigabitEthernet0/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
[Huawei]
 
ospf的负均衡和路由选择
 
华为路由器ospf的路由控制及安全

文章插图
 
ospf的路由选择是通过路由的cost来决定的,cost越小越优先 。当目的路由的cost一样时,就会形成负载均衡 。在ospf中cost是以接口带宽计算的100M=10、1G=1
1、普通配置让路由形成负载均衡
AR1
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 12.1.1.1 0.0.0.0
network 13.1.1.1 0.0.0.0
#
AR2
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 12.1.1.2 0.0.0.0
network 100.1.1.1 0.0.0.0
#
AR3
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 13.1.1.3 0.0.0.0
network 100.1.1.1 0.0.0.0
#
 
在AR1上查看负载均衡路由
[AR1]display ip routing-table protocol ospf


推荐阅读