OSPF路由汇总优点:
1、节约链路带宽资源。
2、节约硬件资源(CPU和内存资源)。
3、隐藏网络的不稳定性。
类型:
1、区域间汇总(在ABR上执行,将一个区域里的明细路由汇总到别的区域)
2、域间汇总(在ASBR上执行)
第一步:组网:
R1的配置:
R1(config)#interfacefastEthernet0/0
R1(config-if)#ipaddress192.168.1.1255.255.255.0
R1(config-if)#noshutdown
R1(config-if)#exit
R1(config)#interfaceloopback1
R1(config-if)#ipaddress192.168.10.1255.255.255.0
R1(config-if)#noshutdown
R1(config-if)#exit
R1(config)#routerospf1
R1(config-router)#network192.168.1.00.0.0.255area0
R2的配置:
R2(config)#interfacef0/0
R2(config-if)#ipaddress192.168.1.2255.255.255.0
R2(config-if)#noshutdown
R2(config-if)#exit
R2(config)#interfaceloopback1
R2(config-if)#ipaddress172.16.0.1255.255.255.0
R2(config-if)#intloop2
R2(config-if)#ipaddress172.16.1.1255.255.255.0
R2(config-if)#intloop3
R2(config-if)#ipaddress172.16.2.1255.255.255.0
R2(config-if)#intloop4
R2(config-if)#ipaddress172.16.3.1255.255.255.0
R2(config-if)#exi
R2(config)#router ospf 1
R2(config-router)#network 192.168.1.0 0.0.0.255 area 0
R2(config-router)#network 172.16.0.0 0.0.0.255 area 1
R2(config-router)#network 172.16.1.0 0.0.0.255 area 1
R2(config-router)#network 172.16.2.0 0.0.0.255 area 1
R2(config-router)#network 172.16.3.0 0.0.0.255 area 1
配置完成后查看R1的路由表:
R1#show ip route
Codes: C - connected, S - static, 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
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
C 192.168.10.0/24 is directly connected, Loopback1
172.16.0.0/32 is subnetted, 4 subnets
O IA 172.16.1.1 [110/2] via 192.168.1.2, 00:02:01, FastEthernet0/0
O IA 172.16.0.1 [110/2] via 192.168.1.2, 00:01:36, FastEthernet0/0
O IA 172.16.3.1 [110/2] via 192.168.1.2, 00:01:36, FastEthernet0/0
O IA 172.16.2.1 [110/2] via 192.168.1.2, 00:01:46, FastEthernet0/0(已经学习到其他区域的路由)
C 192.168.1.0/24 is directly connected, FastEthernet0/0
因为R2在区域0和区域1之间,所以R2是ABR,在R2上做区域间汇总:
R2(config)#router ospf 1
R2(config-router)#area 1 range 172.16.0.0 255.255.252.0
配置完成后查看R1的路由表:
R1#show ip route
Codes: C - connected, S - static, 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
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
C 192.168.10.0/24 is directly connected, Loopback1
172.16.0.0/22 is subnetted, 1 subnets
O IA 172.16.0.0 [110/2] via 192.168.1.2, 00:00:47, FastEthernet0/0
(汇总成一条22位的路由)
C 192.168.1.0/24 is directly connected, FastEthernet0/0
第一步:组网:
R1的配置:
R1(config)#interfacefastEthernet0/0
R1(config-if)#ipaddress192.168.1.1255.255.255.0
R1(config-if)#noshutdown
R1(config-if)#interfaceloopback1
R1(config-if)#ipaddress192.168.10.1255.255.255.0
R1(config-if)#noshutdown
R1(config-if)#exit
R1(config)#routerospf1
R1(config-router)#network192.168.1.00.0.0.255area0
R2的配置:
R2(config)#interfacef0/0
R2(config-if)#ipaddress192.168.1.2255.255.255.0
R2(config-if)#noshutdown
R2(config-if)#interfaceloopback1
R2(config-if)#ipaddress172.16.0.1255.255.255.0
R2(config-if)#intloop2
R2(config-if)#ipaddress172.16.1.1255.255.255.0
R2(config-if)#intloop3
R2(config-if)#ipaddress172.16.2.1255.255.255.0
R2(config-if)#intloop4
R2(config-if)#ipaddress172.16.3.1255.255.255.0
R2(config-if)#exi
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#network 172.16.0.0
R2(config-router)#network 172.16.1.0
R2(config-router)#network 172.16.2.0
R2(config-router)#network 172.16.3.0
R2(config-router)#no auto-summary
R2(config-router)#default-information originate
R2(config-router)#exit
R2(config)#router ospf 1
R2(config-router)#network 192.168.1.0 0.0.0.255 area 0
R2(config-router)#redistribute rip subnets
完成后查看R1的路由表:
R1#show ip route
Codes: C - connected, S - static, 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
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
C 192.168.10.0/24 is directly connected, Loopback1
172.16.0.0/24 is subnetted, 4 subnets
O E2 172.16.0.0 [110/20] via 192.168.1.2, 00:00:18, FastEthernet0/0
O E2 172.16.1.0 [110/20] via 192.168.1.2, 00:00:18, FastEthernet0/0
O E2 172.16.2.0 [110/20] via 192.168.1.2, 00:00:18, FastEthernet0/0
O E2 172.16.3.0 [110/20] via 192.168.1.2, 00:00:18, FastEthernet0/0(学到了rip分发而来的路由)
C 192.168.1.0/24 is directly connected, FastEthernet0/0
因为R2是ospf和rip之间的路由器,所以R2是ASBR,在R2上做域间汇总:
R2(config)#router ospf 1
R2(config-router)#summary-address 172.16.0.0 255.255.252.0
完成后查看R1的路由表:
R1#show ip route
Codes: C - connected, S - static, 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
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
C 192.168.10.0/24 is directly connected, Loopback1
172.16.0.0/22 is subnetted, 1 subnets
O E2 172.16.0.0 [110/20] via 192.168.1.2, 00:00:05, FastEthernet0/0(汇总成一条22位的路由)
C 192.168.1.0/24 is directly connected, FastEthernet0/0