静态路由的相关知识:
静态路由的扩展配置:
1、负载均衡 — 当路由器转发流量时,拥有多条开销相似路径时,可以让设备将流量拆分后延多条路径同时传输;
2、环回接口
[r1]interface LoopBack ?
<0-1023> LoopBack interface number
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 1.1.1.1 24
在路由器上创建环回接口,可以和pc的环回网卡一样,用于测试该设备的TCP/IP协议栈道能否正常封装与解封装数据;
还可用于实验环境中模拟连接终端PC的接口,来降低实验的硬件成本;
3、手工汇总-- 路由器访问多个连续子网(可以被汇总的网段)时,若全部基于相同的下一跳时,可以将这些目标网段进行汇总计算后,仅编写到达汇总网段的路由条目即可— 减少路由表条目的数量
4、路由黑洞
汇总时,汇总的网段中包含了网络内实际不存在的网段,被访问时将出现有去无回现象–浪费了硬件资源 === 建议合理的规划ip地址,尽量的精确汇总路由
5、缺省路由
一条不限定目标的路由条目,路由器查表时,在查询完本地所有的直连、静态、动态路由后,若依然没有可达路径才使用该条目;
[r1]ip route-static 0.0.0.0 0.0.0.0 12.1.1.2
6、空接口防环路由–缺省路由与路由黑洞相遇,必然出现环路;
可以在黑洞路由器上,编辑到达汇总网段的空接口路由来避免环路
[r1]ip route-static 192.168.1.0 24 NULL 0
7、浮动静态路由— 路由器若同时存在两条到达相同目标的路由时,需要关注两条信息的优先级,优先级小可以加载到路由表被使用;若优先级相同,两条同时加表实现负载均衡;
优先级0-255 默认静态路由为60
通过修改默认的静态路由优先级,可以实现静态路由备份 的效果-- 浮动静态路由
ip route-static 1.1.1.0 255.255.255.0 12.1.1.2 preference 61
按下图要求配置路由:
1、分析IP地址分配。
主干IP掩码均为30;
环回IP掩码为28,方便汇总掩码27;
然后预留部分IP地址。
如下图:
2、按如上图片要求连接设备,并标记好IP分配信息,便于命令配置时一目了然。
3、进入各路由器VRP界面开始命令配置,配置IP地址命令如下(含解析):
r1:
<Huawei>sys //进入第二层
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r1 //将路由器改名为r1
[r1]int g 0/0/0 //进入接口,按之前信息标注开始配置IP地址
[r1-GigabitEthernet0/0/0]ip add 192.168.1.21 30
Jul 21 2023 10:14:33-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r1-GigabitEthernet0/0/0]q
[r1]int g 0/0/1
[r1-GigabitEthernet0/0/1]ip add 192.168.1.17 30
Jul 21 2023 10:15:20-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r1-GigabitEthernet0/0/1]q
[r1]int LoopBack 0 //进入环回接口
[r1-LoopBack0]ip add 192.168.1.145 28 //给环回接口配置IP地址,将环回接口模拟成一台pc
[r1-LoopBack0]q
[r1]int loopb 1
[r1-LoopBack1]ip add 192.168.1.129 28
[r1-LoopBack1]q
r2:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r2
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.22 30
Jul 21 2023 10:19:12-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r2-GigabitEthernet0/0/0]q
[r2]int g 0/0/1
[r2-GigabitEthernet0/0/1]ip add 192.168.1.9 30
Jul 21 2023 10:19:34-08:00 r2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r2-GigabitEthernet0/0/1]q
[r2]int loopb 0
[r2-LoopBack0]ip add 192.168.1.81 28
[r2-LoopBack0]q
[r2]int loopb 1
[r2-LoopBack1]ip add 192.168.1.165 28
[r2-LoopBack1]q
r3:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r3
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.1.18 30
Jul 21 2023 10:21:58-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r3-GigabitEthernet0/0/0]q
[r3]int g 0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.1.13 30
Jul 21 2023 10:22:24-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r3-GigabitEthernet0/0/1]q
[r3]int loopb 0
[r3-LoopBack0]ip add 192.168.1.97 28
[r3-LoopBack0]q
[r3]int loopb 1
[r3-LoopBack1]ip add 192.168.1.113 28
r4:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r4
[r4]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.1.14 30
Jul 21 2023 10:26:37-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r4-GigabitEthernet0/0/0]q
[r4]int g 0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.1.10 30
Jul 21 2023 10:26:59-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r4-GigabitEthernet0/0/1]q
[r4]int g 0/0/2
[r4-GigabitEthernet0/0/2]ip add 192.168.1.2 30
Jul 21 2023 10:27:23-08:00 r4 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r4-GigabitEthernet0/0/2]q
[r4]int g 4/0/0
[r4-GigabitEthernet4/0/0]ip add 192.168.1.5 30
Jul 21 2023 10:27:48-08:00 r4 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet4/0/0 has entered the UP state.
[r4-GigabitEthernet4/0/0]q
[r4]int loopb 0
[r4-LoopBack0]ip add 192.168.1.33 28
[r4-LoopBack0]q
[r4]int loopb 1
[r4-LoopBack1]ip add 192.168.1.49 28
[r4-LoopBack1]
r5:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r5
[r5]int g 0/0/0
[r5-GigabitEthernet0/0/0]ip add 192.168.1.1 30 //模拟为1000兆接口
Jul 21 2023 10:29:53-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r5-GigabitEthernet0/0/0]q
[r5]int g 0/0/1
[r5-GigabitEthernet0/0/1]ip add 192.168.1.6 30 //模拟为100兆接口
Jul 21 2023 10:30:19-08:00 r5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r5-GigabitEthernet0/0/1]q
[r5]int loopb0
[r5-LoopBack0]ip add 5.5.5.5 24
4、给各路由配空接口防环路由、缺省路由,同时配置静态路由。
r1:
<r1>sys
Enter system view, return user view with Ctrl+Z.
[r1]ip route-static 192.168.1.128 27 null 0 //空接口防环路由
[r1]ip route-static 0.0.0.0 0.0.0.0 192.168.1.22 //配置缺省路由
[r1]ip route-static 0.0.0.0 0.0.0.0 192.168.1.18
[r1]ip route- 192.168.1.8 30 192.168.1.22 //配置静态路由
[r1]ip route- 192.168.1.12 30 192.168.1.18
[r1]ip route- 192.168.1.0 30 191.168.1.20
[r1]ip route- 192.168.1.4 30 191.168.1.20
[r1]ip route- 192.168.1.0 30 191.168.1.16
[r1]ip route- 192.168.1.4 30 191.168.1.16
r2:
<r2>sys
Enter system view, return user view with Ctrl+Z.
[r2]ip route-static 192.168.1.64 27 null 0
[r2]ip route-static 0.0.0.0 0.0.0.0 192.168.1.10
[r2]ip route-static 192.168.1.128 27 192.168.1.21
[r2]ip route- 192.168.1.0 30 192.168.1.10
[r2]ip route- 192.168.1.4 30 192.168.1.10
[r2]ip route- 192.168.1.12 30 192.168.1.1
[r2]ip route- 192.168.1.96 27 192.168.1.10
[r2]ip route- 192.168.1.96 27 192.168.1.21
[r2]ip route- 192.168.1.16 30 192.168.1.21
[r2]ip route- 192.168.1.32 27 192.168.1.10
r3:
<r3>sys
Enter system view, return user view with Ctrl+Z.
[r3]ip route-static 192.168.1.96 27 null 0
[r3]ip route-static 0.0.0.0 0.0.0.0 192.168.1.14
[r3]ip route-static 192.168.1.128 27 192.168.1.17
[r3]ip route- 192.168.1.0 30 192.168.1.14
[r3]ip route- 192.168.1.4 30 192.168.1.14
[r3]ip route- 192.168.1.8 30 192.168.1.14
[r3]ip route- 192.168.1.32 27 192.168.1.14
[r3]ip route- 192.168.1.64 27 192.168.1.17
[r3]ip route- 192.168.1.20 30 192.168.1.17
[r3]ip route- 192.168.1.64 27 192.168.1.14
r4:
<r4>sys
Enter system view, return user view with Ctrl+Z.
[r4]ip route-static 192.168.1.32 27 null 0
[r4]ip route-static 0.0.0.0 0.0.0.0 192.168.1.1
[r4]ip route-static 0.0.0.0 0.0.0.0 192.168.1.6 preference 61
[r4]ip route-static 192.168.1.64 27 192.168.1.9
[r4]ip route-static 192.168.1.96 27 192.168.1.13
[r4]ip route-static 192.168.1.128 27 192.168.1.13
[r4]ip route-static 192.168.1.128 27 192.168.1.9
[r4]ip route- 192.168.1.20 30 192.168.1.9
[r4]ip route- 192.168.1.16 30 192.168.1.13
r5:
[r5]ip route-static 192.168.1.32 27 192.168.1.2
[r5]ip route-static 192.168.1.64 27 192.168.1.2
[r5]ip route-static 192.168.1.128 27 192.168.1.2
[r5]ip route-static 192.168.1.8 30 192.168.1.2
[r5]ip route-static 192.168.1.20 30 192.168.1.2
[r5]ip route-static 192.168.1.12 30 192.168.1.2
[r5]ip route-static 192.168.1.16 30 192.168.1.2
[r5]ip route-static 192.168.1.96 27 192.168.1.2
[r5]ip route-static 192.168.1.128 27 192.168.1.5 preference 61
[r5]ip route-static 192.168.1.96 27 192.168.1.5 preference 61
[r5]ip route-static 192.168.1.16 30 192.168.1.5 preference 61
[r5]ip route-static 192.168.1.12 30 192.168.1.5 preference 61
[r5]ip route-static 192.168.1.8 30 192.168.1.5 preference 61
[r5]ip route-static 192.168.1.20 30 192.168.1.5 preference 61
[r5]ip route-static 192.168.1.64 27 192.168.1.5 preference 61
[r5]ip route-static 192.168.1.32 27 192.168.1.5 preference 61
部分效果呈现:
文章来源:https://www.toymoban.com/news/detail-768382.html
文章来源地址https://www.toymoban.com/news/detail-768382.html
到了这里,关于eNSP配置一个综合的静态路由的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!