OSPF路由重分发及虚拟链路

网友投稿 360 2022-11-06

OSPF路由重分发及虚拟链路

路由重分发

理解路由重分发

一个单一IP路由协议是管理网络中IP路由的首选方案 每个路由协议和该路由协议所服务的网络属于同一个自制系统 使用路由重分发特性以交换由不同协议创建的路由信息

路由重分发的考虑

度量值 管理距离(优先级)

重分发到OSPF域中路由的路径类型

类型1的外部路径(Type 1 external path,E1) 类型2的外部路径(Type 2 external path,E2)::: hljs-center

:::

配置命令

[Huawei]rip 1 [Huawei-rip-1]version 2 [Huawei-rip-1]undo summary [Huawei-rip-1]network 192.168.60.0 [Huawei-rip-1]import-route ospf 1 cost 3 ###把OSPF协议注入到Rip进行路由重分发,路径类型缺省为路径类型2(外部开销),成本开销为3(对于Rip的度量值为跳数),Rip中重分发OSPF需要指定cost值 [Huawei-rip-1]q [Huawei]ospf 1 [Huawei-ospf-1]import-route rip 1 type 1 cost 1 ###把Rip协议注入到OSPF进行路由重分发,使用路径1(内部开销+外部开销),成本开销为1 [Huawei-ospf-1]default-route-advertise always ###OSPF重分发默认路由 [Huawei-ospf-1]import-route direct ###OSPF重分发直连路由 [Huawei-ospf-1]import-route static ###OSPF重分发静态路由

NSSA区域

NSSA

NSSA区域是OSPF RFC的补遗

定义了特殊的LSA类型7 提供了类似stub area和totally stubby area的优点 可以包含ASBR NSSA的配置 [Huawei]ospf 1 [Huawei-ospf-1]area 2 [Huawei-ospf-1-area-0.0.0.2]network 12.0.0.0 0.0.0.255 ###先宣告直连网段,再配 [Huawei-ospf-1-area-0.0.0.2]nssa 每一种区域允许泛红的类型 ::: hljs-center

::: hljs-center

区域类型 1&2 3 4&5 7
骨干区域(区域0)       允许              允许              允许              不允许   &nbnbsp; 
非骨干区域,非末梢区域 允许 允许 允许 不允许
末梢区域 允许 允许 不允许 不允许
完全末梢区域 允许 不允许* 不允许
NSSA 允许 允许 不允许 允许

:::

:::完全末梢区域的LSA3的不允许*是因为只允许LSA3的一条默认路由,其他不允许。

OSPF路径

路径类型

区域间路径 区域外路径 类型1的外部路径 类型2的外部路径

路径类型的优先级

::: hljs-center

类型 优先级
                    区域内路径                                             优先级1                        
区域间路径 优先级2
类型1的外部路径 优先级3
类型2的外部路径 优先级4

:::注:优先级1~4,1为最高,4为最低路由表添加路由条目时,如果网段相同,就挑选优先级高的路由条目添加到路由表中

OSPF路径汇总

地址汇总作用

地址汇总也是通过减少泛洪的LSA数量的节省资源 可以通过屏蔽一些网络不稳定的细节来节省资源 减少路由表中的路由条目 配置命令 ABR配置 [Huawei]ospf 1 [Huawei-ospf-1]area 1 [Huawei-ospf-1]abr-summary 192.168.0.0 255.255.248.0 ASBR配置 [Huawei]ospf 1 [Huawei-ospf-1]area 1 [Huawei-ospf-1]asbr-summary 10.0.0.0 255.248.0.0

OSPF虚链路

虚链路

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

虚链路的目的

通过一个非骨干区域连接一个区域到骨干区域 通过一个非骨干区域连接一个分段的骨干区域两边的部分区域

配置虚链路的规则和特点

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

配置命令

###在被穿越的非骨干区域的两端ABR配置虚链路 [R1]ospf 1 [R1-ospf-1]area 1 [R1-ospf-1-area-0.0.0.1]vlink-peer 1.1.1.1 ###互相指定被穿越区域两端的ABR的路由ID [R2]ospf 1 [R2-ospf-1]area 1 [R2-ospf-1-area-0.0.0.1]vlink-peer 2.2.2.2 [R1]display ospf vlink ###查看本地上通过 虚链路建立的OSPF 邻居关系

实验操作

::: hljs-center

:::命令R1

u t m Info: Current terminal monitor is off. sys Enter system view, return user view with Ctrl+Z. [Huawei]un in en Info: Information center is disabled. [Huawei]sys R1 [R1]int g0/0/0 [R1-GigabitEthernet0/0/0]ip add 192.168.10.1 24 [R1-GigabitEthernet0/0/0]int loop0 [R1-LoopBack0]ip add 1.1.1.1 32 [R1-LoopBack0]q [R1]ip rou [R1]ip route- [R1]ip route-static 0.0.0.0 0 192.168.10.2 [R1] Please check whether system data has been changed, and save data in time Configuration console time out, please press any key to log on dis ip rou dis ip routing-table Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 9 Routes : 9 Destination/Mask Proto Pre Cost Flags NextHop Interface 0.0.0.0/0 Static 60 0 RD 192.168.10.2 GigabitEthernet 0/0/0 1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.10.0/24 Direct 0 0 D 192.168.10.1 GigabitEthernet 0/0/0 192.168.10.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.10.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 sa The current configuration will be written to the device. Are you sure to continue? (y/n)[n]:y It will take several minutes to save configuration file, please wait....... Configuration file had been saved successfully Note: The configuration file will take effect after being activated

