实验56:多区域OSPF 手工汇总
1.实验目的
通过本实验可以掌握:
1)路由汇总的目的
2)区域间路由汇总
3)外部自治系统路由汇总
2.实验拓扑
本实验的拓扑结构如图所示。
NA-NP-IE系列实验56:多区域OSPF 手工汇总_多区域OSPF
3.实验步骤
(1)路由器R0R1 R2 之间运行OSPF,路由器R2 R3之间运行RIPv2,路由器R0 上的四
个环回接口是为在路由器R1 上做区域间路由汇总准备的,路由器R3 上的四个环回接口是为在路由器R2 上做外部路由汇总准备的。由于路由器R2 是边界路由器,所以要完成双向重分布。
2)区域间路由汇总必须在ABR 上完成;
3)外部路由汇总必须在ASBR 上完成。
 
r0(config)#int loo 1
r0(config-if)#ip add 1.1.1.1 255.255.255.0
r0(config-if)#int loo 2
r0(config-if)#ip add 1.1.2.1 255.255.255.0
r0(config-if)#int loo 3
r0(config-if)#ip add 1.1.3.1 255.255.255.0
r0(config-if)#int loo 4
*Mar  1 00:01:55.883: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback4, changed state to up
r0(config-if)#ip add 1.1.4.1 255.255.255.0
r0(config-if)#int s0/0
r0(config-if)#ip add 172.16.1.1 255.255.255.0
r0(config-if)#no sh   
r0(config-if)#exit
r0(config)#router ospf 1
r0(config-router)#net 1.1.0.1 255.255.252.0 area 1
r0(config-router)#net 1.1.4.0 255.255.255.0 area 1
r0(config-router)#net 172.16.1.0 255.255.255.0 area 1
r0(config-router)#do ping 172.16.3.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.3.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 84/103/128 ms
r0(config-router)#do ping 4.4.4.4
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 88/114/168 ms
r0(config-router)#
 
 
 
 
r1(config)#int loo 1
*Mar  1 00:03:59.151: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
r1(config-if)#ip add 2.2.2.2 255.255.255.0
r1(config-if)#int s0/0
r1(config-if)#ip add 172.16.1.2 255.255.255.0
r1(config-if)#no sh
r1(config-if)#exit
r1(config)#int s0/1
r1(config-if)#ip add 172.16.2.1 255.255.255.0
r1(config-if)#no sh
r1(config-if)#exit
r1(config)#router ospf 1
r1(config-router)#net 172.16.2.0 255.255.255.0 area 0
r1(config-router)#net 172.16.1.0 255.255.255.0 area 1
r1(config-router)#net 2.2.2.0 255.255.255.0 area 0
r1(config-router)#area 1 range 1.1.0.0 255.255.252.0  //配置区域间路由汇总
 
r1(config-router)#do sh ip route ospf
     1.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O       1.1.1.1/32 [110/65] via 172.16.1.1, 00:05:54, Serial0/0
O       1.1.0.0/22 is a summary, 00:05:54, Null0 R1 R0 的四条环回接口的路由汇总后,会产生一条指向Null0 的路由;
 
O       1.1.3.1/32 [110/65] via 172.16.1.1, 00:05:54, Serial0/0
O       1.1.2.1/32 [110/65] via 172.16.1.1, 00:05:54, Serial0/0
O       1.1.4.1/32 [110/65] via 172.16.1.1, 00:05:54, Serial0/0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/65] via 172.16.2.2, 00:01:59, Serial0/1
     172.16.0.0/24 is subnetted, 3 subnets
O E2    172.16.3.0 [110/20] via 172.16.2.2, 00:01:36, Serial0/1收到经路由器R2 汇总的路由,因为是重分布进来的外部路由,所以路由代码为“O E2
 
r2(config)#int loo 1
*Mar  1 00:04:58.871: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
r2(config-if)#ip add 3.3.3.3 255.255.255.0
r2(config-if)#int s0/0
r2(config-if)#ip add 172.16.2.2 255.255.255.0
r2(config-if)#no sh
r2(config-if)#exit
*Mar  1 00:05:26.159: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
r2(config)#int s0/1
r2(config-if)#i
*Mar  1 00:05:27.163: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
r2(config-if)#ip add 172.16.3.1 255.255.255.0
r2(config-if)#no sh
r2(config-if)#exit
*Mar  1 00:05:43.523: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to up
*Mar  1 00:06:44.707: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to up
r2(config)#router ospf 1
r2(config-router)#net 172.16.2.0 255.255.255.0 area 0
*Mar  1 02:05:03.459: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on Serial0/0 from LOADING to FULL, Loading Done
r2(config-router)#net 3.3.3.0 255.255.255.0 area 0
r2(config-router)#summary-address 4.4.0.0 255.255.252.0//配置外部自治系统路由汇总
r2(config-router)#redistribute rip subnets//RIP 路由重分布到OSPF
r2(config-router)#exit
r2(config)#router rip
r2(config-router)#v 2
r2(config-router)#no auto-summary
r2(config-router)#net 172.16.3.0 
r2(config-router)#redistribute ospf 1 metric 2//OSPF 路由重分布到RIP
 
r2(config-router)#do sh ip route ospf
     1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
 
O IA    1.1.0.0/22 [110/129] via 172.16.2.1, 00:03:32, Serial0/0
O IA    1.1.4.1/32 [110/129] via 172.16.2.1, 00:03:32, Serial0/0
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/65] via 172.16.2.1, 00:03:32, Serial0/0
     4.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O       4.4.0.0/22 is a summary, 00:01:29, Null0 R3 对四条环回接口的RIP 路由汇总后,会产生一条指向Null0 的路由;
     172.16.0.0/24 is subnetted, 3 subnets
O IA    172.16.1.0 [110/128] via 172.16.2.1, 00:03:32, Serial0/0收到经路由器R1 汇总的路由,由于是区域间路由汇总,所以路由代码为“O IA”。
r2(config-router)#
 
r3(config)#int s0/0
r3(config-if)#ip add 172.16.3.2 255.255.255.0
r3(config-if)#no sh
r3(config-if)#int loo 1
r3(config-if)#ip add 4.4.1.4 255.255.255.0
r3(config-if)#int loo 2
r3(config-if)#ip add 4.4.2.4 255.255.255.0
r3(config-if)#int loo 3
r3(config-if)#ip add 4.4.3.4 255.255.255.0
r3(config-if)#int loo 4
r3(config-if)#ip add 4.4.4.4 255.255.255.0
r3(config-if)#exit
r3(config)#router rip
r3(config-router)#v 2
r3(config-router)#no auto
r3(config-router)#net 4.0.0.0
r3(config-router)#net 172.16.3.0
r3(config-router)#