routerA:
interface Serial0/0
ip address 192.1.1.1 255.255.255.252
serial restart-delay 0
!
router ospf 10
log-adjacency-changes
network 192.1.1.0 0.0.0.3 area 1
routerB:
interface Loopback0
ip address 193.1.1.129 255.255.255.192
ip ospf network point-to-point
!
interface Serial0/0
ip address 192.1.1.2 255.255.255.252
serial restart-delay 0
!
interface Serial0/1
ip address 193.1.1.1 255.255.255.252
serial restart-delay 0
!
router ospf 10
log-adjacency-changes
network 192.1.1.0 0.0.0.3 area 1
network 193.1.1.0 0.0.0.3 area 0
network 193.1.1.128 0.0.0.63 area 0
routerC:
interface Loopback0
ip address 193.1.1.193 255.255.255.192
ip ospf network point-to-point
!
interface Serial0/1
ip address 193.1.1.2 255.255.255.252
serial restart-delay 0
!
interface Serial0/2
ip address 194.1.1.1 255.255.255.252
serial restart-delay 0
!
router ospf 10
log-adjacency-changes
network 193.1.1.0 0.0.0.3 area 0
network 193.1.1.192 0.0.0.63 area 0
network 194.1.1.0 0.0.0.3 area 2
routerD:
interface Serial0/2
ip address 194.1.1.2 255.255.255.252
serial restart-delay 0
!
interface Serial0/3
ip address 172.1.3.1 255.255.255.0
serial restart-delay 0
!
router ospf 10
log-adjacency-changes
redistribute rip subnets
network 194.1.1.0 0.0.0.3 area 2
!
router rip
network 172.1.0.0
!
routerE:
interface Loopback0
ip address 172.1.1.1 255.255.255.0
!
interface Loopback1
ip address 172.1.2.1 255.255.255.0
!
interface Loopback2
ip address 172.1.4.1 255.255.255.0
!
interface Serial0/3
ip address 172.1.3.2 255.255.255.0
serial restart-delay 0
!
router rip
network 172.1.0.0
现在看一下routerA的路由表:
routerA# sh ip route
Gateway of last resort is not set
172.1.0.0/24 is subnetted, 4 subnets
O E2 172.1.4.0 [110/20] via 192.1.1.2, 00:17:44, Serial0/0
O E2 172.1.1.0 [110/20] via 192.1.1.2, 00:17:45, Serial0/0
O E2 172.1.3.0 [110/20] via 192.1.1.2, 00:18:27, Serial0/0
O E2 172.1.2.0 [110/20] via 192.1.1.2, 00:17:45, Serial0/0
193.1.1.0/24 is variably subnetted, 3 subnets, 2 masks
O IA 193.1.1.192/26 [110/129] via 192.1.1.2, 00:23:46, Serial0/0
O IA 193.1.1.128/26 [110/65] via 192.1.1.2, 00:23:56, Serial0/0
O IA 193.1.1.0/30 [110/128] via 192.1.1.2, 00:27:03, Serial0/0
192.1.1.0/30 is subnetted, 1 subnets
C 192.1.1.0 is directly connected, Serial0/0
194.1.1.0/30 is subnetted, 1 subnets
O IA 194.1.1.0 [110/192] via 192.1.1.2, 00:26:08, Serial0/0
可以看到学到多条类型3 的LSA和外部的路由,可以把他们进行域间汇总和域外汇总,域间汇总在ABR上,域外汇总在ASBR上
routerB(config)#router ospf 10
routerB(config-router)#area 0 range 193.1.1.0 255.255.255.0
routerC(config)#router ospf 10
routerC(config-router)#area 0 range 193.1.1.0 255.255.255.0
routerD(config)#router ospf 10
routerD(config-router)#no summary-address 172.1.0.0 255.255.248.0
看一下现在routerA的路由表,已经进行了汇总:
routerA#sh ip route
Gateway of last resort is not set
172.1.0.0/21 is subnetted, 1 subnets
O E2 172.1.0.0 [110/20] via 192.1.1.2, 00:02:01, Serial0/0
O IA 193.1.1.0/24 [110/65] via 192.1.1.2, 00:04:21, Serial0/0
192.1.1.0/30 is subnetted, 1 subnets
C 192.1.1.0 is directly connected, Serial0/0
194.1.1.0/30 is subnetted, 1 subnets
O IA 194.1.1.0 [110/192] via 192.1.1.2, 00:34:09, Serial0/0
实验配置stub和nssa区域
routerA(config)#router ospf 10
routerA(config-router)#area 1 stub
routerB(config)#router ospf 10
routerB(config-router)#area 1 stub
routerC(config)#router ospf 10
routerC(config-router)#area 2 nssa
routerD(config)#router ospf 10
routerD(config-router)#area 2 nssa
处于stub区域的routerA已经学不到外部路由,还能学到域间路由,还受到域间路由的影响。
routerA#SH IP ROUte
O IA 193.1.1.0/24 [110/65] via 192.1.1.2, 00:02:14, Serial0/0
192.1.1.0/30 is subnetted, 1 subnets
C 192.1.1.0 is directly connected, Serial0/0
194.1.1.0/30 is subnetted, 1 subnets
O IA 194.1.1.0 [110/192] via 192.1.1.2, 00:02:14, Serial0/0
O*IA 0.0.0.0/0 [110/65] via 192.1.1.2, 00:02:14, Serial0/0
routerD#sh ip route
Gateway of last resort is not set
172.1.0.0/16 is variably subnetted, 5 subnets, 2 masks
R 172.1.4.0/24 [120/1] via 172.1.3.2, 00:00:15, Serial0/3
R 172.1.1.0/24 [120/1] via 172.1.3.2, 00:00:15, Serial0/3
O 172.1.0.0/21 is a summary, 00:14:47, Null0
C 172.1.3.0/24 is directly connected, Serial0/3
R 172.1.2.0/24 [120/1] via 172.1.3.2, 00:00:15, Serial0/3
O IA 193.1.1.0/24 [110/65] via 194.1.1.1, 00:00:03, Serial0/2
192.1.1.0/30 is subnetted, 1 subnets
O IA 192.1.1.0 [110/192] via 194.1.1.1, 00:00:03, Serial0/2
194.1.1.0/30 is subnetted, 1 subnets
C 194.1.1.0 is directly connected, Serial0/2
下面配置成完全stub,完全nssa再看一下路由表,两个路由器都已经只有一条默认的路由到外面,不会受到其他区域的影响
routerB(config)#router ospf 10
routerB(config-router)#area 1 stub no-summary
routerC(config)#router ospf 10
routerC(config-router)#area 2 nssa no-summary
routerA#sh ip route
Gateway of last resort is 192.1.1.2 to network 0.0.0.0
192.1.1.0/30 is subnetted, 1 subnets
C 192.1.1.0 is directly connected, Serial0/0
O*IA 0.0.0.0/0 [110/65] via 192.1.1.2, 00:00:52, Serial0/0
routerD#sh ip route
172.1.0.0/16 is variably subnetted, 5 subnets, 2 masks
R 172.1.4.0/24 [120/1] via 172.1.3.2, 00:00:24, Serial0/3
R 172.1.1.0/24 [120/1] via 172.1.3.2, 00:00:24, Serial0/3
O 172.1.0.0/21 is a summary, 00:12:12, Null0
C 172.1.3.0/24 is directly connected, Serial0/3
R 172.1.2.0/24 [120/1] via 172.1.3.2, 00:00:24, Serial0/3
194.1.1.0/30 is subnetted, 1 subnets
C 194.1.1.0 is directly connected, Serial0/2
O*IA 0.0.0.0/0 [110/65] via 194.1.1.1, 00:01:00, Serial0/2