静态路由,路由汇总,负载均衡,路由黑洞,浮动路由 您所在的位置:网站首页 静态路由和动态路由优先级谁高 静态路由,路由汇总,负载均衡,路由黑洞,浮动路由

静态路由,路由汇总,负载均衡,路由黑洞,浮动路由

2024-07-07 16:55| 来源: 网络整理| 查看: 265

静态路由 路由汇总 负载均衡 路由黑洞 浮动路由

负载均衡和浮动路由

浮动路由:

路由的优先级数字越小,表示优先级越高

华为路由器默认用逐条选路,五元组(协议,源地址,目标地址,源端口,目标端口)然后通过hash处理后,选出一条合适的路,在路由器上实现自动负载均衡

当到达同一目的地存在同一路由协议发现的多条路由,且这几条路由的开销值也相同时,路由器就会进行负载分担,将流量分摊到多条链路上。

华为负载均衡有两个模式,一个逐流一个是逐包,通过执行ip load-balance packet命令,可以配置流量按照逐包调度的方式进行分流转发,即每条流量都能被分摊到等价路由的所有链路上进行分流转发,减少链路拥塞的发生,实现链路的合理利用。

 

[r1]int s4/0/0 [r1-Serial4/0/0]ip add 10.0.12.1 24 [r1-Serial4/0/0]int s4/0/1 [r1-Serial4/0/1]ip add 10.0.13.1 24 [r1-GigabitEthernet0/0/2]ip add 192.168.10.254 24 [r1]ip route-static 192.168.20.0 24 s4/0/0 10.0.12.2 [r1]ip route-static 192.168.20.0 24 s4/0/1 10.0.13.2 ​ ​ [r2-Serial4/0/0]ip add 10.0.12.2 24 [r2-Serial4/0/0]int s4/0/1 [r2-Serial4/0/1]ip add 10.0.23.1 24 [r2]ip route-static 192.168.20.0 24 s4/0/1 10.0.23.2 [r2]ip route-static 192.168.10.0 24 s4/0/0 10.0.12.1 ​ ​ [r3]int s4/0/0 [r3-Serial4/0/0]ip add 10.0.23.2 24 [r3-Serial4/0/0]int s4/0/1 [r3-Serial4/0/1]ip add 10.0.13.2 24 [r3-Serial4/0/1]int g0/0/2 [r3-GigabitEthernet0/0/2]ip add 192.168.20.254 24 [r3]ip route-static 192.168.10.0 24 s4/0/0 10.0.23.1 [r3]ip route-static 192.168.10.0 24 s4/0/1 10.0.13.1 ​ ​ 浮动路由+负载均衡 [r1]ip route-static 192.168.20.0 24 s4/0/0 10.0.12.2 preference 100 [r3]ip route-static 192.168.10.0 24 s4/0/0 10.0.23.1 preference 100 ​ [r1]ip route-static 192.168.20.0 24 s4/0/0 10.0.12.2 [r3]ip route-static 192.168.10.0 24 10.0.23.1

 

 

 

负载均衡&链路可靠性:

