详解BSCI实验二、配置ospf验证,汇总,虚链路

实验二、配置ospf验证,汇总,虚链路
 
环境:三台路由器串口相连,其它接口配置如图
要求: 1. area 1配置 ospf虚链路,router-id如图配置
2.将 R1的 LOOP口配置 ospf手工路由汇总
3. 配置ospf接口验证(R1 和R2)
4.使用 show命令查看结果
 详解BSCI实验二、配置ospf验证,汇总,虚链路_第1张图片
 
步骤一: 配置三个路由器接口使其连通。
 
R1的配置
R1(config)# interface Loopback0
R1(config-if)# ip address 30.1.1.1 255.255.255.0
R1(config)# interface Loopback1
R1(config-if)# ip address 30.1.2.1 255.255.255.0
R1(config)# interface Loopback2
R1(config-if)# ip address 30.1.3.1 255.255.255.0
R1(config)# interface s0
R1(config-if)# ip address 10.1.1 .1 255.255.255.0
R1(config-if)#no shutdown
 
R2的配置
R2(config)# interface Loopback0
R2(config-if)# ip address 50.1.1.1 255.255.255.0
R2(config)# interface s0
R2(config-if)# ip address 10.1.1 .2 255.255.255.0
R2(config-if)#clockrate 64000
R2(config-if)#no shutdown
R2(config)# interface s1
R2(config-if)# ip address 20.1.1 .1 255.255.255.0
R2(config-if)#no shutdown
 
R3的配置
R3(config)# interface Loopback0
R3(config-if)# ip address 40.1.1.1 255.255.255.0
R3(config)# interface s1
R3(config-if)# ip address 20.1.1 .2 255.255.255.0
R3(config-if)#clockrate 64000
R3(config)#no shutdown
 
 
步骤二: 配置ospf
 
R1的配置
R1(config)#router ospf 1  à启用 ospf协议,进程号为 1
R1(config-router)#router-id 1.1.1 .1  à配置 router-id
R1(config-router)#network 10.1.1 .0 0.0.0.255 area 1  à将接口参与到区域 1内
R1(config-router)#network 30.1.1.0 0.0.0 .255 area 0  à将接口参与到区域 0内
R1(config-router)#network 30.1.2.0 0.0.0 .255 area 0
R1(config-router)#network 30.1.3.0 0.0.0 .255 area 0
 
R2的配置
R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2 .2
R2(config-router)#network 10.1.1 .0 0.0.0.255 area 1
R2(config-router)#network 20.1.1 .0 0.0.0.255 area 2  à将接口参与到区域 2内
R2(config-router)#network 50.1.1.0 0.0.0 .255 area 1
 
R3的配置
R3(config)#router ospf 2
R3(config-router)#router-id 3.3.3 .3
R3(config-router)#network 20.1.1 .0 0.0.0.255 area 2
R3(config-router)#network 40.1.1.0 0.0.0 .255 area 2
 
 
步骤三: 配置ospf虚链路
 
R1的配置
R1(config)#router ospf 1
R1(config-router)# area 1 virtual-link 2.2.2 .2 à配置虚电路 ,指对端的 router-id
 
R2的配置
R2(config)#router ospf 1
R2(config-router)# area 1 virtual-link 1.1.1 .1
 
 
步骤四: 配置ospf手工路由汇总
 
R1的配置
R1(config)#router ospf 1
R1(config-router)# area 0 range 30.1.0.0 255.255.252.0  à手工汇总路由
 
R2的配置
R2(config)#router ospf 1
R2(config-router)# area 0 range 30.1.0.0 255.255.252.0  à因你的区域 0已经延伸到此
 
 
步骤五: 配置ospf接口验证(R1 和R2)
 
R1的配置
R1(config)# interface Serial0
R1(config-if)# ip ospf authentication message-digest  à启用验证
R1(config-if)# ip ospf message-digest-key 1 md5 cisco à定义密钥
 
R2的配置
R2(config)# interface Serial0
R2(config-if)# ip ospf authentication message-digest
R2(config-if)# ip ospf message-digest-key 1 md5 cisco  à两端必须一致
 
 
步骤六:查看路由表
 
R1#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       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
 
     50.0.0.0/32 is subnetted, 1 subnets
O       50.1.1.1 [110/65] vi a 10.1.1 .2, 00:09:41, Serial0  à OSPF域内学来的路由条目
     20.0.0 .0/24 is subnetted, 1 subnets
O IA    20.1.1 .0 [110/128] vi a 10.1.1 .2, 00:09:31, Serial0  à OSPF域间学来的路由条目
     40.0.0.0/32 is subnetted, 1 subnets
O IA    40.1.1.1 [110/129] vi a 10.1.1 .2, 00:09:31, Serial0
     10.0.0 .0/24 is subnetted, 1 subnets
C       10.1.1 .0 is directly connected, Serial0
     30.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C       30.1.3.0/24 is directly connected, Loopback2
