实训目的
- 掌握OSPF虚拟链路配置。
实训背景
OSPF作用
OSPF采用由两层组成的分层结构,因此如果有多个区域,则其中一个必须为区域0,即骨干区域,其他所有区域都与区域0直接相连,且区域0必须是连续的,OSPF要求所有非骨干区域都将路由通告给骨干,以便将这些路由通告到其他区域。
虚链路作用
通过使用虚链路,可以将不连续的区域0连接起来,还可将区域通过中转区域连接到区域0。但是不应将其作为一种主要的骨干设计功能,应只在出现故障后使用OSPF虚链路功能来提供临时连接或备用连接。
实训拓扑

实验所需设备:
设备类型 | 设备型号 | 数量 |
---|---|---|
路由器 | RSR20 | 4 |
实训步骤
步骤1:基本配置。
R1:
Ruijie>enable
Ruijie#configure terminal
Ruijie(config)#hostname R1
R1(config)#
R2:
Ruijie>enable
Ruijie#configure terminal
Ruijie(config)#hostname R2
R2(config)#
R3:
Ruijie>enable
Ruijie#configure terminal
Ruijie(config)#hostname R3
R1(config)#
R4:
Ruijie>enable
Ruijie#configure terminal
Ruijie(config)#hostname R4
R4(config)#
步骤2:全网基本IP地址配置。
R1(config)#interface fastEthernet 0/0
R1(config-if-FastEthernet 0/0)#ip address 192.168.1.1 255.255.255.0
R1(config-if-FastEthernet 0/0)#exit
R1(config)#
R2(config)#interface fastEthernet 0/0
R2(config-if-FastEthernet 0/0)#ip address 192.168.1.2 255.255.255.0
R2(config-if-FastEthernet 0/0)#exit
R2(config)#interface fastEthernet 0/1
R2(config-if-FastEthernet 0/1)#ip address 192.168.2.1 255.255.255.0
R2(config-if-FastEthernet 0/1)#exit
R2(config)#
R3(config)#interface fastEthernet 0/0
R3(config-if-FastEthernet 0/0)#ip address 192.168.3.1 255.255.255.0
R3(config-if-FastEthernet 0/0)#exit
R3(config)#interface fastEthernet 0/1
R3(config-if-FastEthernet 0/1)#ip address 192.168.2.2 255.255.255.0
R3(config-if-FastEthernet 0/1)#exit
R3(config)#
R4(config)#interface fastEthernet 0/0
R4(config-if-FastEthernet 0/0)#ip address 192.168.3.2 255.255.255.0
R4(config-if-FastEthernet 0/0)#exit
R4(config)#
步骤3:启动OSPF,并把对应的接口通告到指定区域。
R1(config)route ospf 1
R1(config-router)#router-id 1.1.1.1
Change router-id and update OSPF process! [yes/no]:yes
R1(config-router)#network 192.168.1.0 0.0.0.255 area 0
R1(config-router)#exit
R1(config)#
R2(config)#route ospf 1
R2(config-router)#router-id 2.2.2.2
Change router-id and update OSPF process! [yes/no]:yes
R2(config-router)#netw 192.168.1.0 0.0.0.255 area 0
R2(config-router)#netw 192.168.2.0 0.0.0.255 area 1
R2(config-router)#exit
R2(config)#
R3(config)#route ospf 1
R3(config-router)#router-id 3.3.3.3
Change router-id and update OSPF process! [yes/no]:yes
R3(config-router)#network 192.168.2.0 0.0.0.255 area 1
R3(config-router)#network 192.168.3.0 0.0.0.255 area 2
R3(config-router)#exit
R3(config)#
R4(config)#route ospf 1
R4(config-router)#router-id 4.4.4.4
Change router-id and update OSPF process! [yes/no]:yes
R4(config-router)#network 192.168.3.0 0.0.0.255 area 2
R4(config-router)#exit
R4(config)#
步骤4:让R2和R3建立ospf虚拟链路。
R2(config)#route ospf 1
R2(config-router)#area 1 virtual-link 3.3.3.3
R2(config-router)#exit
R2(config)#
R3(config)#route ospf 1
R3(config-router)#area 1 virtual-link 2.2.2.2
R3(config-router)#exit
R3(config)#
步骤5:查看R1是否学到192.168.2.0和192.168.3.0的邻居关系。
R1#show ip rotue

步骤6:在R2上查看虚链路的运行状态。
R2#show ip ospf virtual-links

网友评论