OSPF实验7:OSPF特殊区域
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://gairuhe.blog.51cto.com/77728/38687 | ||||||||||||||||||||||||||||||||||
OSPF实验7:OSPF特殊区域实验级别:Professional
实验拓扑:
![]() 实验说明:
R2为ABR和ASBR,R3在NSSA实验时会成为ASBR。
在做这个实验之前,首先我们要了解一下OSPF LSA的类型。见下表:
在一个OSPF的普通区域,会存在LSA1,LSA2,LSA3,LSA4,LSA5这些LSA,并且数量很多。我们可以通过OSPF的特殊区域的配置让某些区域减少LSA数目和路由表的条目。
基本配置:
R1:
interface Loopback0
ip address 1.1.1.1 255.255.255.0
ip ospf network point-to-point
!
interface Serial1/0
ip address 10.1.1.1 255.255.255.0
serial restart-delay 0
!
router ospf 10
router-id 1.1.1.1
log-adjacency-changes
network 1.1.1.0 0.0.0.255 area 0
network 10.1.1.0 0.0.0.255 area 0
R2:
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface Serial1/0
ip address 10.1.1.2 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
ip address 11.1.1.1 255.255.255.0
serial restart-delay 0
!
router ospf 10
router-id 2.2.2.2
log-adjacency-changes
redistribute connected subnets
network 10.1.1.0 0.0.0.255 area 0
network 11.1.1.0 0.0.0.255 area 1
R3:
interface Loopback0
ip address 3.3.3.3 255.255.255.0
!
interface FastEthernet0/0
no ip address
shutdown
duplex half
!
interface Serial1/0
ip address 11.1.1.2 255.255.255.0
serial restart-delay 0
!
router ospf 10
router-id 3.3.3.3
log-adjacency-changes
network 11.1.1.0 0.0.0.255 area 1
在R1和R3上查看路由表:
R1#sho ip rou
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, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
O E2 2.2.2.0 [110/20] via 10.1.1.2, 00:03:00, Serial1/0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Serial1/0
11.0.0.0/24 is subnetted, 1 subnets
O IA 11.1.1.0 [110/128] via 10.1.1.2, 00:03:00, Serial1/0
R3#sho ip rou
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, 1 subnets
O IA 1.1.1.0 [110/129] via 11.1.1.1, 00:02:51, Serial1/0
2.0.0.0/24 is subnetted, 1 subnets
O E2 2.2.2.0 [110/20] via 11.1.1.1, 00:02:51, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
O IA 10.1.1.0 [110/128] via 11.1.1.1, 00:02:51, Serial1/0
11.0.0.0/24 is subnetted, 1 subnets
C 11.1.1.0 is directly connected, Serial1/0
OE2的路由是通过LSA5传播,OIA的路由是通过LSA3来传播。
1. Stub Area我们观察拓扑,发现Area1不管去外部的那个目的网络,都必须通过ABR R2进行转发。在这种情况下,Area1可以配置成Stub Area。
Stub Area可以阻止LSA5,,并且处在区域边界的ABR将会通过LSA3发送一个默认路由给Stub Area。处在Stub Area内的所有路由器都必须配置成为Stub Area。
首先查看R3的OSPF数据库
R3#sho ip ospf da
OSPF Router with ID (3.3.3.3) (Process ID 10)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2.2 2.2.2.2 9 0x80000007 0x00309C 1
3.3.3.3 3.3.3.3 1 0x80000006 0x00451E 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
0.0.0.0 2.2.2.2 199 0x80000001 0x0075C0
1.1.1.0 2.2.2.2 9 0x80000003 0x00B13D
10.1.1.0 2.2.2.2 9 0x80000003 0x0032B4
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
2.2.2.0 2.2.2.2 842 0x80000001 0x00632F 0
通过以下配置可以将Area1配置成为Stub Area。
R2(config)#router ospf 10
R2(config-router)#area 1 stub
R3(config)#router ospf 10
R3(config-router)#area 1 stub
在R3上查看路由表:
R3#sho ip rou
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 11.1.1.1 to network 0.0.0.0
1.0.0.0/24 is subnetted, 1 subnets
O IA 1.1.1.0 [110/129] via 11.1.1.1, 00:00:16, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
O IA 10.1.1.0 [110/128] via 11.1.1.1, 00:00:16, Serial1/0
11.0.0.0/24 is subnetted, 1 subnets
C 11.1.1.0 is directly connected, Serial1/0
O*IA 0.0.0.0/0 [110/65] via 11.1.1.1, 00:00:16, Serial1/0
发现原来的OE2路由没有了,取代了1条默认路由O*IA 0.0.0.0/0 [110/65](通过LSA3通告)
在看R3的OSPF数据库
R3#sho ip ospf da
OSPF Router with ID (3.3.3.3) (Process ID 10)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2.2 2.2.2.2 7 0x8000000A 0x00BEA6 2
3.3.3.3 3.3.3.3 6 0x80000008 0x005F04 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
0.0.0.0 2.2.2.2 12 0x80000001 0x0075C0
1.1.1.0 2.2.2.2 12 0x80000004 0x00CD22
10.1.1.0 2.2.2.2 12 0x80000004 0x004E9
此时已经没有Type-5 AS External Link States的LSA了。
2. Totally Stub Area对于本实验的Area1 来说,其实域间路由OIA也是不需要的。我们可以将Area1配置成为Totally Stub Area,从而来阻止LSA3和LSA4在这个区域的传播,出了通告缺省路由的那一条类型3的LSA。
Totally Stub Area的配置也很简单,只需要在ABR上将其配置成为totally stub area,并且这个区域的所有路由器配置成为stub area就可以了。
在这个实验中,我们在上面已经将R3配置成stub area,只要在R2上配置area1成为Totally Stub Area即可。
R2(config-router)#area 1 stub no-summary
在R3上查看路由表和数据库
R3#sho ip rou
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 11.1.1.1 to network 0.0.0.0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
11.0.0.0/24 is subnetted, 1 subnets
C 11.1.1.0 is directly connected, Serial1/0
O*IA 0.0.0.0/0 [110/65] via 11.1.1.1, 00:00:12, Serial1/0
发现OIA的路由条目也没有了
R3#sho ip ospf database
OSPF Router with ID (3.3.3.3) (Process ID 10)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2.2 2.2.2.2 415 0x8000000A 0x00BEA6 2
3.3.3.3 3.3.3.3 415 0x80000008 0x005F04 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
0.0.0.0 2.2.2.2 69 0x80000002 0x0073C1
只有LSA1和一条汇总的LSA3
3. Not-So-Stubby Area(NSSA)如果我们需要R3通过重发布来发布它的直连路由,这样R3就是一个ASBR路由器,会产生LSA7。但是一旦这样,R3就不能是一个Stub Area。这时我们可以将Area 1配置成为NSSA区域。
NSSA:允许外部路由通告到OSPF |



