Cisco-OSPF虚链路

简介: Cisco-OSPF虚链路

前言

网络已经成为了我们生活中不可或缺的一部分,它连接了世界各地的人们,让信息和资源得以自由流动。随着互联网的发展,我们可以通过网络学习、工作、娱乐,甚至是社交。因此,学习网络知识和技能已经成为了每个人都需要掌握的重要能力。

本课程博主将带领读者深入了解网络的基本原理、结构和运作方式,帮助读者建立起对网络的全面理解。我们将介绍网络的发展历程、网络的分类和组成、网络的安全和隐私保护等内容,帮助读者掌握网络知识,提高网络素养。

通过学习本篇博客,读者将能够更好地利用网络资源,提高工作效率,拓展人际关系,甚至是保护自己的网络安全。网络世界充满了无限的可能,希望本课程能够帮助读者更好地驾驭网络,享受网络带来的便利和乐趣。


一、什么是OSPF虚链路?

在OSPF(开放式最短路径优先)协议中,虚链路是一种特殊的链路,用于连接不能直接通信的两个不同自治系统(AS)。虚链路允许在不改变现有网络拓扑的情况下,OSPF路由器能够跨越多个AS通告路由信息。

在配置虚链路时,需要指定一个虚链路的传输接口,并为该接口指定一个虚拟的网络号(IP地址),这个IP地址将作为目的AS内的一个路由器的直接连接接口的IP地址。


二、实验

1.引入

实验目标

理解OSPF虚链路的原理及功能;

掌握OSPF虚链路的配置方法;

实验背景

你是某公司的网络管理员,公司现在扩展业务,在保证原有网络拓扑的情况下添加新业务(人事部),现在请你帮忙想办法实验这个功能,

一楼是公司总部,二楼是公司业务部,三楼是公司办公室,四楼是公司人事部

技术原理

虚链路技术是Open Shortest Path First (OSPF)路由协议中的一个特性,它允许在不改变网络拓扑的情况下,将一个路由器虚拟接入到另一个区域。

虚链路的工作原理是:在区域边界路由器(ABR)上配置一个目标区域和一个传输区域,ABR会创建一个虚拟接口,用于在这两个区域之间传递路由信息。

实验步骤

新建Packet Tracer拓扑图

(1)公司中的两台路由器与交换机连接,与外网的路由器连接并进行配置公网IP

(2)配置路由器接口IP地址。

(3)验证主机之间的互通性。

实验设备

Route 2811 4台 ,交叉线

实验拓扑图

实验配置

R1,R2,R3,R4基础配置

R1:
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#h R1
R1(config)#int f0/0
R1(config-if)#ip add 10.0.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#route ospf 10
R1(config-router)#net 10.0.1.0 0.0.0.255 area 0
 
R2:
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#h R2
R2(config)#int f0/0
R2(config-if)#ip add 10.0.1.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int f0/1
R2(config-if)#ip add 10.0.2.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#route ospf 10
R2(config-router)#net 10.0.1.0 0.0.0.255 area 0
R2(config-router)#net 10.0.2.0 0.0.0.255 area 1
 
R3:
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#h R3
R3(config)#int f0/0
R3(config-if)#ip add 10.0.2.2 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#int f0/1
R3(config-if)#ip add 10.0.3.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#route ospf 10
R3(config-router)#net 10.0.3.0 0.0.0.255 area 2
R3(config-router)#net 10.0.2.0 0.0.0.255 area 1
 
R4:
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#h R4
R4(config)#int f0/0
R4(config-if)#ip add 10.0.3.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#exit
R4(config)#route ospf 10
R4(config-router)#net 10.0.3.0 0.0.0.255 area 2

show ip route R1,R2,R3,R4

R1:
R1(config-router)#do show ip route
Codes: L - local, 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, E - EGP
       i - IS-IS, 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
 
     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C       10.0.1.0/24 is directly connected, FastEthernet0/0
L       10.0.1.1/32 is directly connected, FastEthernet0/0
O IA    10.0.2.0/24 [110/2] via 10.0.1.2, 00:03:01, FastEthernet0/0
 
R2:
R2(config-if)#do show ip route
Codes: L - local, 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, E - EGP
       i - IS-IS, 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
 
     10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C       10.0.1.0/24 is directly connected, FastEthernet0/0
L       10.0.1.2/32 is directly connected, FastEthernet0/0
C       10.0.2.0/24 is directly connected, FastEthernet0/1
L       10.0.2.1/32 is directly connected, FastEthernet0/1
 
R3:
R3(config-router)#do show ip route
Codes: L - local, 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, E - EGP
       i - IS-IS, 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
 
     10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O IA    10.0.1.0/24 [110/2] via 10.0.2.1, 00:02:19, FastEthernet0/0
C       10.0.2.0/24 is directly connected, FastEthernet0/0
L       10.0.2.2/32 is directly connected, FastEthernet0/0
C       10.0.3.0/24 is directly connected, FastEthernet0/1
L       10.0.3.1/32 is directly connected, FastEthernet0/1
 
R4(config)#do show ip route
Codes: L - local, 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, E - EGP
       i - IS-IS, 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
 
     10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       10.0.3.0/24 is directly connected, FastEthernet0/0
