您的位置:首页 > 其它

OSPF(ABR和ASBR)的路由汇总

2010-02-24 20:48 901 查看
一、OSPF路由汇总优点:
OSPF路由汇总可以减少路由表条目,减少类型3和类型5的LSA的洪泛,节约带宽资源和减轻路由器CPU负载,还能够对拓扑的变化本地化。


二、OSPF路由汇总的两种类型如下: (两种方式均会演示)
1.inter-area(IA) route summarization:发生在ABR上
2.external route summarization:发生在ASBR上

三、实验1:OSPF区域间汇总,发生在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#

步骤二:在R2(ABR)上执行汇总,再次查看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#

实验2:OSPF区域间汇总,发生在(ASBR)上,拓扑如下,R1运行了OSPF与RIP两种路由协议,所以它为ASBR,IP地址与区域已规划好.



步骤一:在2台路由器上配置OSPF与RIP,并发布网段.
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#
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  OSPF 路由 休闲