CCNP-14 OSPF试验10
试验拓扑:
试验要求:
R1 R2 R3
起
OSPF
,并且按照拓扑图划分好区域。
试验目的:掌握
OSPF
虚链路的配置方法。
试验配置:
R1
:
R1(config)#int s1/0
R1(config-if)#ip add 199.99.1.1 255.255.255.0
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)#ip ospf network point-to-point
R1(config-if)#exit
R1(config)#int loop1
R1(config-if)#ip add 199.99.3.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)#router-id 1.1.1 .1
R1(config-router)#network 199.99.3.0 0.0.0 .255 area 0
R1(config-router)#network 199.99.1.0 0.0.0 .255 area 1
R2
:
R2(config)#int s1/0
R2(config-if)#ip add 199.99.1.2 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shu
R2(config-if)#exit
R2(config)#int s1/1
R2(config-if)#ip add 199.99.2.1 255.255.255.0
R2(config-if)#clock rate 64000
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)#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 1
R2(config-router)#network 199.99.2.0 0.0.0 .255 area 2
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
R3(config)#int loop0
R3(config-if)#ip add 3.3.3 .3 255.255.255.0
R3(config-if)#ip ospf network point-to-point
R3(config-if)#exit
R3(config)#router ospf 100
R3(config-router)#router-id 3.3.3 .3
R3(config-router)#network 199.99.3.0 0.0.0 .255 area 2
OK
,基本的
OSPF
配置完成,下面查看每台路由器的邻居表,路由表和
LSDB
表(在下面对比中可以看到)
通过每台路由器的三张表可以知道
R1
并没有学到
R3
,也就是区域
2
的路由,同样区域
2
也没有学到
R1
区域
0
的任何路由。解决这种不连续区域的问题的方法是配置
OSPF
虚链路:
R1(config)#router ospf 100
R1(config-router)#area 1 virtual-link 2.2.2 .2
R1(config-router)#end
R2(config)#router ospf 100
R2(config-router)#area 1 virtual-link 1.1.1 .1
R2(config-router)#end
在
AREA 1
的两台
ABR
上输入上面用红色标注的语句后,再查看一下
R1
和
R2
的三张表和
R3
的路由表,看看发生了什么变化:
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2
.2 0 FULL/ - 00:00:36 199.99.1.2 Serial1/0
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2
.2 0 FULL/ - - 199.99.1.2 OSPF_VL0
2.2.2
.2 0 FULL/ - 00:00:39 199.99.1.2 Serial1/0
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1
.1 0 FULL/ - 00:00:39 199.99.1.1 Serial1/0
3.3.3
.3 0 FULL/ - 00:00:39 199.99.2.2 Serial1/1
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1
.1 0 FULL/ - - 199.99.1.1 OSPF_VL0
1.1.1
.1 0 FULL/ - 00:00:39 199.99.1.1 Serial1/0
3.3.3
.3 0 FULL/ - 00:00:31 199.99.2.2 Serial1/1
注意邻居表的变化,
R1
多了一条到
R2
的邻居项,同样
R2
多了一条到
R1
的邻居表项,并且没有
Dead Time
时间,最后面的
Interface
显示为
OSPF_VL0
。
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 28 0x80000002 0x 005C 9D 1
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
199.99.1.0 1.1.1 .1 28 0x80000001 0x0015B7
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1
.1 1.1.1 .1 17 0x80000002 0x 0045F 3 2
2.2.2
.2 2.2.2 .2 18 0x80000001 0x00E352 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
199.99.3.0 1.1.1 .1 33 0x80000001 0x008683
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 4 0x80000003 0x003141 2
2.2.2
.2 2.2.2 .2 1 (DNA) 0x80000002 0x006E 3F 1
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
199.99.1.0 1.1.1 .1 58 0x80000001 0x0015B7
199.99.1.0 2.2.2 .2 7 (DNA) 0x80000001 0x 00F 6D1
199.99.2.0 2.2.2 .2 7 (DNA) 0x80000001 0x00EBDB
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1
.1 1.1.1 .1 4 0x80000003 0x004FE4 2
2.2.2
.2 2.2.2 .2 5 0x80000003 0x00EE40 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
199.99.2.0 2.2.2 .2 11 0x80000001 0x00EBDB
199.99.3.0 1.1.1 .1 63 0x80000001 0x008683
R2#show ip ospf database
OSPF Router with ID ( 2.2.2 .2) (Process ID 100)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1
.1 1.1.1 .1 19 0x80000002 0x 0045F 3 2
2.2.2
.2 2.2.2 .2 18 0x80000001 0x00E352 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
199.99.3.0 1.1.1 .1 34 0x80000001 0x008683
Router Link States (Area 2)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2
.2 2.2.2 .2 7 0x80000002 0x003AF1 2
3.3.3
.3 3.3.3 .3 13 0x80000001 0x00DB 4C 2
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 1 (DNA) 0x80000003 0x003141 2
2.2.2
.2 2.2.2 .2 32 0x80000002 0x006E 3F 1
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
199.99.1.0 1.1.1 .1 54 (DNA) 0x80000001 0x0015B7
199.99.1.0 2.2.2 .2 39 0x80000001 0x 00F 6D1
199.99.2.0 2.2.2 .2 39 0x80000001 0x00EBDB
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1
.1 1.1.1 .1 33 0x80000003 0x004FE4 2
2.2.2
.2 2.2.2 .2 32 0x80000003 0x00EE40 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
199.99.2.0 2.2.2 .2 39 0x80000001 0x00EBDB
199.99.3.0 1.1.1 .1 92 0x80000001 0x008683
Router Link States (Area 2)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2
.2 2.2.2 .2 38 0x80000003 0x003BEE 2
3.3.3
.3 3.3.3 .3 70 0x80000001 0x00DB 4C 2
Summary Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
199.99.1.0 2.2.2 .2 39 0x80000001 0x 00F 6D1
199.99.3.0 2.2.2 .2 24 0x80000001 0x00EADA
注意
LSDB
表的变化,在
R1
的
AREA 0
区域内可以看到从
R2
学到的
LSA
都标记了
DNA
(
Do Not Age
),同样在
R2
的
AREA 0
区域内也可以看到从
R1
学到的
LSA
都标记了
DNA
。
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
C 199.99.3.0/24 is directly connected, Loopback1
C 199.99.1.0/24 is directly connected, Serial1/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, 1 subnets
C 1.1.1 .0 is directly connected, Loopback0
C 199.99.3.0/24 is directly connected, Loopback1
O IA 199.99.2.0/24 [110/128] via 199.99.1.2, 00:00:06, Serial1/0
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
O IA 199.99.3.0/24 [110/65] via 199.99.1.1, 00:00:15, 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
O 199.99.3.0/24 [110/65] via 199.99.1.1, 00:00:26, Serial1/0
C 199.99.2.0/24 is directly connected, Serial1/1
C 199.99.1.0/24 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
3.0.0 .0/24 is subnetted, 1 subnets
C 3.3.3 .0 is directly connected, Loopback0
C 199.99.2.0/24 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
3.0.0 .0/24 is subnetted, 1 subnets
C 3.3.3 .0 is directly connected, Loopback0
O IA 199.99.3.0/24 [110/129] via 199.99.2.1, 00:00:33, Serial1/0
C 199.99.2.0/24 is directly connected, Serial1/0
O IA 199.99.1.0/24 [110/128] via 199.99.2.1, 00:00:43, Serial1/0
注意之前
R1
和
R3
时无法相互通信的,并且在
R2
上学到的区域
0
的路由是
O IA
路由,配置完虚链路之后发现
R1
和
R3
都相互学到了各自的路由,并且
R2
上区域
0
的路由也变成了
O
路由。
我们可以通过
show ip ospf virtual-links
查看一下虚链路的状态:
R1#show ip ospf virtual-links
Virtual Link OSPF_VL0 to router 2.2.2 .2 is up
Run as demand circuit
DoNotAge LSA allowed.
Transit area 1, via interface Serial1/0, Cost of using 64
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:01
Adjacency State FULL (Hello suppressed)
Index 1/2, retransmission queue length 0, number of retransmission 0
First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
Last retransmission scan length is 0, maximum is 0
Last retransmission scan time is 0 msec, maximum is 0 msec
R2#show ip ospf virtual-links
Virtual Link OSPF_VL0 to router 1.1.1 .1 is up
Run as demand circuit
DoNotAge LSA allowed.
Transit area 1, via interface Serial1/0, Cost of using 64
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:07
Adjacency State FULL (Hello suppressed)
Index 1/3, retransmission queue length 0, number of retransmission 0
First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
Last retransmission scan length is 0, maximum is 0
Last retransmission scan time is 0 msec, maximum is 0 msec
以上用红颜色标记的部分说明了这是一个虚链接,传输区域为
AREA 1
,类型为点对点,
HELLO
时间间隔为
10
,等待时间和死亡时间为
40
。
实验总结:掌握
OSPF
虚连接的配置方法,并且知道
OSPF
虚链接是不能作为主要
OSPF
网络设计时所使用,它一般是用于临时性的和作为链路备份时候才用到的。