实验目的
掌握OSPF虚链路的配置
掌握OSPF虚链路认证的配置
加微 xmws-IT:备注:视频资料。赠华为、思科学习视频教程
实验拓扑
实验需求
根据实验拓扑图,完成设备的基本配置;
根据实验拓扑图,在所有设备上启用OSPF,进程号为1,使用Loopback0作为OSPF的Router-ID;
在R1、R2之间建立虚链路并启用虚链路MD5认证,认证密码为wisdom。
实验步骤
设备基本配置
R1基本配置如下:
hostname R1
interface Serial1/0ip address 12.1.1.1 255.255.255.0no shutdown
interface Serial1/1ip address 14.1.1.1 255.255.255.0no shutdown
interface loopback0ip address 1.1.1.1 255.255.255.255R2的基本配置如下:
hostname R2
interface Serial1/0ip address 12.1.1.2 255.255.255.0no shutdown
interface Serial1/1ip address 23.1.1.2 255.255.255.0no shutdown
interface loopback0ip address 2.2.2.2 255.255.255.255R3的基本配置如下:
hostname R3
interface Serial1/0ip address 23.1.1.3 255.255.255.0no shutdown
interface loopback0ip address 3.3.3.3 255.255.255.255R4的基本配置如下:
hostname R4
interface Serial1/0ip address 14.1.1.4 255.255.255.0no shutdown
interface loopback0ip address 4.4.4.4 255.255.255.255
配置OSPF
配置R1:
router ospf 1router-id 1.1.1.1network 1.1.1.1 0.0.0.0 area 12network 12.1.1.1 0.0.0.0 area 12network 14.1.1.1 0.0.0.0 area 14
配置R2:
router ospf 1router-id 2.2.2.2network 2.2.2.2 0.0.0.0 area 12network 12.1.1.2 0.0.0.0 area 12network 23.1.1.2 0.0.0.0 area 0
配置R3:
router ospf 1router-id 3.3.3.3network 3.3.3.3 0.0.0.0 area 0network 23.1.1.3 0.0.0.0 area 0
配置R4:
ip routing
router ospf 1router-id 4.4.4.4network 4.4.4.4 0.0.0.0 area 14network 14.1.1.4 0.0.0.0 area 14
检查R1的OSPF邻居:
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 0 FULL/ - 00:00:31 12.1.1.2 Serial1/0
4.4.4.4 1 FULL/DR 00:00:37 14.1.1.4 Serial1/1
检查R2的OSPF邻居:
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
3.3.3.3 0 FULL/ - 00:00:37 23.1.1.3 Serial1/1
1.1.1.1 0 FULL/ - 00:00:30 12.1.1.1 Serial1/0
检查R3的OSPF邻居:
R3#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 0 FULL/ - 00:00:34 23.1.1.2 Serial1/1
检查R4的OSPF邻居:
R4#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/BDR 00:00:32 14.1.1.1 Serial1/0
经检查,现在每台设备的OSPF邻居是正常的。那是不是路由的接收也正常的呢?
检查R1的路由表:
R1#show ip route ospf 2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 12.1.1.2, 00:06:07, Serial1/03.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/129] via 12.1.1.2, 00:05:13, Serial1/04.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/2] via 14.1.1.4, 00:05:13, Serial1/123.0.0.0/24 is subnetted, 1 subnets
O IA 23.1.1.0 [110/128] via 12.1.1.2, 00:05:13, Serial1/0路由表正常。
检查R2的路由表:
R2#show ip route ospf 1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/65] via 12.1.1.1, 00:09:49, Serial1/03.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/65] via 23.1.1.3, 00:09:39, Serial1/1
没有4.4.4.4/32和14.1.1.0/24路由,因为Area14作为常规区域并没有和Area0直接相连。
检查R3的路由表:
R3#show ip route ospf 1.0.0.0/32 is subnetted, 1 subnets
O IA 1.1.1.1 [110/129] via 23.1.1.2, 00:09:50, Serial1/12.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/65] via 23.1.1.2, 00:09:50, Serial1/112.0.0.0/24 is subnetted, 1 subnets
O IA 12.1.1.0 [110/128] via 23.1.1.2, 00:09:50, Serial1/1
没有4.4.4.4/32和14.1.1.0/24路由,因为Area14作为常规区域并没有和Area0直接相连。
检查R4的路由表:
R4#show ip route ospf没有路由!因为Area14作为常规区域并没有和Area0直接相连。
配置OSPF虚链路
配置R1:
R1(config)#router ospf 1
R1(config-router)#area 12 virtual-link 2.2.2.2配置R2:
R2(config)#router ospf 1
R2(config-router)#area 12 virtual-link 1.1.1.1检查R1的邻居表:
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 0 FULL/ - - 12.1.1.2 OSPF_VL0
2.2.2.2 0 FULL/ - 00:00:33 12.1.1.2 Serial1/0
4.4.4.4 1 FULL/DR 00:00:30 14.1.1.4 Serial1/1发现邻居表多了一个条目,邻居是2.2.2.2,OSPF邻居状态为Full,Dead时间是空的,这是因为Virtual-link是一条按需的链路,建立起来之后Virtual-link上是不存在Hello报文发送的。检查R2的邻居表:
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 0 FULL/ - - 12.1.1.1 OSPF_VL0
3.3.3.3 0 FULL/ - 00:00:38 23.1.1.3 Serial1/1
1.1.1.1 0 FULL/ - 00:00:32 12.1.1.1 Serial1/0检查R1上的Virtual-link:
R1#show ip ospf virtual-links
Virtual Link OSPF_VL0 to router 2.2.2.2 is upRun as demand circuitDoNotAge LSA allowed.Transit area 12, via interface Serial1/0, Cost of using 64Transmit Delay is 1 sec, State POINT_TO_POINT,Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5Hello due in 00:00:00Adjacency State FULL (Hello suppressed)Index 1/3, retransmission queue length 0, number of retransmission 0First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)Last retransmission scan length is 0, maximum is 0Last retransmission scan time is 0 msec, maximum is 0 msec检查R2上的Virtual-link:
R2#show ip ospf virtual-links
Virtual Link OSPF_VL0 to router 1.1.1.1 is upRun as demand circuitDoNotAge LSA allowed.Transit area 12, via interface Serial1/0, Cost of using 64Transmit Delay is 1 sec, State POINT_TO_POINT,Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5Hello due in 00:00:08Adjacency State FULL (Hello suppressed)Index 2/3, retransmission queue length 0, number of retransmission 0First 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检查R1的路由表:
R1#show ip route ospf 2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 12.1.1.2, 00:38:24, Serial1/03.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/129] via 12.1.1.2, 00:38:24, Serial1/04.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/2] via 14.1.1.4, 00:38:41, Serial1/123.0.0.0/24 is subnetted, 1 subnets
O 23.1.1.0 [110/128] via 12.1.1.2, 00:38:24, Serial1/0检查R2的路由表:
R2#show ip route ospf 1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/65] via 12.1.1.1, 00:38:39, Serial1/03.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/65] via 23.1.1.3, 00:38:39, Serial1/14.0.0.0/32 is subnetted, 1 subnets
O IA 4.4.4.4 [110/66] via 12.1.1.1, 00:38:39, Serial1/014.0.0.0/24 is subnetted, 1 subnets
O IA 14.1.1.0 [110/65] via 12.1.1.1, 00:38:39, Serial1/0检查R3的路由表:
R3#show ip route ospf 1.0.0.0/32 is subnetted, 1 subnets
O IA 1.1.1.1 [110/129] via 23.1.1.2, 00:38:50, Serial1/12.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/65] via 23.1.1.2, 00:38:50, Serial1/14.0.0.0/32 is subnetted, 1 subnets
O IA 4.4.4.4 [110/130] via 23.1.1.2, 00:38:50, Serial1/112.0.0.0/24 is subnetted, 1 subnets
O IA 12.1.1.0 [110/128] via 23.1.1.2, 00:38:50, Serial1/114.0.0.0/24 is subnetted, 1 subnets
O IA 14.1.1.0 [110/129] via 23.1.1.2, 00:38:50, Serial1/1检查R4的路由表:
R4#show ip route ospf 1.0.0.0/32 is subnetted, 1 subnets
O IA 1.1.1.1 [110/2] via 14.1.1.1, 00:39:30, Serial1/02.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/66] via 14.1.1.1, 00:39:30, Serial1/03.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/130] via 14.1.1.1, 00:39:14, Serial1/023.0.0.0/24 is subnetted, 1 subnets
O IA 23.1.1.0 [110/129] via 14.1.1.1, 00:39:14, Serial1/012.0.0.0/24 is subnetted, 1 subnets
O IA 12.1.1.0 [110/65] via 14.1.1.1, 00:39:30, Serial1/0
能够学习到完整的路由条目。
配置虚链路认证
配置R1:
router ospf 1
area 12 virtual-link 2.2.2.2 authentication message-digestarea 12 virtual-link 2.2.2.2 message-digest-key 1 md5 wisdom配置R2:
router ospf 1area 12 virtual-link 1.1.1.1 authentication message-digestarea 12 virtual-link 1.1.1.1 message-digest-key 1 md5 wisdom检查R1的邻居表:
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 0 FULL/ - - 12.1.1.2 OSPF_VL0
2.2.2.2 0 FULL/ - 00:00:37 12.1.1.2 Serial1/0
4.4.4.4 1 FULL/DR 00:00:34 14.1.1.4 Serial1/1检查R2的邻居表:
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 0 FULL/ - - 12.1.1.1 OSPF_VL0
3.3.3.3 0 FULL/ - 00:00:36 23.1.1.3 Serial1/1
1.1.1.1 0 FULL/ - 00:00:39 12.1.1.1 Serial1/0