CCNP-15 OSPF试验11
实验拓扑:![](https://i-blog.csdnimg.cn/blog_migrate/0aefb697d1f3adabcc481ac12aae6cd5.png)
实验要求:
R1 R2
起
OSPF
,再分别起若干个连续子网的
Loopback
接口作为测试,然后配置
R2
为
ABR
,
R1
为
ASBR
。
试验目的:掌握
OSPF
区域间汇总和自治系统外汇总的配置方法。
实验配置:
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 loop0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#int loop1
R1(config-if)#ip add 172.16.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#int loop2
R1(config-if)#ip add 172.16.2.1 255.255.255.0
R1(config-if)#exit
R1(config)#int loop3
R1(config-if)#ip add 172.16.3.1 255.255.255.0
R1(config-if)#exit
R1(config)#int loop4
R1(config-if)#ip add 172.16.0.1 255.255.255.0
R1(config-if)#exit
R1(config)#router ospf 100
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 199.99.1.0 0.0.0.255 area 0
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 loop0
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config-if)#exit
R2(config)#int loop1
R2(config-if)#ip add 172.17.0.1 255.255.255.0
R2(config-if)#ip ospf network point-to-point
R2(config-if)#exit
R2(config)#int loop2
R2(config-if)#ip add 172.17.1.1 255.255.255.0
R2(config-if)#ip ospf network point-to-point
R2(config-if)#exit
R2(config)#int loop3
R2(config-if)#ip add 172.17.2.1 255.255.255.0
R2(config-if)#ip ospf network point-to-point
R2(config-if)#exit
R2(config)#int loop4
R2(config-if)#ip add 172.17.3.1 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)#router-id 2.2.2.2
R2(config-router)#network 199.99.1.0 0.0.0.255 area 0
以上为基本配置,下面在
R1
上
show ip ospf neighbor
查看一下
OSPF
邻居关系是否成功建立:
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2
.2 0 FULL/ - 00:00:38 199.99.1.2 Serial1/0
OK
,好了,
OSPF
配置成功,下面开始把
R2
配置成为
ABR
:
R2(config)#router ospf 100
R2(config-router)#network 172.17.0.0 0.0.0.255 area 1
R2(config-router)#network 172.17.1.0 0.0.0.255 area 1
R2(config-router)#network 172.17.2.0 0.0.0.255 area 1
R2(config-router)#network 172.17.3.0 0.0.0.255 area 1
在
R2
上配置了一个区域
1
,并且加入了
4
个连续的网段,配置完成后查看一下
R1
上的路由表:
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
172.17.0.0/24 is subnetted, 4 subnets
O IA 172.17.0.0 [110/65] via 199.99.1.2, 00:00:27, Serial1/0
O IA 172.17.1.0 [110/65] via 199.99.1.2, 00:00:27, Serial1/0
O IA 172.17.2.0 [110/65] via 199.99.1.2, 00:00:17, Serial1/0
O IA 172.17.3.0 [110/65] via 199.99.1.2, 00:00:07, Serial1/0
172.16.0.0/24 is subnetted, 4 subnets
C 172.16.0.0 is directly connected, Loopback4
C 172.16.1.0 is directly connected, Loopback1
C 172.16.2.0 is directly connected, Loopback2
C 172.16.3.0 is directly connected, Loopback3
C 199.99.1.0/24 is directly connected, Serial1/0
再查看一下
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 197 0x80000002 0x0042F7 2
2.2.2
.2 2.2.2.2 69 0x80000004 0x00E051 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
172.17.0.0 2.2.2.2 3605 0x80000003 0x00ADC6
172.17.1.0 2.2.2.2 3605 0x80000003 0x00A2D0
172.17.2.0 2.2.2.2 3605 0x80000002 0x0099D9
172.17.3.0 2.2.2.2 3605 0x80000002 0x008EE3
可以发现不管是路由表还是
LSDB
都有点大了,解决这个问题的方法是在
ABR
上配置区域间路由汇总,如下在
R2
上的配置:
R2(config)#router ospf 100
R2(config-router)#area 1 range 172.17.0.0 255.255.252.0
R2(config-router)#end
配置完成后,在
R1
和
R2
上都
clear ip ospf p
一下,然后再在
R1
上查看路由表:
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
172.17.0.0/22 is subnetted, 1 subnets
O IA 172.17.0.0 [110/65] via 199.99.1.2, 00:00:03, Serial1/0
172.16.0.0/24 is subnetted, 4 subnets
C 172.16.0.0 is directly connected, Loopback4
C 172.16.1.0 is directly connected, Loopback1
C 172.16.2.0 is directly connected, Loopback2
C 172.16.3.0 is directly connected, Loopback3
C 199.99.1.0/24 is directly connected, Serial1/0
可以看到从原来的
4
条路由汇聚成了一条
22
位的路由,再看一下
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 206 0x80000002 0x0042F7 2
2.2.2
.2 2.2.2.2 78 0x80000004 0x00E051 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
172.17.0.0 2.2.2.2 15 0x80000001 0x00B6C2
发现了吧,三类
LSA
就剩下一条了。大大减小了路由表和
LSDB
的大小。
接下来是把
R1
配置成为
ASBR
,如下:
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#network 172.16.0.0
R1(config-router)#network 172.16.1.0
R1(config-router)#network 172.16.2.0
R1(config-router)#network 172.16.3.0
R1(config-router)#exit
R1(config)#router ospf 100
R1(config-router)#redistribute rip subnets
R1(config-router)#exit
这样配置后
,R1
就是一台
ASBR
了,下面查看
R2
的路由表和
LSDB
:
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
172.17.0.0/16 is variably subnetted, 5 subnets, 2 masks
C 172.17.1.0/24 is directly connected, Loopback2
C 172.17.0.0/24 is directly connected, Loopback1
O 172.17.0.0/22 is a summary, 00:02:36, Null0
C 172.17.3.0/24 is directly connected, Loopback4
C 172.17.2.0/24 is directly connected, Loopback3
172.16.0.0/24 is subnetted, 4 subnets
O E2 172.16.0.0 [110/20] via 199.99.1.1, 00:00:01, Serial1/0
O E2 172.16.1.0 [110/20] via 199.99.1.1, 00:00:06, Serial1/0
O E2 172.16.2.0 [110/20] via 199.99.1.1, 00:00:06, Serial1/0
O E2 172.16.3.0 [110/20] via 199.99.1.1, 00:00:06, Serial1/0
C 199.99.1.0/24 is directly connected, Serial1/0
学到了
4
条
AS
外部路由。
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 111 0x80000003 0x0046F0 2
2.2.2
.2 2.2.2.2 221 0x80000004 0x00E051 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
172.17.0.0 2.2.2.2 158 0x80000001 0x00B6C2
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2
.2 2.2.2.2 202 0x80000003 0x00D317 4
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
199.99.1.0 2.2.2.2 222 0x80000001 0x00F6D1
Summary ASB Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
1.1.1
.1 2.2.2.2 105 0x80000001 0x00935C
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
172.16.0.0 1.1.1.1 5 0x80000004 0x003E9E 0
172.16.1.0 1.1.1.1 10 0x80000001 0x0039A5 0
172.16.2.0 1.1.1.1 10 0x80000001 0x002EAF 0
172.16.3.0 1.1.1.1 10 0x80000001 0x0023B9 0
和在配置区域间汇总前遇到的问题是一样的,就是路由表和
LSDB
的体积都比较大,这里解决问题的方法是采用
AS
外部路由汇总,在
R1
上作如下配置:
R1(config)#router ospf 100
R1(config-router)#summary-address 172.16.0.0 255.255.252.0
R1(config-router)#end
配置完成后,为了快速查看实验效果,同样是在
R1 R2
上
clear ip ospf p
,然后查看
R2
的路由表:
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
172.17.0.0/16 is variably subnetted, 5 subnets, 2 masks
C 172.17.1.0/24 is directly connected, Loopback2
C 172.17.0.0/24 is directly connected, Loopback1
O 172.17.0.0/22 is a summary, 00:00:01, Null0
C 172.17.3.0/24 is directly connected, Loopback4
C 172.17.2.0/24 is directly connected, Loopback3
172.16.0.0/22 is subnetted, 1 subnets
O E2 172.16.0.0 [110/20] via 199.99.1.1, 00:00:01, Serial1/0
C 199.99.1.0/24 is directly connected, Serial1/0
原来的
4
条
24
位掩码的外部路由汇聚成了一条
22
位掩码的外部路由,再查看
LSDB
看看有什么变化:
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 130 0x80000003 0x0046F0 2
2.2.2
.2 2.2.2.2 240 0x80000004 0x00E051 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
172.17.0.0 2.2.2.2 176 0x80000001 0x00B6C2
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2
.2 2.2.2.2 220 0x80000003 0x00D317 4
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
199.99.1.0 2.2.2.2 241 0x80000001 0x00F6D1
Summary ASB Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
1.1.1
.1 2.2.2.2 124 0x80000001 0x00935C
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
172.16.0.0 1.1.1.1 16 0x80000005 0x002DB1 0
类型
5
的
LSA
,也就是
AS
外部
LSA
就剩下了一条了,比原来大大减小了。
实验总结:了解
OSPF
中为了减小路由表和
LSDB
表的大小,可以采用
OSPF
区域间汇总和自治系统外部路由汇总的方法,并且要掌握这两种汇总方法的配置。
本文转自loveme2351CTO博客,原文链接:
http://blog.51cto.com/loveme23/47113
,如需转载请自行联系原作者