R2```u t mInfo: Current terminal monitor is off.sysEnter system view, return user view with Ctrl+Z.[Huawei]un in enInfo: Information center is disabled.[Huawei]sys R2[R2]int g0/0/0[R2-GigabitEthernet0/0/0]ip add 192.168.10.2 24[R2-GigabitEthernet0/0/0]int g0/0/1[R2-GigabitEthernet0/0/1]ip add 192.168.20.2 24[R2-GigabitEthernet0/0/1]int loop0[R2-LoopBack0]ip add 2.2.2.2 32[R2-LoopBack0]q[R2]ospf 1[R2-ospf-1]area 1[R2-ospf-1-area-0.0.0.1]net 192.168.20.0 0.0.0.255[R2-ospf-1-area-0.0.0.1]net 2.2.2.2 0.0.0.0[R2-ospf-1-area-0.0.0.1][R2-ospf-1-area-0.0.0.1]q[R2-ospf-1][R2-ospf-1]im [R2-ospf-1]import-route s [R2-ospf-1]import-route static [R2-ospf-1]im [R2-ospf-1]import-route d [R2-ospf-1]import-route direct [R2-ospf-1]q[R2]ip rou [R2]ip route- [R2]ip route-static 1.1.1.1 32 192.168.10.1[R2]

Please check whether system data has been changed, and save data in time

Configuration console time out, please press any key to log on

saThe current configuration will be written to the device. Are you sure to continue? (y/n)[n]:yIt will take several minutes to save configuration file, please wait.......Configuration file had been saved successfullyNote: The configuration file will take effect after being activated

**R3** ```u t m Info: Current terminal monitor is off. sys Enter system view, return user view with Ctrl+Z. [Huawei]un in en Info: Information center is disabled. [Huawei]sys R3 [R3]int g0/0/1 [R3-GigabitEthernet0/0/1]ip add 192.168.20.3 24 [R3-GigabitEthernet0/0/1]int g0/0/0 [R3-GigabitEthernet0/0/0]ip add 192.168.30.3 24 [R3-GigabitEthernet0/0/0]int g0/0/2 [R3-GigabitEthernet0/0/2]ip add 192.168.40.3 24 [R3-GigabitEthernet0/0/2]int loop0 [R3-LoopBack0]ip add 3.3.3.3 32 [R3-LoopBack0]q [R3]ospf 1 [R3-ospf-1]area 0 [R3-ospf-1-area-0.0.0.0]net 192.168.30.0 0.0.0.255 [R3-ospf-1-area-0.0.0.0]net 3.3.3.3 0.0.0.0 [R3-ospf-1-area-0.0.0.0]q [R3-ospf-1]area 1 [R3-ospf-1-area-0.0.0.1]net 192.168.20.0 0.0.0.255 [R3-ospf-1-area-0.0.0.1]q [R3-ospf-1]de [R3-ospf-1]default- [R3-ospf-1]default-route- [R3-ospf-1]default-route-advertise a [R3-ospf-1]default-route-advertise always [R3-ospf-1]im [R3-ospf-1]import-route d [R3-ospf-1]import-route direct [R3-ospf-1]ip route- [R3-ospf-1]ip rou [R3-ospf-1]q [R3]ip rou [R3]ip route- [R3]ip route-static 0.0.0.0 0 192.168.40.5 [R3] Please check whether system data has been changed, and save data in time Configuration console time out, please press any key to log on dis ip ro dis ip routing-table Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 21 Routes : 21 Destination/Mask Proto Pre Cost Flags NextHop Interface 0.0.0.0/0 Static 60 0 RD 192.168.40.5 GigabitEthernet 0/0/2 1.1.1.1/32 O_ASE 150 1 D 192.168.20.2 GigabitEthernet 0/0/1 2.2.2.2/32 OSPF 10 1 D 192.168.20.2 GigabitEthernet 0/0/1 3.3.3.3/32 Direct 0 0 D 127.0.0.1 LoopBack0 4.4.4.4/32 OSPF 10 1 D 192.168.30.4 GigabitEthernet 0/0/0 6.6.6.6/32 O_ASE 150 2 D 192.168.30.4 GigabitEthernet 0/0/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.10.0/24 O_ASE 150 1 D 192.168.20.2 GigabitEthernet 0/0/1 192.168.20.0/24 Direct 0 0 D 192.168.20.3 GigabitEthernet 0/0/1 192.168.20.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 192.168.20.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 192.168.30.0/24 Direct 0 0 D 192.168.30.3 GigabitEthernet 0/0/0 192.168.30.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.30.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.40.0/24 Direct 0 0 D 192.168.40.3 GigabitEthernet 0/0/2 192.168.40.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/2 192.168.40.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/2 192.168.50.0/24 O_ASE 150 1 D 192.168.30.4 GigabitEthernet 0/0/0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 sa The current configuration will be written to the device. Are you sure to continue? (y/n)[n]:y It will take several minutes to save configuration file, please wait....... Configuration file had been saved successfully Note: The configuration file will take effect after being activated

