OSPF虚链路(实验可跟做)
admin
2023-01-21 13:01:07
0

OSPF虚链路

虚链路:

1.指一条通过一个非骨干区域连接到骨干区域的链路

虚链路的目的:

1.通过一个非骨干区域连接一个区域到骨干区域
2.通过一个非骨干区域连接一个分段的骨干区域

配置虚链路的规则及特点:

1.虚链路必须配置在两台ABR路由器之间
2.传送区域不能是一个末梢区域
3.虚链路的稳定性取决于其经过的区域的稳定性
4.虚链路有助于提供逻辑冗余

虚链路的配置命令:

Router(config-router)#area area-id vritual-link router-id

虚链路配置实验:(GNS3中拓扑图如下)

OSPF虚链路(实验可跟做)

实验环境准备:GNS3及与之相连的CRT

1.打开GNS3后我们需要拖出四个路由器,两台PC机
2.其中area0为骨干区域,area1和area2为标准区域
3.R2为ABR

OSPF中的虚链路就是我们通过非骨干区域打一条通道直接连接area0的骨干区域,就犹如图中的area2如果要和area0直接相连的话,那么这条链路的稳定性就取决于area1的稳定性,如果area1不够稳定那么这条链路也是不稳定的。接下来我们就来看看虚链路的操作方法。

第一步:先对路由进行地址配置及宣告网段:

R1:

R1#conf t
R1(config)#int f0/0 
R1(config-if)#ip add 192.168.10.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int f0/1
R1(config-if)#ip add 192.168.20.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#ex
R1(config)#int lo 0
R1(config-if)#ip add 1.1.1.1 255.255.255.255
R1(config-if)#no shut
R1(config-if)#ex 
R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 192.168.10.0 0.0.0.255 area 2
R1(config-router)#network 192.168.20.0 0.0.0.255 area 2

R2:

R2#conf t
R2(config)#int f0/0
R2(config-if)#ip add 192.168.20.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int f0/1
R2(config-if)#ip add 192.168.30.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#ex
R2(config)#int lo 0
R2(config-if)#ip add 2.2.2.2 255.255.255.255 
R2(config-if)#no shut
R2(config-if)#ex
R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 192.168.20.0 0.0.0.255 area 2
R2(config-router)#network 192.168.30.0 0.0.0.255 area 1
R2(config-router)#ex
注意:此处为达到实验效果,暂时先不配置虚链路!!!

R3:

R3#conf t 
R3(config)#int f0/0
R3(config-if)#ip add 192.168.30.2 255.255.255.0
R3(config-if)#no shut
R3(config-if)#int f0/1
R3(config-if)#ip add 192.168.40.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#ex
R3(config)#int lo 0
R3(config-if)#ip add 3.3.3.3 255.255.255.255 
R3(config-if)#no shut
R3(config-if)#ex
R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 192.168.30.0 0.0.0.255 area 1
R3(config-router)#network 192.168.40.0 0.0.0.255 area 0

R4:

R4#conf t
R4(config)#int f0/0
R4(config-if)#ip add 192.168.40.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#int f0/1
R4(config-if)#ip add 192.168.50.1 255.255.255.0
R4(config-if)#no shut
R4(config-if)#ex
R4(config)#int lo 0
R4(config-if)#ip add 4.4.4.4 255.255.255.255
R4(config-if)#no shut
R4(config-if)#ex
R4(config)#router ospf 1                    
R4(config-router)#router-id 4.4.4.4
R4(config-router)#network 192.168.40.0 0.0.0.255 area 0
R4(config-router)#network 192.168.50.0 0.0.0.255 area 0

第二步:检查各路由器之间有没有相互学习到网段:

R1:

R1(config)#do show ip route
.....此处省略部分
     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
C    192.168.10.0/24 is directly connected, FastEthernet0/0
C    192.168.20.0/24 is directly connected, FastEthernet0/1

R2:

R2(config)#do show ip route
.....此处省略部分
     2.0.0.0/32 is subnetted, 1 subnets
C       2.2.2.2 is directly connected, Loopback0
C    192.168.30.0/24 is directly connected, FastEthernet0/1
O    192.168.10.0/24 [110/20] via 192.168.20.1, 00:15:57, FastEthernet0/0
O IA 192.168.40.0/24 [110/20] via 192.168.30.2, 00:08:28, FastEthernet0/1
C    192.168.20.0/24 is directly connected, FastEthernet0/0
O IA 192.168.50.0/24 [110/30] via 192.168.30.2, 00:03:29, FastEthernet0/1