L       10.0.3.2/32 is directly connected, FastEthernet0/0
 

可以观察到,R1学不到R3与R4之间的IP,这是因为OSPF中area区域,0是骨干,默认的需要与骨干区域相连才可以学习到相应的IP地址,因此我们引入了OSPF虚链路来帮助我们应对这种问题的发生.

OSPF虚链路的配置

R1:
R1(config)#int loopback 0
R1(config-if)#ip add 1.1.1.1 255.255.255.255
R1(config-if)#exit
R1(config-if)#route ospf 10
R1(config-router)#router-id 1.1.1.1
 
R2:
R2(config)#int loopback 0
R2(config-if)#ip add 2.2.2.2 255.255.255.255
R2(config-if)#exit
R2(config)#route ospf 10
R2(config-router)#router-id 2.2.2.2
R2(config-router)#area 1 virtual-link  3.3.3.3
 
R3:
R3(config)#int loopback 0
R3(config-if)#ip address 3.3.3.3 255.255.255.255
R3(config-if)#exit
R3(config)#route ospf 10
R3(config-router)#router-id 3.3.3.3
R3(config-router)#area 1 vir 2.2.2.2
 
R4:
R4(config)#int loopback 0
R4(config-if)#ip add 4.4.4.4 255.255.255.255
R4(config-if)#exit
R4(config-if)#route ospf 10
R4(config-router)#router-id 4.4.4.4
 
如果没有学习到在特权模式下使用命令
R1#clear ip os p
Reset ALL OSPF processes? [no]: y

R1 Ping R4

观察到可以ping通了

扩展

你是某公司的网络管理员,公司现在扩展业务,在保证原有网络拓扑的情况下添加新业务(人事部),公司突然宣布五楼要加入财务部,希望再添加一层

一楼是公司总部,二楼是公司业务部,三楼是公司办公室,四楼是公司人事部,五楼是公司财务部

实验拓扑图

实验配置

R4,R5基础配置

R4:
R4(config)#int f0/1
R4(config-if)#ip add 10.0.4.1 255.255.255.0
R4(config-if)#exit
R4(config)#route ospf 10
R4(config-router)#net 10.0.4.0 0.0.0.255 area 3
 
R5:
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#h R5
R5(config)#int f0/0
R5(config-if)#no shut
R5(config-if)#ip add 10.0.4.0 255.255.255.0
R5(config-if)#exit
R5(config)#int l 0
R5(config-if)#ip add 5.5.5.5 255.255.255.255
R5(config)#route ospf 10
R5(config-router)#net 10.0.4.0 0.0.0.255 area 3
R5(config-router)#router-id 5.5.5.5

Show ip route R1

R1:
R1#show ip route
Codes: L - local, 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, E - EGP
       i - IS-IS, 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/32 is subnetted, 1 subnets
C       1.1.1.1/32 is directly connected, Loopback0
     10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C       10.0.1.0/24 is directly connected, FastEthernet0/0
L       10.0.1.1/32 is directly connected, FastEthernet0/0
O IA    10.0.2.0/24 [110/2] via 10.0.1.2, 00:13:53, FastEthernet0/0
O IA    10.0.3.0/24 [110/3] via 10.0.1.2, 00:13:43, FastEthernet0/0
O IA    10.0.4.0/24 [110/4] via 10.0.1.2, 00:00:11, FastEthernet0/0

OSPF虚链路的配置

R3:
R3(config)#router ospf 10
R3(config-router)#area 2 vir 4.4.4.4
 
R4:
R4(config)#route ospf 10
R4(config-router)#area 2 vir 3.3.3.3

实验验证

R1 Ping R5


相关文章
|
运维 网络协议 网络架构
路由与交换系列之OSPF在帧中继的配置实践
掌握OSPF在帧中继网络中的配置方法 理解Hub- Spoke组网架构 掌握在帧中继网络中排除OSPF故障的方法
594 0
|
3月前
|
监控 网络协议 网络架构
一文带你了解OSPF虚链路以及配置方法
一文带你了解OSPF虚链路以及配置方法
96 1
一文带你了解OSPF虚链路以及配置方法
|
9月前
|
网络虚拟化
华为eNSP网络配置综合练习一(vlan +MSTP+VLANif+VRRP+ 静态路由+单臂路由+STP+BFD)
华为eNSP网络配置综合练习一(vlan +MSTP+VLANif+VRRP+ 静态路由+单臂路由+STP+BFD)
321 1
|
7月前
|
网络协议 网络架构
以太网链路连接 和 ISIS/OSPF等路由协议关系
以太网链路连接 和 ISIS/OSPF等路由协议关系
70 0
|
网络架构
交换机与路由器技术-29-OSPF虚链路
交换机与路由器技术-29-OSPF虚链路
51 0
|
网络协议 网络虚拟化 网络架构
在华为设备上配置链路聚合和OSPF、RIP
本文通过一个综合实验来介绍如何在华为设备上配置链路聚合、单臂路由、静态路由、动态路由、OSPF和RIP。
在华为设备上配置链路聚合和OSPF、RIP
|
负载均衡 网络协议 数据库
|
网络协议 vr&ar 网络架构