R1配置:
interface Loopback1
ip address 1.1.1.1 255.255.255.0
!
interface Loopback2
ip address 1.1.2.1 255.255.255.0
!
interface Loopback3
ip address 1.1.3.1 255.255.255.0
!
interface Serial1/1
ip address 10.0.1.1 255.255.255.0
serial restart-delay 0
!
router ospf 1
log-adjacency-changes
network 1.1.1.0 0.0.0.255 area 1
network 1.1.2.0 0.0.0.255 area 1
network 1.1.3.0 0.0.0.255 area 1
network 10.0.1.0 0.0.0.255 area 1
!
R2配置:
interface Serial1/0
ip address 10.0.1.2 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
ip address 10.0.2.1 255.255.255.0
serial restart-delay 0
!
router ospf 1
log-adjacency-changes
network 10.0.1.0 0.0.0.255 area 1
network 10.0.2.0 0.0.0.255 area 0
!
R3配置:
interface Serial1/0
ip address 10.0.2.2 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
ip address 10.0.3.1 255.255.255.0
serial restart-delay 0
!
router ospf 1
log-adjacency-changes
network 10.0.2.0 0.0.0.255 area 0
network 10.0.3.0 0.0.0.255 area 2
!
R4配置:
interface Loopback1
ip address 4.4.1.4 255.255.255.0
!
interface Loopback2
ip address 4.4.2.4 255.255.255.0
!
interface Loopback3
ip address 4.4.3.4 255.255.255.0
!
interface Serial1/0
ip address 10.0.3.2 255.255.255.0
serial restart-delay 0
!
router ospf 1
log-adjacency-changes
network 4.4.1.0 0.0.0.255 area 2
network 4.4.2.0 0.0.0.255 area 2
network 4.4.3.0 0.0.0.255 area 2
network 10.0.3.0 0.0.0.255 area 2
!
上述命令末配置OSPF区域间汇总查看各个路由器路由表如下:
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
1.0.0.0/24 is subnetted, 3 subnets
C 1.1.1.0 is directly connected, Loopback1
C 1.1.2.0 is directly connected, Loopback2
C 1.1.3.0 is directly connected, Loopback3
4.0.0.0/32 is subnetted, 3 subnets
O IA 4.4.1.4 [110/193] via 10.0.1.2, 00:07:19, Serial1/1
O IA 4.4.2.4 [110/193] via 10.0.1.2, 00:07:19, Serial1/1
O IA 4.4.3.4 [110/193] via 10.0.1.2, 00:07:19, Serial1/1
10.0.0.0/24 is subnetted, 3 subnets
O IA 10.0.2.0 [110/128] via 10.0.1.2, 00:44:09, Serial1/1
O IA 10.0.3.0 [110/192] via 10.0.1.2, 00:07:19, Serial1/1
C 10.0.1.0 is directly connected, Serial1/
R2# 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
1.0.0.0/32 is subnetted, 3 subnets
O 1.1.1.1 [110/65] via 10.0.1.1, 00:44:42, Serial1/0
O 1.1.3.1 [110/65] via 10.0.1.1, 00:44:42, Serial1/0
O 1.1.2.1 [110/65] via 10.0.1.1, 00:44:42, Serial1/0
4.0.0.0/32 is subnetted, 3 subnets
O IA 4.4.1.4 [110/129] via 10.0.2.2, 00:07:52, Serial1/1
O IA 4.4.2.4 [110/129] via 10.0.2.2, 00:07:52, Serial1/1
O IA 4.4.3.4 [110/129] via 10.0.2.2, 00:07:52, Serial1/1
10.0.0.0/24 is subnetted, 3 subnets
C 10.0.2.0 is directly connected, Serial1/1
O IA 10.0.3.0 [110/128] via 10.0.2.2, 00:07:52, Serial1/1
C 10.0.1.0 is directly connected, Serial1/0
R3#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
1.0.0.0/32 is subnetted, 3 subnets
O IA 1.1.1.1 [110/129] via 10.0.2.1, 00:08:09, Serial1/0
O IA 1.1.3.1 [110/129] via 10.0.2.1, 00:08:09, Serial1/0
O IA 1.1.2.1 [110/129] via 10.0.2.1, 00:08:09, Serial1/0
4.0.0.0/32 is subnetted, 3 subnets
O 4.4.1.4 [110/65] via 10.0.3.2, 00:08:19, Serial1/1
O 4.4.2.4 [110/65] via 10.0.3.2, 00:08:19, Serial1/1
O 4.4.3.4 [110/65] via 10.0.3.2, 00:08:19, Serial1/1
10.0.0.0/24 is subnetted, 3 subnets
C 10.0.2.0 is directly connected, Serial1/0
C 10.0.3.0 is directly connected, Serial1/1
O IA 10.0.1.0 [110/128] via 10.0.2.1, 00:08:09, Serial1/0
R4#show ip route
*Oct 10 17:49:31.863: %SYS-5-CONFIG_I: Configured from console by consoleroute
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
1.0.0.0/32 is subnetted, 3 subnets
O IA 1.1.1.1 [110/193] via 10.0.3.1, 00:09:25, Serial1/0
O IA 1.1.3.1 [110/193] via 10.0.3.1, 00:09:25, Serial1/0
O IA 1.1.2.1 [110/193] via 10.0.3.1, 00:09:25, Serial1/0
4.0.0.0/24 is subnetted, 3 subnets
C 4.4.1.0 is directly connected, Loopback1
C 4.4.2.0 is directly connected, Loopback2
C 4.4.3.0 is directly connected, Loopback3
10.0.0.0/24 is subnetted, 3 subnets
O IA 10.0.2.0 [110/128] via 10.0.3.1, 00:09:35, Serial1/0
C 10.0.3.0 is directly connected, Serial1/0
O IA 10.0.1.0 [110/192] via 10.0.3.1, 00:09:25, Serial1/0
在R2(ABR)和R3(ABR)上分别对区域1和区域2中的网络进行汇总,将区域1 1.1.1.0-1.1.3.0汇总成1.1.0.0/22,将区域2 4.4.1.0-4.4.3.0汇总成4.4.0.0/22配置如下:
R2(config)#router ospf 1
R2(config-router)#area 1 range 1.1.0.0 255.255.252.0
R3(config)#router ospf 1
R3(config-router)#area 2 range 4.4.0.0 255.255.252.0
汇总配置完成后的路由表:
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
1.0.0.0/24 is subnetted, 3 subnets
C 1.1.1.0 is directly connected, Loopback1
C 1.1.2.0 is directly connected, Loopback2
C 1.1.3.0 is directly connected, Loopback3
4.0.0.0/22 is subnetted, 1 subnets
O IA 4.4.0.0 [110/193] via 10.0.1.2, 00:04:23, Serial1/1 //汇总后的路由
10.0.0.0/24 is subnetted, 3 subnets
O IA 10.0.2.0 [110/128] via 10.0.1.2, 01:04:01, Serial1/1
O IA 10.0.3.0 [110/192] via 10.0.1.2, 00:27:11, Serial1/1
C 10.0.1.0 is directly connected, Serial
R2(config-router)#do 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
1.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
O 1.1.1.1/32 [110/65] via 10.0.1.1, 00:05:28, Serial1/0
O 1.1.0.0/22 is a summary, 00:05:28, Null0
O 1.1.3.1/32 [110/65] via 10.0.1.1, 00:05:28, Serial1/0
O 1.1.2.1/32 [110/65] via 10.0.1.1, 00:05:28, Serial1/0
4.0.0.0/22 is subnetted, 1 subnets
O IA 4.4.0.0 [110/129] via 10.0.2.2, 00:04:54, Serial1/1 //汇总后的路由
10.0.0.0/24 is subnetted, 3 subnets
C 10.0.2.0 is directly connected, Serial1/1
O IA 10.0.3.0 [110/128] via 10.0.2.2, 00:05:28, Serial1/1
C 10.0.1.0 is directly connected, Serial1/0
R3(config-router)#do 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
1.0.0.0/22 is subnetted, 1 subnets
O IA 1.1.0.0 [110/129] via 10.0.2.1, 00:05:27, Serial1/0 //汇总后的路由
4.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
O 4.4.0.0/22 is a summary, 00:05:27, Null0
O 4.4.1.4/32 [110/65] via 10.0.3.2, 00:05:27, Serial1/1
O 4.4.2.4/32 [110/65] via 10.0.3.2, 00:05:27, Serial1/1
O 4.4.3.4/32 [110/65] via 10.0.3.2, 00:05:27, Serial1/1
10.0.0.0/24 is subnetted, 3 subnets
C 10.0.2.0 is directly connected, Serial1/0
C 10.0.3.0 is directly connected, Serial1/1
O IA 10.0.1.0 [110/128] via 10.0.2.1, 00:05:27, Serial1/0
R4#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
1.0.0.0/22 is subnetted, 1 subnets
O IA 1.1.0.0 [110/193] via 10.0.3.1, 00:06:27, Serial1/0 //汇总后的路由
4.0.0.0/24 is subnetted, 3 subnets
C 4.4.1.0 is directly connected, Loopback1
C 4.4.2.0 is directly connected, Loopback2
C 4.4.3.0 is directly connected, Loopback3
10.0.0.0/24 is subnetted, 3 subnets
O IA 10.0.2.0 [110/128] via 10.0.3.1, 00:28:42, Serial1/0
C 10.0.3.0 is directly connected, Serial1/0
O IA 10.0.1.0 [110/192] via 10.0.3.1, 00:28:32, Serial1/0
转载于:https://blog.51cto.com/renzhongming/684914