实验环境:华为模拟器
实验要求:
1.分配IP地址
1>先对192.168.1.0/24网段做子网划分
192.168.1.0/24
子网
192.168.1.0/27 骨干链路网络号
192.168.1.32/27 R1
192.168.1.64/27 R2
192.168.1.96/27 R3
192.168.1.128/27 R4
保留地址
192.168.1.160/27
192.168.1.192/27
骨干链路又分为6子网
192.168.1.0/27
子网
192.168.1.0/30
192.168.1.4/30
192.168.1.8/30
192.168.1.12/30
192.168.1.16/30
192.168.1.20/30
保留地址
192.168.1.24/30
192.168.1.28/30
R1网段子网划分
192.168.1.32/27
子网
192.168.1.32/28
192.168.1.48/28
R2网段子网划分
192.168.1.64/27
192.168.1.64/28
192.168.1.80/28
R3网段子网划分
192.168.1.96/27
192.168.1.96/28
192.168.1.112/28
R4网段子网划分
192.168.1.128/27
192.168.1.128/28
192.168.1.144/28
2>给接口配置IP地址
拓扑图:
r1接口配置:
注:命令可以缩写,或用tab键补全。
<Huawei>sys 进入上层模式
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r1 模式为系统模式,对设备进行管理配置;修改设备名称;
[r1]int g0/0/0 进入g0/0/0接口
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 30 给接口配置IP地址;30为子网掩码的简写形式
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip add 192.168.1.5 30
[r1]int LoopBack 0 创建名为‘0’的环回网卡[虚拟]
[r1-LoopBack0]ip add 192.168.1.33 28 配置IP地址
[r1]int LoopBack 1 创建名为'1'的虚拟网卡
[r1-LoopBack1]ip add 192.168.1.49 28
[r1]display ip interface brief 查看接口摘要
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.1/30 up up
GigabitEthernet0/0/1 192.168.1.5/30 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.1.33/28 up up(s)
LoopBack1 192.168.1.49/28 up up(s)
NULL0 unassigned up up(s)
R2接口配置:
<Huawei>sys 进入上层模式
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r2 修改设备名称
[r2]int g0/0/0 进入接口
[r2-GigabitEthernet0/0/0]ip add 192.168.1.2 30 配置IP地址
[r2-GigabitEthernet0/0/0]int g0/0/1
[r2-GigabitEthernet0/0/1]ip add 192.168.1.9 30
[r2-GigabitEthernet0/0/1]int lo 0 创建名为‘0’环回网卡
[r2-LoopBack0]ip add 192.168.1.65 28 配置IP地址
[r2-LoopBack0]int lo 1 创建名为‘1’环回网卡
[r2-LoopBack1]ip add 192.168.1.81 28 配置IP地址
[r2-LoopBack1]dis ip int br 查看接口摘要
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.2/30 up up
GigabitEthernet0/0/1 192.168.1.9/30 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.1.65/28 up up(s)
LoopBack1 192.168.1.81/28 up up(s)
NULL0 unassigned up up(s)
R3接口配置:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r3
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.1.6 30
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.1.13 30
[r3-GigabitEthernet0/0/1]int lo 0
[r3-LoopBack0]ip add 192.168.1.97 28
[r3-LoopBack0]int lo 1
[r3-LoopBack1]ip add 192.168.1.113 28
[r3-LoopBack1]dis ip int br
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.6/30 up up
GigabitEthernet0/0/1 192.168.1.13/30 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.1.97/28 up up(s)
LoopBack1 192.168.1.113/28 up up(s)
NULL0 unassigned up up(s)
R4 接口配置:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r4
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.1.10 30
[r4-GigabitEthernet0/0/0]int g0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.1.14 30
[r4-GigabitEthernet0/0/1]int g0/0/2
[r4-GigabitEthernet0/0/2]ip add 192.168.1.17 30
[r4-GigabitEthernet0/0/2]int e4/0/0
[r4-Ethernet4/0/0]ip add 192.168.1.21 30
[r4-Ethernet4/0/0]int lo 0
[r4-LoopBack0]ip add 192.168.1.129 28
[r4-LoopBack0]int lo 1
[r4-LoopBack1]ip add 192.168.1.145 28
[r4-LoopBack1]dis ip int br
Interface IP Address/Mask Physical Protocol
Ethernet4/0/0 192.168.1.21/30 up up
Ethernet4/0/1 unassigned down down
GigabitEthernet0/0/0 192.168.1.10/30 up up
GigabitEthernet0/0/1 192.168.1.14/30 up up
GigabitEthernet0/0/2 192.168.1.17/30 up up
LoopBack0 192.168.1.129/28 up up(s)
LoopBack1 192.168.1.145/28 up up(s)
NULL0 unassigned up up(s)
R5接口配置:
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r5
[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip add 192.168.1.18 30
[r5-GigabitEthernet0/0/0]int g0/0/1
[r5-GigabitEthernet0/0/1]ip add 192.168.1.22 30
[r5-GigabitEthernet0/0/1]int lo 0
[r5-LoopBack0]ip add 5.5.5.5 24
[r5-LoopBack0]dis ip int br
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.18/30 up up
GigabitEthernet0/0/1 192.168.1.22/30 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 5.5.5.5/24 up up(s)
NULL0 unassigned up up(s)
2.添加静态路由
R1路由表
R2和R4之间网段 下一跳
[r1]ip route-static 192.168.1.8 30 192.168.1.2
R3和R4之间网段 下一跳
[r1]ip route-static 192.168.1.12 30 192.168.1.6
R2上环回地址[汇总] 下一跳
[r1]ip route-static 192.168.1.64 27 192.168.1.2
R3上环回地址[汇总] 下一跳
[r1]ip route-static 192.168.1.96 27 192.168.1.6
R4上的环回地址[汇总] 下一跳
[r1]ip route-static 192.168.1.128 27 192.168.1.6
[r1]ip route-static 192.168.1.128 27 192.168.1.2
负载均衡-当到同一目标地址时,存在多条开销相似的路径时;可让设备将流量拆分后沿多条路径同时传输
R4和R5之间1000M网段 下一跳 [负载均衡]
[r1]ip route-static 192.168.1.16 30 192.168.1.10
[r1]ip route-static 192.168.1.16 30 192.168.1.14
R4和R5之间100M网段 下一跳[负载均衡]
[r1]ip route-static 192.168.1.20 30 192.168.1.2
[r1]ip route-static 192.168.1.20 30 192.168.1.6
缺省路由
[r1]ip route-static 0.0.0.0 0 192.168.1.2
[r1]ip route-static 0.0.0.0 0 192.168.1.6
r2路由表
R1和R3之间网段 下一跳
[r2]ip route-static 192.168.1.4 30 192.168.1.1
R3和R4之间网段 下一跳
[r2]ip route-static 192.168.1.12 30 192.168.1.10
R1上环回地址[汇总] 下一跳
[r2]ip route-static 192.168.1.32 27 192.168.1.1
R4上环回地址[汇总] 下一跳
[r2]ip route-static 192.168.1.128 27 192.168.1.10
R3上环回地址[汇总] 下一跳[负载均衡]
[r2]ip route-static 192.168.1.96 27 192.168.1.1
[r2]ip route-static 192.168.1.96 27 192.168.1.10
R4和R5之间1000M网段 下一跳
[r2]ip route-static 192.168.1.16 30 192.168.1.10
R4和R5之间100M网段 下一跳
[r2]ip route-static 192.168.1.20 30 192.168.1.10
缺省路由
[r2]ip route-static 0.0.0.0 0 192.168.1.10
R3路由表
R1和R2之间网段 下一跳
[r3]ip route-static 192.168.1.0 30 192.168.1.5
R2和R4之间网段 下一跳
[r3]ip route-static 192.168.1.8 30 192.168.1.14
R4环回地址[汇总]
[r3]ip route-static 192.168.1.128 27 192.168.1.14
R1环回地址[汇总]
[r3]ip route-static 192.168.1.32 27 192.168.1.5
R2环回地址[汇总] 负载均衡
[r3]ip route-static 192.168.1.64 27 192.168.1.5
[r3]ip route-static 192.168.1.64 27 192.168.1.14
R4和R5之间网段
[r3]ip route-static 192.168.1.16 30 192.168.1.14
[r3]ip route-static 192.168.1.20 30 192.168.1.14
缺省路由
[r3]ip route-static 0.0.0.0 0 192.168.1.14
r4路由表
R1和R2之间网段
[r4]ip route-static 192.168.1.0 30 192.168.1.9
R2和R3之间网段
[r4]ip route-static 192.168.1.4 30 192.168.1.13
R1上环回地址 负载均衡
[r4]ip route-static 192.168.1.32 30 192.168.1.13
[r4]ip route-static 192.168.1.32 30 192.168.1.9
R3上环回地址
[r4]ip route-static 192.168.1.96 27 192.168.1.13
R2上环回地址
[r4]ip route-static 192.168.1.64 27 192.168.1.19
1000M网段到,R5上环回地址
[r4]ip route-static 5.5.5.0 24 192.168.1.18
浮动静态路由 修改优先级为61
[r4]ip route-static 5.5.5.0 24 192.168.1.22 preference 61
静态路由优先级默认60;优先级为0-255,越小越优;
通过编写静态路由时,修改默认优先级;可以实现路由备份效果;
R5
[r5]ip route-static 192.168.1.32 27 192.168.1.17
[r5]ip route-static 192.168.1.96 27 192.168.1.17
[r5]ip route-static 192.168.1.64 27 192.168.1.17
[r5]ip route-static 192.168.1.128 27 192.168.1.17
[r5]ip route-static 192.168.1.0 30 192.168.1.17
[r5]ip route-static 192.168.1.4 30 192.168.1.17
[r5]ip route-static 192.168.1.8 30 192.168.1.17
[r5]ip route-static 192.168.1.12 30 192.168.1.17
备份
[r5]ip route-static 192.168.1.32 27 192.168.1.21 p 61
[r5]ip route-static 192.168.1.96 27 192.168.1.21 p 61
[r5]ip route-static 192.168.1.64 27 192.168.1.21 p 61
[r5]ip route-static 192.168.1.128 27 192.168.1.21 p 61
[r5]ip route-static 192.168.1.0 30 192.168.1.21 p 61
[r5]ip route-static 192.168.1.4 30 192.168.1.21 p 61
[r5]ip route-static 192.168.1.8 30 192.168.1.21 p 61
[r5]ip route-static 192.168.1.12 30 192.168.1.21 p 61
实验结果成功:
在R5上ping R1的接口IP
R1上pingR5的环回地址5.5.5.5
重点:
1>r1到r4的环回负载均衡
到r4,r5的网段负载均衡
2>r2到r3的环回负载均衡
3>r3到r2的环回负载均衡
4>r4到r1环回上负载均衡
过程中在r4上使用了空接口路由,防止环路产生;
r4到r5的100M链路,相当于做备份,修改优先级;
静态路由缺点:
1.配置量大;
2.不能基于拓扑变坏进行实时收敛;
总结:
只能在简单的小型网络中来进行工作和配置。