R4```u t mInfo: Current terminal monitor is off.sysEnter system view, return user view with Ctrl+Z.[Huawei]un in enInfo: Information center is disabled.[Huawei]sys [Huawei]sysname R4[R4]int g0/0/0[R4-GigabitEthernet0/0/0]ip add 192.168.30.4 24[R4-GigabitEthernet0/0/0]int g0/0/1[R4-GigabitEthernet0/0/1]ip add 192.168.50.4 24[R4-GigabitEthernet0/0/1]int loop0[R4-LoopBack0]ip add 4.4.4.4 32[R4-LoopBack0]q[R4]ospf 1[R4-ospf-1]area 0[R4-ospf-1-area-0.0.0.0]net 192.168.30.0 0.0.0.255[R4-ospf-1-area-0.0.0.0]net 4.4.4.4 0.0.0.0[R4-ospf-1-area-0.0.0.0]q[R4-ospf-1]q[R4]rip 1[R4-rip-1]v 2[R4-rip-1]un su[R4-rip-1]net 192.168.50.0[R4-rip-1]net 4.0.0.0[R4-rip-1]im [R4-rip-1]import-route o [R4-rip-1]import-route ospf 1 c [R4-rip-1]import-route ospf 1 cost 3[R4-rip-1]q[R4]ospf 1[R4-ospf-1][R4-ospf-1]im [R4-ospf-1]import-route r [R4-ospf-1]import-route rip 1 t [R4-ospf-1]import-route rip 1 ty [R4-ospf-1]import-route rip 1 type 1 c [R4-ospf-1]import-route rip 1 type 1 cost 1[R4-ospf-1]im [R4-ospf-1]import-route d [R4-ospf-1]import-route direct [R4-ospf-1]q[R4]rip 1[R4-rip-1]defa [R4-rip-1]default-r [R4-rip-1]default-route o [R4-rip-1]default-route originate [R4-rip-1]

Please check whether system data has been changed, and save data in time

Configuration console time out, please press any key to log on

saThe current configuration will be written to the device. Are you sure to continue? (y/n)[n]:yIt will take several minutes to save configuration file, please wait.......Configuration file had been saved successfullyNote: The configuration file will take effect after being activated

**R5** ```u t m Info: Current terminal monitor is off. sys Enter system view, return user view with Ctrl+Z. [Huawei]un in en Info: Information center is disabled. [Huawei]sys R5 [R5]int g0/0/0 [R5-GigabitEthernet0/0/0]ip add 192.168.40.5 24 [R5-GigabitEthernet0/0/0]int loop0 [R5-LoopBack0]ip add 5.5.5.5 32 [R5-LoopBack0]q [R5]ip rou [R5]ip route- [R5]ip route-static 0.0.0.0 192.168.40.3 ^ Error:Incomplete command found at '^' position. [R5]ip route-static 0.0.0.0 0 192.168.40.3 [R5] Please check whether system data has been changed, and save data in time Configuration console time out, please press any key to log on sa The current configuration will be written to the device. Are you sure to continue? (y/n)[n]:y It will take several minutes to save configuration file, please wait....... Configuration file had been saved successfully Note: The configuration file will take effect after being activated

R6```u t mInfo: Current terminal monitor is off.sysEnter system view, return user view with Ctrl+Z.[Huawei]un in enInfo: Information center is disabled.[Huawei]sys R6[R6]int g0/0/0[R6-GigabitEthernet0/0/0]ip add 192.168.50.6 24[R6-GigabitEthernet0/0/0]int loop0[R6-LoopBack0]ip add 6.6.6.6 32[R6-LoopBack0]q[R6]rip 1[R6-rip-1]v 2[R6-rip-1]un su[R6-rip-1]net 1992.168.50.0^Error: Wrong parameter found at '^' position.[R6-rip-1]net 192.168.50.0[R6-rip-1]net 6.0.0.0[R6-rip-1]

Please check whether system data has been changed, and save data in time

Configuration console time out, please press any key to log on

saThe current configuration will be written to the device. Are you sure to continue? (y/n)[n]:yIt will take several minutes to save configuration file, please wait.......Configuration file had been saved successfullyNote: The configuration file will take effect after being activated

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Mybatis如何使用正则模糊匹配多个数据
下一篇:基于单片机89C51的异步串行接口键盘设计
相关文章

 发表评论

暂时没有评论,来抢沙发吧~