CCNP-11 OSPF试验7
实验拓扑:
试验要求:
R1 R2 R3 R4
按照拓扑上连好,
R1 R2 R4
起
OSPF
,
R3
起
RIPv2
,首先把
AREA 1
设置为普通区域,并且配置
R1
重分布
RIPv2
路由到
OSPF
,观察
R4
上的
LSDB
的类型,然后再把
AREA 1
配置成为
STUB
区域,观察
R4
的
LSDB
有什么变化。
试验目的:掌握
OSPF STUB
的配置方法,并且能够分析
LSDB
的变化。
实验配置:
R1
:
R1(config)#int s1/0
R1(config-if)#ip add 199.99.1.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shu
R1(config-if)#exit
R1(config)#int s1/1
R1(config-if)#ip add 199.99.2.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shu
R2
:
R2(config)#int s1/0
R2(config-if)#ip add 199.99.1.2 255.255.255.0
R2(config-if)#no shu
R2(config-if)#exit
R2(config)#int s1/1
R2(config-if)#ip add 199.99.3.1 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shu
R2(config-if)#exit
R3
:
R3(config)#int s1/0
R3(config-if)#ip add 199.99.2.2 255.255.255.0
R3(config-if)#no shu
R3(config-if)#exit
R4
:
R4(config)#int s1/0
R4(config-if)#ip add 199.99.3.2 255.255.255.0
R4(config-if)#no shu
R4(config-if)#exit
OK
,基本的链路层配置完毕,然后用
ping
测试连通性,这里略,然后在
R1 R2 R4
上配置
OSPF
,
R3 R1
上配置
RIP
,并在
R1
上重分布
RIP
路由到
OSPF
中,都起
loopback
口:
R1(config)#int loop0
R1(config-if)#ip add 1.1.1 .1 255.255.255.0
R1(config-if)#ip ospf network point-to-point
R1(config-if)#exit
R1(config)#router ospf 100
R1(config-router)#network 199.99.1.0 0.0.0 .255 area 0
R1(config-router)#exit
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#network 199.99.2.0
R1(config-router)#no auto-summary
R1(config-router)#exit
R1(config)#router ospf 100
R1(config-router)#redistribute rip subnets
R1(config-router)#exit
R2(config)#int loop0
R2(config-if)#ip add 2.2.2 .2 255.255.255.0
R2(config-if)#ip ospf network point-to-point
R2(config-if)#exit
R2(config)#router ospf 100
R2(config-router)#network 199.99.1.0 0.0.0 .255 area 0
R2(config-router)#network 199.99.3.0 0.0.0 .255 area 1
R3(config)#int loop 0
R3(config-if)#ip add 3.3.3 .3 255.255.255.0
R3(config-if)#no shu
R3(config-if)#exit
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#network 199.99.2.0
R3(config-router)#network 3.3.3 .0
R3(config-router)#no auto-summary
R3(config-router)#end
R4(config)#int loop0
R4(config-if)#ip add 4.4.4 .4 255.255.255.0
R4(config-if)#ip ospf network point-to-point
R4(config-if)#exit
R4(config)#router ospf 100
R4(config-router)#network 199.99.3.0 0.0.0 .255 area 1
好了,注意每台路由器和不同路由协议所通告的网段,下面我们在
R1 R2 R4
上
show ip route
查看一下路由表:
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, 1 subnets
C 1.1.1 .0 is directly connected, Loopback0
3.0.0 .0/24 is subnetted, 1 subnets
R 3.3.3 .0 [120/1] via 199.99.2.2, 00:00:07, Serial1/1
O IA 199.99.3.0/24 [110/128] via 199.99.1.2, 00:01:12, Serial1/0
C 199.99.2.0/24 is directly connected, Serial1/1
C 199.99.1.0/24 is directly connected, Serial1/0
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
2.0.0 .0/24 is subnetted, 1 subnets
C 2.2.2 .0 is directly connected, Loopback0
3.0.0 .0/24 is subnetted, 1 subnets
O E2 3.3.3 .0 [110/20] via 199.99.1.1, 00:00:02, Serial1/0
C 199.99.3.0/24 is directly connected, Serial1/1
O E2 199.99.2.0/24 [110/20] via 199.99.1.1, 00:00:08, Serial1/0
C 199.99.1.0/24 is directly connected, 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
3.0.0 .0/24 is subnetted, 1 subnets
O E2 3.3.3 .0 [110/20] via 199.99.3.1, 00:00:08, Serial1/0
4.0.0 .0/24 is subnetted, 1 subnets
C 4.4.4 .0 is directly connected, Loopback0
C 199.99.3.0/24 is directly connected, Serial1/0
O E2 199.99.2.0/24 [110/20] via 199.99.3.1, 00:00:09, Serial1/0
O IA 199.99.1.0/24 [110/128] via 199.99.3.1, 00:00:35, Serial1/0
我们在
R2
和
R4
的路由表里发现了
O E2
和
O IA
路由,
O E2
表示从自治系统外部学到的路由,
O IA
表示从相同自治系统中不同区域学到的路由,下面我们
show ip ospf database
查看一下
LSDB
表:
R1#show ip ospf database
OSPF Router with ID ( 1.1.1 .1) (Process ID 100)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1
.1 1.1.1 .1 6 0x80000003 0x 0046F 0 2
2.2.2
.2 2.2.2 .2 29 0x80000004 0x00E051 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
199.99.3.0 2.2.2 .2 28 0x80000001 0x00E0E5
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
199.99.2.0 1.1.1 .1 5 0x80000001 0x00E589 0
以上为
R1
的
LSDB
,发现里面有
LSA TYPE-1 and 3 and 5
,由此我们可以知道
R1
为
ASBR
。
R2#show ip ospf database
OSPF Router with ID ( 2.2.2 .2) (Process ID 100)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1
.1 1.1.1 .1 15 0x80000003 0x 0046F 0 2
2.2.2
.2 2.2.2 .2 36 0x80000004 0x00E051 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
199.99.3.0 2.2.2 .2 35 0x80000001 0x00E0E5
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2
.2 2.2.2 .2 40 0x80000001 0x 0083A 2 2
4.4.4
.4 4.4.4 .4 40 0x80000002 0x00AF6D 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
199.99.1.0 2.2.2 .2 40 0x80000001 0x 00F 6D1
Summary ASB Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
1.1.1
.1 2.2.2 .2 9 0x80000001 0x 00935C
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
3.3.3
.0 1.1.1 .1 4 0x80000001 0x005D36 0
199.99.2.0 1.1.1 .1 15 0x80000001 0x00E589 0
以上为
R2
的
LSDB
,发现它包含了两个区域的
LSDB
,说明它是一台
ABR
,同样我们可以看到
LSA TYPE-1 and 3 and 5
。
R4#show ip ospf database
OSPF Router with ID ( 4.4.4 .4) (Process ID 100)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2
.2 2.2.2 .2 47 0x80000001 0x 0083A 2 2
4.4.4
.4 4.4.4 .4 46 0x80000002 0x00AF6D 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
199.99.1.0 2.2.2 .2 47 0x80000001 0x 00F 6D1
Summary ASB Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
1.1.1
.1 2.2.2 .2 16 0x80000001 0x 00935C
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
3.3.3
.0 1.1.1 .1 12 0x80000001 0x005D36 0
199.99.2.0 1.1.1 .1 22 0x80000001 0x00E589 0
以上为
R4
的
LSDB
,包含了
LSA TYPE-1 and 3 and 4 and 5
。
接下来我们把
AREA 1
配置成为
STUB
区域,看看
LSDB
有什么变化:
R2(config)#router ospf 100
R2(config-router)#area 1 stub
R4(config)#router ospf 100
R4(config-router)#area 1 stub
注意:
area xx stub
这条命令要在
STUB
区域内的每台
OSPF
路由器上配置,否则无法成功建立邻居关系!然后我们在
R4
上
clear ip route *
,再
show ip route
查看,看看是否有什么变化?
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 199.99.3.1 to network 0.0.0 .0
4.0.0 .0/24 is subnetted, 1 subnets
C 4.4.4 .0 is directly connected, Loopback0
C 199.99.3.0/24 is directly connected, Serial1/0
O IA 199.99.1.0/24 [110/128] via 199.99.3.1, 00:00:07, Serial1/0
O*I A 0.0.0 .0/0 [110/65] via 199.99.3.1, 00:00:07, 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
3.0.0 .0/24 is subnetted, 1 subnets
O E2 3.3.3 .0 [110/20] via 199.99.3.1, 00:00:08, Serial1/0
4.0.0 .0/24 is subnetted, 1 subnets
C 4.4.4 .0 is directly connected, Loopback0
C 199.99.3.0/24 is directly connected, Serial1/0
O E2 199.99.2.0/24 [110/20] via 199.99.3.1, 00:00:09, Serial1/0
O IA 199.99.1.0/24 [110/128] via 199.99.3.1, 00:00:35, Serial1/0
发现了吗?原来的
O E2
路由没有了,变成了
O*IA
路由了,下一跳地址为
ABR
的接口地址,
show ip ospf database
查看一下
LSDB
的变化:
R4#show ip ospf database
OSPF Router with ID ( 4.4.4 .4) (Process ID 100)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2
.2 2.2.2 .2 22 0x80000003 0x009D88 2
4.4.4
.4 4.4.4 .4 20 0x80000004 0x 00C 953 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
0.0.0
.0 2.2.2 .2 27 0x80000001 0x 0075C 0
199.99.1.0 2.2.2 .2 27 0x80000002 0x0013B6
R4#show ip ospf database
OSPF Router with ID ( 4.4.4 .4) (Process ID 100)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2
.2 2.2.2 .2 47 0x80000001 0x 0083A 2 2
4.4.4
.4 4.4.4 .4 46 0x80000002 0x00AF6D 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
199.99.1.0 2.2.2 .2 47 0x80000001 0x 00F 6D1
Summary ASB Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
1.1.1
.1 2.2.2 .2 16 0x80000001 0x 00935C
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
3.3.3
.0 1.1.1 .1 12 0x80000001 0x005D36 0
199.99.2.0 1.1.1 .1 22 0x80000001 0x00E589 0
原来的
LSA TYPE-4 and 5
的
LSA
没有了,多了一条三类的默认路由,由此我们可以判断出
STUB
区域中的
ABR
将外部来的
5
类
LSA
转变为默认
3
类
LSA
后,再向区域内泛洪。这样配置后
LSDB
的体积明显小多了。
实验总结:掌握
OSPF
的特殊区域
STUB
区域的配置方法,理解
STUB
区域的作用,理解
STUB
区域的
ABR
将阻止外部传来的
4
和
5
类
LSA
洪泛到
STUB
区域内,并且将
5
类
LSA
转变为一条默认的
3
类
LSA
后,再向
STUB
区域内洪泛。