当前位置:网站首页>路由策略
路由策略
2022-08-02 00:04:00 【Co_ml】
二、进行多点双向重发布、重发布直连
完成该环境应先将R7环回重发布进OSPF环境,再在R2、R3上进行双向重发布;
此时在OSPF环境中,到R7环回的路由到R4上会分别发给R2、R3,此时该路由的优先级为150;
进入RIP环境中,该路由优先级变成100,假设从R2进入从R3出来,再进入OSPF环境,此时R4会学到两条R7环回的路由(R5,R3),他们的优先级都为150;
因为,R3根据优先级会选择由R1学习到的7.7.7.0/24(100)环回路由,会刷新掉由R4学习到的7.7.7.0/24(150)环回路由,此时再重发布给R4;
但是由R5传给R4的路由度量为3,所以R4会选择R3给他的R7环回的路由(度量为1),此时到R4到R7会形成环路;
当该路由由R4传给R5时,该路由度量为2(种子度量+1),R5通过OSPF学习到R7环回的度量也是2,且优先级都为150,此时R5到R7环回会负载均衡;
此时需要合理利用路由策略解决选路不佳,以及环路问题。
先将R7的环回进行重发布
[r7-ospf-1]import-route direct
再将R3、R2双向重发布,此处列举R2的配置
[r2-ospf-1]import-route rip
[r2-rip-1]import-route ospf
三、路由回馈
由于由OSPF学习到的R3环回路由它的掩码是32优先级为10,经由重发布进入RIP环境,R2会学到两条关于R3环回的路由(一个掩码32,一个掩码24),但是由RIP学习的路由的优先级为100,所以它会选择相信由OSPF学习到的那条路由,再传给R1,结果是R1到R3环回就会走12.1.1.0 网段,选路不佳。
解决办法:
1、将R3环回的接口网络类型改为broadcast
2、将该环回接口的掩码改为32
此处选择方法1,执行后R2路由表里就只会有R3环回OSPF的路由
[r3]int loop 0
[r3-LoopBack0]ospf network-type broadcast
3.3.3.0/24 OSPF 10 2 D 24.1.1.2 GigabitEthernet0/0/1
四、解决环路
思路在于如何处理RIP环境中通过重发布OSPF进来的7.7.7.0/24路由;
解决办法:
1、令R3不学习由R1传给它的7.7.7.0/24路由:
使用前缀列表在R3上拒绝7.7.7.0/24网段,但是若R3-R4的物理链路出现故障无法连接,R3就无法到达7.7.7.0/24,没有了备用路线。
2、令R3从R1学习到的7.7.7.0/24路由的优先级大于由R4学习到的7.7.7.0/24路由(150)
这样R3就会选择相信由R4传给它的7.7.7.0/24路由,解决掉环路,且有备份线路
使用方法2:
[r3]ip ip-prefix hh permit 7.7.7.0 24
****创建前缀列表用于抓取7.7.7.0/24网段
[r3]route-policy hh permit node 10
Info: New Sequence of this List.
****创建路由策略
[r3-route-policy]if-match ip-prefix hh
****选中前缀列表
[r3-route-policy]apply preference 151
****执行将该前缀列表抓取到的路由的优先级改为151
[r3-rip-1]preference route-policy hh
****在RIP中调用该路由策略
再来查看R3关于7.7.7.0/24的路由表
[r3-rip-1]dis ip ro
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 24 Routes : 24
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.0/24 RIP 2 1 D 13.1.1.1 GigabitEthernet0/0/1
2.2.2.0/24 RIP 2 2 D 13.1.1.1 GigabitEthernet0/0/1
3.3.3.0/24 Direct 0 0 D 3.3.3.3 LoopBack0
3.3.3.3/32 Direct 0 0 D 127.0.0.1 LoopBack0
3.3.3.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
4.4.4.4/32 OSPF 10 1 D 34.1.1.2 GigabitEthernet0/0/2
5.5.5.5/32 OSPF 10 2 D 34.1.1.2 GigabitEthernet0/0/2
6.6.6.6/32 OSPF 10 3 D 34.1.1.2 GigabitEthernet0/0/2
7.7.7.0/24 O_ASE 150 1 D 34.1.1.2 GigabitEthernet0/0/2
环路问题解决
五、解决选路
此时查看R1的路由表,发现R1到OSPF都是负载均衡,显然不合理;
查看R4的路由表,同理此时R4到RIP也都是负载均衡,不合理;
理想状态下:
在RIP中:
R1到R3环回和34.1.1.0/24应该是走13.1.1.0/24
R1到24.1.1.0/24应该是走12.1.1.0/24
R1到其他网段都是负载均衡
在OSPF中:
R4到R3环回和13.1.1.0/24应该走34.1.1.0/24
R4到12.1.1.0/24应该走24.1.1.0/24
R4到R1环回负载均衡
解决办法:
1、RIP中:
使用偏移列表改变它的度量
[r2]ip ip-prefix xx permit 3.3.3.0 24
[r2]ip ip-prefix xx permit 34.1.1.0 24
****抓取
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]rip metricout ip-prefix xx 2
****进入接口调用该前缀列表,并将它的度量+2,这样该选路就会成为备用选路
[r3]ip ip-prefix xx permit 24.1.1.0 24
[r3]int g0/0/1
[r3-GigabitEthernet0/0/1]rip metricout ip-prefix xx 2
2、OSPF中:
改变cost-type
[r2]ip ip-prefix haha permit 12.1.1.0 24
[r2]ip ip-prefix haha permit 2.2.2.0 24
****使用前缀列表抓取网段
[r2]route-policy haha permit node 10
Info: New Sequence of this List.
****创建路由策略
[r2-route-policy]if-match ip-prefix haha
[r2-route-policy]apply cost-type type-1
****将选中网段的路由的cost-type改为type-1
****因为默认重发布的路由的cost-type为type-2
****type-1的优先级大于type-2
****所以OSPF会将type-2的路线作为备用选路
[r2-route-policy]q
[r2]route-policy haha permit node 20
Info: New Sequence of this List.
****创建一个空表,允许所有
[r2-ospf-1]import-route rip route-policy haha
****在ospf中调用该路由策略
[r3]ip ip-prefix haha permit 13.1.1.0 24
[r3]route-policy haha permit node 10
Info: New Sequence of this List.
[r3-route-policy]if-match ip-prefix haha
[r3-route-policy]apply cost-type type-1
[r3-route-policy]q
[r3]route-policy haha permit node 20
Info: New Sequence of this List.
[r3-ospf-1]import-route rip route-policy haha
边栏推荐
猜你喜欢
【21天学习挑战赛】顺序查找和二分查找的小总结
contentEditable属性
认识USB、Type-C、闪电、雷电接口
DVWA靶场环境搭建
How to get the best power efficiency in Windows 11?
Short video SEO search operation customer acquisition system function introduction
OpenCV DNN blogFromImage() detailed explanation
[Three sons] C language implements simple three sons
多御安全浏览器android版更新至1.7,改进加密协议
当奈飞的NFT忘记了Web2的业务安全
随机推荐
async和await用法介绍
els block deformation
Win11如何获得最佳电源效率?
Detailed explanation of Zadig's self-testing and tuning environment technical solution for developers
JSP out.write()方法具有什么功能呢?
An overview of the most useful DeFi tools
如何优雅的消除系统重复代码
[Headline] Written test questions - minimum stack
Artifact XXXwar exploded Artifact is being deployed, please wait...(已解决)
微软电脑管家V2.1公测版正式发布
els block deformation judgment.
尚硅谷MySQL学习笔记
【Leetcode】1206. Design Skiplist
How to solve the error when mysql8 installs make
IP Core: FIFO
How to get the best power efficiency in Windows 11?
What is it like to trade for a living?
async/await 原理及执行顺序分析
面试必问的HashCode技术内幕
TCP 可靠吗?为什么?