BSCI—7:OSPF的路由汇总

简介:
一、OSPF路由汇总优点:
OSPF路由汇总可以减少路由表条目,减少类型3和类型5LSA的洪泛,节约带宽资源和减轻路由器CPU负载,还能够对拓扑的变化本地化
 
 
二、 OSPF路由汇总的两种类型如下:  (两种方式均会演示)
1.inter-area(IA) route summarization:发生在ABR上 
2.external route summarization:发生在ASBR
 
 
三、实验1OSPF区域间汇总,发生在ABR上,接口信息及IP地址规划,区域信息如拓扑所示。
步骤一:配置3台路由器,并且用OSPF
 
R1
R1>
R1>en
R1#conf t
R1(config)#interface f0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#interface loopback 0
R1(config-if)#ip address 10.1.1.1 255.255.255.0
R1(config-if)#int lo1
R1(config-if)#ip address 10.1.2.1 255.255.255.0
R1(config-if)#int lo2
R1(config-if)#ip address 10.1.3.1 255.255.255.0
R1(config-if)#exit
R1(config)#router ospf 1     //启用OSPF路由协议
R1(config-router)#network 10.1.1.1 0.0.0.0 area 1    //发布网段
R1(config-router)#network 10.1.2.1 0.0.0.0 area 1
R1(config-router)#network 10.1.3.1 0.0.0.0 area 1
R1(config-router)#network 192.168.1.1 0.0.0.0 area 1
R1(config-router)#end
R1#
 
 
R2
R2>en
R2#conf t
R2(config)#interface f0/0
R2(config-if)#ip address 192.168.1.2 255.255.255.0
R2(config-if)#no sh
R2(config-router)#exit
R2(config)#interface f0/1
R2(config-if)#ip address 192.168.2.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#router ospf 1     //启用OSPF路由协议
R2(config-router)#network 192.168.1.2 0.0.0.0 area 1     //同上
R2(config-router)#network 192.168.2.2 0.0.0.0 area 0 
R2(config-router)#end
R2#
 
 
R3
R3>
R3>en
R3#conf t
R3(config)#interface f0/1
R3(config-if)#ip add
R3(config-if)#ip address 192.168.2.1 255.255.255.0
R3(config-if)#no sh
R3(config-if)#exit
R3(config)#router ospf 1     //同上
R3(config-router)#network 192.168.2.1 0.0.0.0 area 0
R3(config-router)#end
R3#
 
查看R3路由表:  //已经学习到R1三条明细路由
R3#sh ip route 
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route
Gateway of last resort is not set
     10.0.0.0/32 is subnetted, 3 subnets
O IA    10.1.1.1 [110/3] via 192.168.2.2, 00:01:18, FastEthernet0/1
O IA    10.1.2.1 [110/3] via 192.168.2.2, 00:01:18, FastEthernet0/1
O IA    10.1.3.1 [110/3] via 192.168.2.2, 00:01:18, FastEthernet0/1
O IA 192.168.1.0/24 [110/2] via 192.168.2.2, 00:01:18, FastEthernet0/1
C    192.168.2.0/24 is directly connected, FastEthernet0/1
R3#
 
 
 
步骤二:在R2ABR)上执行汇总,再次查看R3上路由表
 
R2(config)#router ospf 1
R2(config-router)#area 1 range 10.1.0.0 255.255.252.0
//3条明细路由汇总为掩码为/22的汇总路由.
R2(config-router)#end
R2#
 
查看R3路由表:
R3#sh ip route 
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route
Gateway of last resort is not set
     10.0.0.0/22 is subnetted, 1 subnets