R1: interface GigabitEthernet0/0/0 ip address 192.168.1.254 255.255.255.0 # interface GigabitEthernet0/0/1 ip address 13.1.1.1 255.255.255.0 ip address 13.1.1.1 255.255.255.0 interface GigabitEthernet0/0/2 ip address 12.1.1.1 255.255.255.0 # ip route-static 24.1.1.0 255.255.255.0 12.1.1.2 ip route-static 34.1.1.0 255.255.255.0 13.1.1.2 ip route-static 192.168.2.0 255.255.255.0 12.1.1.2 ip route-static 192.168.2.0 255.255.255.0 13.1.1.2 ​ R2: interface GigabitEthernet0/0/0 ip address 24.1.1.1 255.255.255.0 interface GigabitEthernet0/0/1 ip address 12.1.1.2 255.255.255.0 # ip route-static 192.168.1.0 255.255.255.0 12.1.1.1 ip route-static 192.168.2.0 255.255.255.0 24.1.1.2 ​ R3: interface GigabitEthernet0/0/0 ip address 13.1.1.2 255.255.255.0 interface GigabitEthernet0/0/1 ip address 34.1.1.1 255.255.255.0 # ip route-static 192.168.1.0 255.255.255.0 13.1.1.1 ip route-static 192.168.2.0 255.255.255.0 34.1.1.2 ​ R4: ​ interface GigabitEthernet0/0/0 ip address 34.1.1.2 255.255.255.0 ip address 34.1.1.2 255.255.255.0 interface GigabitEthernet0/0/1 ip address 24.1.1.2 255.255.255.0 interface GigabitEthernet0/0/2 ip address 192.168.2.254 255.255.255.0 ​ ip route-static 12.1.1.0 255.255.255.0 24.1.1.1 ip route-static 13.1.1.0 255.255.255.0 34.1.1.1 ip route-static 192.168.1.0 255.255.255.0 24.1.1.1 ip route-static 192.168.1.0 255.255.255.0 34.1.1.1 ​

关闭R1的g0/0/1 和R4的0/0/0后,

 

这种设计实现负载均衡,减少单个链路上的拥堵,实现流量分担,并且当R2或R3故障后,可以走另一条通路,起到冗余备份作用。

路由汇总和路由黑洞

①配置R1,R2,R3,R4及loopback口 ​ R1: ​ interface Ethernet0/0/0 ip address 13.1.1.1 255.255.255.0 ​ interface LoopBack0 ip address 10.1.1.1 255.255.255.0 ​ ip route-static 10.1.0.0 255.255.255.0 13.1.1.3 ip route-static 34.0.0.0 255.255.255.0 13.1.1.3 ​ ​ R2: ​ interface Ethernet0/0/0 ip address 23.1.1.2 255.255.255.0 interface LoopBack0 ip address 10.1.2.1 255.255.255.0 ​ ip route-static 10.1.0.0 255.255.255.0 23.1.1.3 ip route-static 10.1.1.0 255.255.255.0 23.1.1.3 ip route-static 34.1.1.0 255.255.255.0 23.1.1.3 ​ ​ R3: ​ interface GigabitEthernet0/0/0 ip address 13.1.1.3 255.255.255.0 interface GigabitEthernet0/0/1 ip address 23.1.1.3 255.255.255.0 interface GigabitEthernet0/0/2 ip address 34.1.1.3 255.255.255.0 ​ ip route-static 0.0.0.0 0.0.0.0 34.1.1.4 ip route-static 10.1.0.0 255.255.255.0 34.1.1.4 ip route-static 10.1.1.0 255.255.255.0 13.1.1.1 ip route-static 10.1.2.0 255.255.255.0 23.1.1.1 ​ ​ ​ R4: ​ interface GigabitEthernet0/0/0 ip address 34.1.1.4 255.255.255.0 interface GigabitEthernet0/0/2 interface LoopBack0 ip address 10.1.0.1 255.255.0.0 ip route-static 10.1.1.0 255.255.255.0 34.1.1.3 ip route-static 10.1.2.0 255.255.255.0 34.1.1.3 ip route-static 13.1.1.0 255.255.255.0 34.1.1.3 ip route-static 23.1.1.0 255.255.255.0 34.1.1.3

②断开R2和R3之间的连接线,用R4 路由跟踪R2

[r3-GigabitEthernet0/0/0]shutdown ​ tracert -a 10.1.0.1 10.1.2.1

 

在R3的接口断开之后,当R4上ping 10.1.2.1,R4上会根据第四条路由去R3,到R3后查询第二条路由表之后是到R4的,如此循环往复就出现了环路

③构建静态黑洞路由后结果:

[r3]ip route-static 10.1.0.0 16 NULL 0

 

但是要注意:黑洞路由相当于是出现故障情况下的备用路由,所以可以把该条静态黑洞路由的优先级设置低一点(值大一点),且R2---R3恢复后,可正常通信,不会匹配到路由黑洞,因为黑洞路由的掩码比R2上的网段的路由掩码要短(直连更优)



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有