C       30.1.2.0/24 is directly connected, Loopback1
C       30.1.1.0/24 is directly connected, Loopback0
O       30.1.0.0/22 is a summary, 00:09:32, Null0  à手工汇总的条目
 
R2#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       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
 
     50.0.0.0/24 is subnetted, 1 subnets
C       50.1.1.0 is directly connected, Loopback0
     20.0.0 .0/24 is subnetted, 1 subnets
C       20.1.1 .0 is directly connected, Serial1
     40.0.0.0/32 is subnetted, 1 subnets
O       40.1.1.1 [110/65] vi a 20.1.1 .2, 00:04:48, Serial1
     10.0.0 .0/24 is subnetted, 1 subnets
C       10.1.1 .0 is directly connected, Serial0
     30.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
O       30.1.2.1/32 [110/65] vi a 10.1.1 .1, 00:04:38, Serial0
O       30.1.3.1/32 [110/65] vi a 10.1.1 .1, 00:04:39, Serial0
O       30.1.0.0/22 is a summary, 00:04:39, Null0
O       30.1.1.1/32 [110/65] vi a 10.1.1 .1, 00:04:39, Serial0
 
R3#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       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
 
     50.0.0.0/32 is subnetted, 1 subnets
O IA    50.1.1.1 [110/65] vi a 20.1.1 .1, 00:02:02, Serial1
     20.0.0 .0/24 is subnetted, 1 subnets
C       20.1.1 .0 is directly connected, Serial1
     40.0.0.0/24 is subnetted, 1 subnets
C       40.1.1.0 is directly connected, Loopback0
     10.0.0 .0/24 is subnetted, 1 subnets
O IA    10.1.1 .0 [110/128] vi a 20.1.1 .1, 00:02:02, Serial1
     30.0.0.0/22 is subnetted, 1 subnets
O IA    30.1.0.0 [110/129] vi a 20.1.1 .1, 00:01:47, Serial1
 
 
步骤七:查看邻居表
 
R1#show ip ospf neighbor  à邻居已建立,点对点无 DR之说
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2 .2           1   FULL/  -        00:00:33    10.1.1 .2        Serial0
 
R2#show ip ospf neighbor
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1 .1           1   FULL/  -        00:00:33    10.1.1 .1        Serial0
3.3.3 .3           1   FULL/  -        00:00:34    20.1.1 .2        Serial1
 
R3#show ip ospf neighbor
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2 .2           1   FULL/  -        00:00:37    20.1.1 .1        Serial1
 
 
步骤八:用ping命令测试
 
R1#ping 40.1.1.1 à测试连通性
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 56/60/68 ms
 
R1#ping 50.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/32/36 ms
 
R2#ping 30.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/32/32 ms
 
 
 
步骤九:显示当前配置信息
 
R1的配置信息
R1#sh run
hostname R1
!
interface Loopback0
 ip address 30.1.1.1 255.255.255.0
!
interface Loopback1
 ip address 30.1.2.1 255.255.255.0
!
interface Loopback2
 ip address 30.1.3.1 255.255.255.0
!
interface Serial0
 ip address 10.1.1 .1 255.255.255.0
 ip ospf authentication message-digest
 ip ospf message-digest-key 1 md5 cisco
!
router ospf 1
 router-id 1.1.1 .1
area 0 range 30.1.0.0 255.255.252.0
 area 1 virtual-link 2.2.2 .2
 network 10.1.1 .0 0.0.0.255 area 1
 network 30.1.1.0 0.0.0 .255 area 0
 network 30.1.2.0 0.0.0 .255 area 0
 network 30.1.3.0 0.0.0 .255 area 0
end
 
R2#sh run
hostname R2
interface Loopback0
 ip address 50.1.1.1 255.255.255.0
!
interface Serial0
 ip address 10.1.1 .2 255.255.255.0
 ip ospf authentication message-digest
 ip ospf message-digest-key 1 md5 cisco
 clockrate 64000
!
interface Serial1
 ip address 20.1.1 .1 255.255.255.0
!
router ospf 1
 router-id 2.2.2 .2
 area 0 range 30.1.0.0 255.255.252.0
 area 1 virtual-link 1.1.1 .1
 network 10.1.1 .0 0.0.0.255 area 1
 network 20.1.1 .0 0.0.0.255 area 2
 network 50.1.1.0 0.0.0 .255 area 1
end
 
R3#sh run
Hostname R3
!
interface Loopback0
 ip address 40.1.1.1 255.255.255.0
!
interface Serial1
 ip address 20.1.1 .2 255.255.255.0
 clockrate 64000
!
router ospf 2
 router-id 3.3.3 .3
 network 20.1.1 .0 0.0.0.255 area 2
 network 40.1.1.0 0.0.0 .255 area 2
end
本文出自 51CTO.COM技术博客

你可能感兴趣的:(实验,ccnp,ospf,BSCI)