R3:

R3(config)#do show ip route
.....此处省略部分
     3.0.0.0/32 is subnetted, 1 subnets
C       3.3.3.3 is directly connected, Loopback0
C    192.168.30.0/24 is directly connected, FastEthernet0/0
C    192.168.40.0/24 is directly connected, FastEthernet0/1
O    192.168.50.0/24 [110/20] via 192.168.40.2, 00:10:35, FastEthernet0/1
注意:因为我们刚刚在R2中没有配置虚链路,所以此时R3是没有学习到area2区域的网段的!!!

R4:

R4(config)#do show ip route 
.....此处省略部分
O IA 192.168.30.0/24 [110/20] via 192.168.40.1, 00:12:42, FastEthernet0/0
     4.0.0.0/32 is subnetted, 1 subnets
C    192.168.40.0/24 is directly connected, FastEthernet0/0
C    192.168.50.0/24 is directly connected, FastEthernet0/1

第三步:进入两台客户机配置IP地址和网关,并测试是否可以ping通:

PC1>ip 192.168.10.2 192.168.10.1
PC2>ip 192.168.50.2 192.168.50.1
PC1> ping 192.168.50.2           
*192.168.10.1 icmp_seq=1 ttl=255 time=19.999 ms (ICMP type:3, code:1, Destination host unreachable)    
此时显示:目标主机不可达,无法连通
所以此时我们就需要做一条虚链路,经过area1区域做这个虚链路
此处需要注意的是,在做虚链路时,写入的router-id是对方的,我们应该如何去操作,请接着看。

第四步:配置虚链路:

回到R2:

R2(config)#router ospf 1
R2(config-router)#area 1 virtual-link 3.3.3.3    //area1为穿越区域,写上R3的router-id

再到R3:

R3(config)#router ospf 1
R3(config-router)#area 1 virtual-link 2.2.2.2    //area1为穿越区域,写上R2的router-id

第五步:回到客户机中查看是否可以ping通:

PC1> ping 192.168.50.2
192.168.50.2 icmp_seq=1 timeout
84 bytes from 192.168.50.2 icmp_seq=2 ttl=60 time=82.984 ms    //显示状态连通

结论:此时在全网互通的情况下每个路由器的路由表学习到的就是链路中所有的网段,这就说明了虚链路的设置可以让与骨干区域相隔的标准区域在非直连状态下与之达成互通。

相关内容

热门资讯

德国总理:美国正在被伊朗羞辱 德国之声4月27日报道,德国总理默茨在访问一所学校时表示,在当前的持续冲突中,伊朗领导层正试图羞辱美...
理响中国|“长”歌以行,风云激... 光阴如梭,东方潮阔。这里是中国的长三角,世界的长三角。无论过去、现在还是未来,这片土地都因时代而生,...
白宫:特朗普及其国安团队开会讨... 新华社华盛顿4月27日电 美国白宫新闻秘书莱维特27日在记者会上证实,总统特朗普及其国家安全团队当天...
人民日报刊文:日本放开杀伤性武... 日本放开杀伤性武器出口推高地缘冲突风险(国际论坛)常思纯《人民日报》(2026年04月28日 第 0...
医疗保障法草案二审:明确生育保... 满足多样化健康保障需求本报记者 彭 波4月27日,医疗保障法草案二审稿提请十四届全国人大常委会第二十...
天津一景区发生自转旋翼机事故1... 澎湃新闻记者 吕新文中国民用航空华北地区管理局4月22日公布《豪客通航“10•1”天津长芦汉盐旅游区...
卡塔尔埃米尔与美国总统特朗普通... 当地时间24日,卡塔尔埃米尔塔米姆与美国总统特朗普通电话,重点就中东地区局势以及伊朗与美国谈判问题交...
男子30年前被扣押2859克黄... 澎湃新闻记者 王鑫家住辽宁省大连市的潘永嘉近日向澎湃新闻反映称,三十年前,他在大连周水子机场被盖州市...
商务部:取消反制欧盟两家金融机... 中华人民共和国商务部令二〇二六年 第1号鉴于欧盟已取消对中国两家金融机构的制裁措施,现公布《关于取消...
过去24小时共有5艘船只通过霍... 总台记者当地时间24日获悉,过去24小时内,共有5艘船只通过霍尔木兹海峡,其中包括一艘伊朗油轮。(总...