一、实验需求
划分IP地址并配置
划分vlan并实现vlan间互联互通,配置链路聚合增大链路带宽
运行OSPF实现PC1访问5.5.5.5(外网)
配置VRRP和MSTP
二、实验调试
实验拓扑如图3-14所示
图3-14VRRP+MSTP项目拓扑图
三、实验步骤
(1)划分并配置IP地址
1) R1的配置:
system-view[Huawei]undo info-center enable[R1]sysname R1[R1]interface g0/0/1[R1-GigabitEthernet0/0/1]ip address 10.10.10.1 30[R1-GigabitEthernet0/0/1]quit[R1]interfaceg0/0/2[R1-GigabitEthernet0/0/2]ip address 10.10.20.1 30[R1-GigabitEthernet0/0/2]quit[R1]interface LoopBack 0[R1-LoopBack0]ip address 5.5.5.5 24[R1-LoopBack0]quit
2)SW3的配置:
system-view[Huawei]undo info-center enable[Huawei]sysname sw3
[sw3]vlan batch10 20 30[sw3]interface Vlanif1[sw3-Vlanif1]ip address 10.10.10.2 255.255.255.252[sw3]interface Vlanif10[sw3-Vlanif10]ip address 192.168.1.253 255.255.255.0[sw3]interface Vlanif30[sw3-Vlanif30]ip address 10.10.30.1 255.255.255.252
3)SW4的配置:
system-view[Huawei]undo info-center enable[Huawei]sysname sw4[sw4]vlan batch 10 20 30[sw4]interface Vlanif 20[sw4-Vlanif20]ip address 192.168.2.253 24[sw4-Vlanif20]quit[sw4]interface Vlanif 30[sw4-Vlanif30]ip address 10.10.30.2 30[sw4-Vlanif30]quit[sw4]interfaceVlanif 1[sw4-Vlanif1]ip address 10.10.20.2 30[sw4-Vlanif1]quit
(2)划分vlan和配置链路聚合
1)在SW1上创建vlan,将接口G0/0/1划入vlan10,G0/0/2与G0/0/3中间链路类型设置为trunk
system-view[Huawei]undo info-center enable[Huawei]sysname sw1[sw1]vlan batch 10 20 30[sw1]interface g0/0/1[sw1-GigabitEthernet0/0/1]port link-type access[sw1-GigabitEthernet0/0/1]port default vlan 10[sw1-GigabitEthernet0/0/1]quit[sw1]interface g0/0/2[sw1-GigabitEthernet0/0/2]port link-type trunk[sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan all[sw1-GigabitEthernet0/0/2]quit[sw1]interfaceg0/0/3[sw1-GigabitEthernet0/0/3]port link-type trunk[sw1-GigabitEthernet0/0/3]port trunk allow-pass vlan all[sw1-GigabitEthernet0/0/3]quit
注:SW2相同配置划分在vlan20,自行配置
2)在SW4上做链路聚合,其他链路配置为trunk
[sw4]interface Eth-Trunk 1[sw4-Eth-Trunk1]mode lacp-static[sw4-Eth-Trunk1]trunkport GigabitEthernet 0/0/5 to 0/0/6[sw4-Eth-Trunk1]port link-type trunk[sw4-Eth-Trunk1]port trunk allow-passvlanall[sw4-Eth-Trunk1]quit[sw4]interface g0/0/2[sw4-GigabitEthernet0/0/2]port link-typetrunk[sw4-GigabitEthernet0/0/2]port trunk allow-pass vlan all[sw4-GigabitEthernet0/0/2]quit[sw4]interfaceg0/0/3[sw4-GigabitEthernet0/0/3]port link-type trunk[sw4-GigabitEthernet0/0/3]port trunk allow-pass vlan all[sw4-GigabitEthernet0/0/3]quit
注:SW3与SW4相同配置
(3)运行OSPF实现网络互联互通
W3的配置
[sw3]ospf[sw3-ospf-1]area 0[sw3-ospf-1-area-0.0.0.0]network 10.10.10.0 0.0.0.3[sw3-ospf-1-area-0.0.0.0]network 10.10.30.0 0.0.0.3
SW4的配置
[sw4]ospf[sw4-ospf-1]area 0[sw4-ospf-1-area-0.0.0.0]network 10.10.20.0 0.0.0.3[sw4-ospf-1-area-0.0.0.0]network 10.10.30.0 0.0.0.3
R1的配置
[R1]ospf[R1-ospf-1]area 0[R1-ospf-1-area-0.0.0.0]network 5.5.5.0 0.0.0.255[R1-ospf-1-area-0.0.0.0]network 10.10.20.0 0.0.0.3[R1-ospf-1-area-0.0.0.0]network 10.10.10.0 0.0.0.3
(4)配置VRRP和MSTP
1)在SW3和SW4上配置VRRP,实现多网关负载分担,并配置MSTP
SW3的配置
[sw3]interface Vlanif 10[sw3-Vlanif10]vrrp vrid 1 virtual-ip 192.168.1.254 //虚拟路由器的标识符为1,虚拟IP为192.168.1.254[sw3-Vlanif10]vrrp vrid 1 priority 120 //优先级设置为120,默认为1[sw3-Vlanif10]vrrp vrid 1 track interface GigabitEthernet 0/0/1 reduced 30 //抢占时间延迟时间为20s,默认为0[sw3-Vlanif10]quit[sw3]interface Vlanif 20[sw3-Vlanif20]vrrp vrid 2 virtual-ip 192.168.2.254[sw3-Vlanif20]quit[sw3]stp enable //启用STP,默认配置[sw3]stpmode mstp //STP的模式为MSTP,默认配置[sw3]stp region-configuration //进入MST域视图[sw3-mst-region]region-name vrrp //MSTP的域名为vrrp[sw3-mst-region]instance 1 vlan 10 //实例1关联vlan 10[sw3-mst-region]instance 2 vlan 20 //实例2关系vlan 20[sw3-mst-region]active region-configuration//激活MST域的配置[sw3-mst-region]quit[sw3]stp instance 1 root primary[sw3]stp instance 2 root secondary
在SW3上查看VRRP信息
[sw3]dis vrrp brief
VRIDStateInterfaceTypeVirtual IP
----------------------------------------------------------------
1MasterVlanif10Normal192.168.1.254
2MasterVlanif20Normal192.168.2.254
----------------------------------------------------------------
Total:2Master:2Backup:0Non-active:0
[sw3] User interface con0 is available
SW4的配置
[sw4]interface Vlanif 10[sw4-Vlanif10]vrrp vrid 1 virtual-ip 192.168.1.254[sw4-Vlanif10]vrrp vrid 1 priority 100[sw4-Vlanif10]quit[sw4]interface Vlanif 20[sw4-Vlanif20]vrrp vrid 2 virtual-ip 192.168.2.254[sw4-Vlanif20]quit[sw4]stp enable[sw4]stp mode mstp[sw4]stp region-configuration[sw4-mst-region]region-name vrrp[sw4-mst-region]instance 1 vlan 10[sw4-mst-region]instance 2 vlan 20[sw4-mst-region]quit[sw4]stp instance 1 root secondary[sw4]stp instance 2 root primary
在SW4上查看VRRP信息
[sw4]dis vrrp brief
VRIDStateInterfaceTypeVirtual IP
----------------------------------------------------------------
1BackupVlanif10Normal192.168.1.254
2BackupVlanif20Normal192.168.2.254
----------------------------------------------------------------
Total:2Master:0Backup:2Non-active:0
四、实验调试
在PC1上访问5.5.5.5,如图3-15所示。
图3-15在PC1上访问5.5.5.5
通过以上输出可以看到PC2访问3.3.3.3走的是SW3
更多的ensp网工实验案例和网工技术学习戳文章末尾卡片👇👇