O IA    10.1.0.0 [110/65] via 192.168.2.2, 00:00:16, FastEthernet0/1
//变为掩码为22的汇总路由
C    192.168.2.0/24 is directly connected, FastEthernet0/1
R3#
 
 
实验2OSPF域间汇总,发生在(ASBR)上,拓扑如下,R1运行了OSPFRIP两种路由协议,所以它为ASBRIP地址与区域已规划好.
步骤一:在2台路由器上配置OSPFRIP,并发布网段.
R1:
Router>
Router>en
Router#conf t
Router(config)#hostname R1
R1(config)#interface f0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no sh
R1(config)#interface loopback 0
R1(config-if)#ip address 10.1.1.1 255.255.255.0
R1(config-if)#int lo1
R1(config-if)#ip address 10.1.2.1 255.255.255.0
R1(config-if)#int lo2
R1(config-if)#ip address 10.1.3.1 255.255.255.0
R1(config-if)#exit
R1(config)#router ospf 1      //启用OSPF路由协议
R1(config-router)#network 192.168.1.1 0.0.0.0 area 0
R1(config-router)#exit
R1(config)#router rip     //启用RIP路由协议
R1(config-router)#version 2     //指定版本2
R1(config-router)#no auto-summary     //不要自动汇总
R1(config-router)#network 10.1.1.0     //发布网段
R1(config-router)#network 10.1.2.0
R1(config-router)#network 10.1.3.0
R1(config-router)#exit
R1(config)#end
R1#
 

R2:
Router>
Router>en
Router#conf t
Router(config)#hostname R2
R2(config)#interface f0/0
R2(config-if)#ip address 192.168.1.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#router ospf 1      //同上
R2(config-router)#network 192.168.1.2 0.0.0.0 area 0
R2(config-router)#end
R2#
 
 
 
步骤二:在R1上把RIP与OSPF互相重发布,并查看R2路由表.

R1(config)#router rip
R1(config-router)#redistribute ospf 1 metric 1    //把OSPF发布进RIP,度量值为1
R1(config-router)#exit
R1(config)#router ospf 1
R1(config-router)#redistribute rip subnets       //把RIP路由发布进OSPF
R1(config-router)#end
R1#

查看R2路由表:    //此时已经学习重发布进OSPF的外部路由表条目
R2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/24 is subnetted, 3 subnets
O E2    10.1.3.0 [110/20] via 192.168.1.1, 00:00:40, FastEthernet0/0
O E2    10.1.2.0 [110/20] via 192.168.1.1, 00:00:40, FastEthernet0/0
O E2    10.1.1.0 [110/20] via 192.168.1.1, 00:00:40, FastEthernet0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
R2#
注:E2表示OSPF的外部路由类型2.
 

步骤三:在R1(ASBR)上做域间汇总,使得3条明细汇总为一条.并查看R2路由表.
R1(config)#router ospf 1
R1(config-router)#summary-address 10.1.0.0 255.255.252.0
//把之前3条明细路由汇总成掩码为22的汇总路由
R1(config-router)#end
R1#

查看R2路由表:
R2#show ip route       //此时已经变为掩码为22的汇总路由.
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/22 is subnetted, 1 subnets
O E2    10.1.0.0 [110/20] via 192.168.1.1, 00:00:44, FastEthernet0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
R2#

实验完成.









本文转自 meiyanaa 51CTO博客,原文链接:http://blog.51cto.com/justim/270551,如需转载请自行联系原作者
目录
相关文章
|
网络协议 算法 数据库
|
网络协议 数据库 网络架构
OSPF路由协议-高级配置——OSPF路由高级应用
一OSPF重分发路由 1.重分发到OSPF域中路由的路径类型 类型1的外部路径(Type 1 external path, E1) 类型2的外部路径(Type 2 external path, E2) 2.路由器A有两条到达外部目的网络10.1.2.0的路径 E1类型 1.路径A-B-D的代价是25(20+5) (优先) 2.路径A-C-D代价为48(18+30) E2类型 1.路径A-B-D的代价是20 2.路径A-C-D的代价为18 (优先)
179 0
OSPF路由协议-高级配置——OSPF路由高级应用
|
存储 网络协议 数据库
OSPF深度好文:OSPF 路由汇总
路由汇总是指设备将学习到的部分路由网段按照一定的规则聚合成单个路由的操作,一般来说,路由汇总可以大大减少设备路由表项和转发表项。一方面可以减轻设备的负担,另一方面也可以让设备保存更多不同地址的路由。
162 0
OSPF深度好文:OSPF 路由汇总
|
网络协议 网络架构
OSPF路由协议基础(OSPF基本配置)
OSPF路由协议基础(OSPF基本配置)
540 0
OSPF路由协议基础(OSPF基本配置)
|
网络协议 网络架构
|
网络协议 网络架构 数据库
|
网络架构 网络协议 Shell