本实验使用华为eNSP模拟器,采用了VLAN技术、MSTP技术、VRRP技术、RIP等技术,搭建了一个简单的公司内网环境,实现网络的冗余及负载均衡实验环境如下:在sw1上配置<Huawei>syste
.
本实验使用华为eNSP模拟器,采用了VLAN技术、MSTP技术、VRRP技术、RIP等技术,搭建了一个简单的公司内网环境,实现网络的冗余及负载均衡
实验环境如下:
在sw1上配置
<Huawei>system-view [Huawei]sysname sw1[sw1]vlan batch 10 20 #配置VLAN以及Trunk[sw1]int e0/0/1[sw1-Ethernet0/0/1]port link-type access [sw1-Ethernet0/0/1]port default vlan 10[sw1-Ethernet0/0/1]int e0/0/2 [sw1-Ethernet0/0/2]port link-type access [sw1-Ethernet0/0/2]port default vlan 20[sw1-Ethernet0/0/2]int e0/0/3[sw1-Ethernet0/0/3]port link-type trunk [sw1-Ethernet0/0/3]port trunk allow-pass vlan 10 20[sw1-Ethernet0/0/3]int e0/0/4 [sw1-Ethernet0/0/4]port link-type trunk [sw1-Ethernet0/0/4]port trunk allow-pass vlan 10 20[sw1]stp region-configuration #进入创建MSTP实例模式[sw1-mst-region]region-name test #配置统一的实例名[sw1-mst-region]revision-level 1 #配置一致的修订级别[sw1-mst-region]instance 1 vlan 10 #配置实例1,将vlan10加入到实例1[sw1-mst-region]instance 2 vlan 20 #配置实例2,将vlan20加入到实例2[sw1-mst-region]active region-configuration #提交配置
在3sw1上配置
<Huawei>system-view [Huawei]sysname 3sw1[3sw1]vlan batch 10 20 1000[3sw1]int g0/0/1[3sw1-GigabitEthernet0/0/1]port link-type trunk [3sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20[3sw1-GigabitEthernet0/0/1]int g0/0/2[3sw1-GigabitEthernet0/0/2]port link-type trunk[3sw1-GigabitEthernet0/0/2] port trunk allow-pass vlan 10 20[3sw1-GigabitEthernet0/0/2]int g0/0/3 [3sw1-GigabitEthernet0/0/3]port link-type access [3sw1-GigabitEthernet0/0/3]port default vlan 1000[3sw1]stp region-configuration #配置MSTP实例[3sw1-mst-region] region-name test[3sw1-mst-region] revision-level 1[3sw1-mst-region] instance 1 vlan 10[3sw1-mst-region] instance 2 vlan 20[3sw1-mst-region] active region-configuration[3sw1]stp instance 1 root primary #指定为实例1 的根网桥[3sw1]stp instance 2 root secondary #指定为实例2 的备份网桥[3sw1]int Vlanif 10 #配置为vlan10的master[3sw1-Vlanif10]ip add 192.168.10.100 24 #配置vlan10网关的真实IP[3sw1-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254 #配置虚拟网关[3sw1-Vlanif10]vrrp vrid 10 priority 150 #优先级[3sw1-Vlanif10]vrrp vrid 10 track int g0/0/2 reduced 100 #端口跟踪[3sw1-Vlanif10]vrrp vrid 10 track int g0/0/3 reduced 100[3sw1-Vlanif10]int vlanif 20 #配置为vlan20的backup[3sw1-Vlanif20]ip add 192.168.20.100 24[3sw1-Vlanif20]vrrp vrid 20 virtual-ip 192.168.20.254[3sw1]int Vlanif 1000[3sw1-Vlanif1000]ip add 192.168.1.2 30[3sw1]rip 1[3sw1-rip-1]undo summary #关闭路由自动汇总[3sw1-rip-1]version 2 #开启版本2[3sw1-rip-1]network 192.168.10.0 #宣告路由[3sw1-rip-1]network 192.168.20.0[3sw1-rip-1]network 192.168.1.0[3sw1-rip-1]silent-interface g0/0/1 #配置被动接口[3sw1-rip-1]silent-interface g0/0/2[3sw1]display vrrp brief #查看VRRP配置信息VRID State Interface Type Virtual IP ----------------------------------------------------------------10 Master Vlanif10 Normal 192.168.10.254 20 Backup Vlanif20 Normal 192.168.20.254 ----------------------------------------------------------------Total:2 Master:1 Backup:1 Non-active:0
在3sw2上配置
<Huawei>system-view [Huawei]sysname 3sw2[3sw2]vlan batch 10 20 2000[3sw2]int g0/0/1[3sw2-GigabitEthernet0/0/1]port link-type trunk [3sw2-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20[3sw2-GigabitEthernet0/0/1]int g0/0/2[3sw2-GigabitEthernet0/0/2]port link-type trunk [3sw2-GigabitEthernet0/0/2]port trunk allow-pass vlan 10 20[3sw2-GigabitEthernet0/0/2]int g0/0/3[3sw2-GigabitEthernet0/0/3]port link-type access [3sw2-GigabitEthernet0/0/3]port default vlan 2000[3sw2]stp region-configuration #配置MSTP实例[3sw2-mst-region] region-name test[3sw2-mst-region] revision-level 1[3sw2-mst-region] instance 1 vlan 10[3sw2-mst-region] instance 2 vlan 20[3sw2-mst-region] active region-configuration[3sw2]stp instance 2 root primary #指定为实例2 的根网桥[3sw2]stp instance 1 root secondary #指定为实例1 的备份网桥[3sw2]int Vlanif 10 #配置为vlan10的backup[3sw2-Vlanif10]ip add 192.168.10.200 24[3sw2-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254[3sw2-Vlanif10]int vlanif 20 #配置为vlan20的master[3sw2-Vlanif20]ip add 192.168.20.200 24[3sw2-Vlanif20]vrrp vrid 20 virtual-ip 192.168.20.254[3sw2-Vlanif20]vrrp vrid 20 priority 150[3sw2-Vlanif20]vrrp vrid 20 track int g0/0/2 reduced 100[3sw2-Vlanif20]vrrp vrid 20 track int g0/0/3 reduced 100[3sw2]int Vlanif 2000[3sw2-Vlanif2000]ip add 192.168.1.6 30[3sw2]rip 1[3sw2-rip-1]undo summary[3sw2-rip-1]version 2[3sw2-rip-1]network 192.168.10.0[3sw2-rip-1]network 192.168.20.0[3sw2-rip-1]network 192.168.1.0[3sw2-rip-1]silent-interface g0/0/1[3sw2-rip-1]silent-interface g0/0/2[3sw2]display vrrp brief VRID State Interface Type Virtual IP ----------------------------------------------------------------10 Backup Vlanif10 Normal 192.168.10.254 20 Master Vlanif20 Normal 192.168.20.254 ----------------------------------------------------------------Total:2 Master:1 Backup:1 Non-active:0
在R1上配置
<Huawei>system-view [Huawei]sysname R1[R1]int g0/0/0[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 30[R1-GigabitEthernet0/0/0]int g0/0/2[R1-GigabitEthernet0/0/2]ip add 192.168.1.5 30[R1-GigabitEthernet0/0/2]int g0/0/1[R1-GigabitEthernet0/0/1]ip add 100.1.1.1 30[R1]ip route-static 0.0.0.0 0.0.0.0 100.1.1.2[R1]rip 1 [R1-rip-1]undo summary [R1-rip-1]version 2[R1-rip-1]network 100.0.0.0[R1-rip-1]network 192.168.1.0[R1-rip-1]default-route originate #宣告默认路由[R1]acl 2000 [R1-acl-basic-2000]rule permit source 192.168.10.0 0.0.0.255[R1-acl-basic-2000]rule permit source 192.168.20.0 0.0.0.255 [R1-acl-basic-2000]rule deny source any [R1-acl-basic-2000]quit[R1]int g0/0/1[R1-GigabitEthernet0/0/1]nat outbound 2000
配置完毕,实现全网互通,如果一个核心交换机出现故障,也不会影响网络的正常通信了