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 0x005C9D 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 0x0045F3 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 0x006E3F 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 0x00F6D1
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 0x0045F3 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 0x00DB4C 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 0x006E3F 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 0x00F6D1
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 0x00DB4C 2
Summary Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
199.99.1.0 2.2.2.2 39 0x80000001 0x00F6D1
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网络设计时所使用,它一般是用于临时性的和作为链路备份时候才用到的。