[S1]interface GigabitEthernet 0/0/1
[S1-GigabitEthernet0/0/1]port link-type access 接口模式配置为access模式
(资料图片仅供参考)
[S1-GigabitEthernet0/0/1]port default vlan 2 接口加入 vlan2
[S1]port-group 1 创建端口组
[S1-port-group-1]group-memberg0/0/1 to g0/0/10添加端口组成员
[S1-port-group-1]port link-typeaccess
[S1-port-group-1]portdefault vlan 2
3.Trunk配置[Huawei]interfaceGigabitEthernet 0/0/5
[Huawei-GigabitEthernet0/0/5]portlink-type trunk 配置接口模式为truk模式
[Huawei-GigabitEthernet0/0/5]porttrunk allow-pass vlan all 配置trunk链路允许通过的vlan
4.配置 hybrid[sw1]vlan batch 10 //创建vlan10[sw1] interface g0/0/1 //进入接口g0/0/1[sw1-g0/0/1]port link-type hybrid //将接口改为hybrid模式[sw1-g0/0/1]port hybrid pvid vlan 10 //配置接口的pvid为10[sw1-g0/0/1]port hybrid untagged vlan 10 //接口发送数据帧时,允许vlan10的数据帧通过,并且剥离数据帧中的vlan10标签
[sw1] interface g0/0/2 //进入接口g0/0/2[sw1-g0/0/2]port link-type hybrid //将接口改为hybrid模式[sw1-g0/0/2]port hybrid pvid vlan 10 //配置接口的pvid为10[sw1-g0/0/2]port hybrid untagged vlan 10 //接口发送数据帧时,允许vlan10的数据帧通过,并且剥离数据帧中的vlan10标签
验证与测试:pc1 ping pc2 可以互通
二,需求变化之路由交换配置1.快速生成树-负载均衡需求
PC1属于 vlan 10 ,IP地址为 192.168.10.1/24,网关为 192.168.10.254PC2属于 vlan 20 ,IP地址为 192.168.20.1/24,网关为 192.168.20.254确保PC1与PC2互通合理配置 MSTP ,确保PC1与PC2之间的互通路径是最优的配置步骤:
配置PC的IP地址在所有的交换机中都创建vlan10和vlan20交换机连接PC的接口设置为access模式,并加入指定的vlan交换机和交换机互联的接口设置trunk模式,并允许vlan10和vlan20 通过在所有的交换机中配置MSTP,所有交换机中的MSTP配置都要完全相同指定SW1为vlan10的主根, vlan20的备根指定SW2为vlan20的主根, vlan10的备根配置路由器接口的IP地址命令:
1 S1、S2、S3创建vlan并配置连接交换机的端口为trunk 2 [S1]VLAN batch 10 20 3 [S1]port-group 1 4 [S1-port-group-1]group-member G0/0/5 G0/0/6 5 [S1-port-group-1]port link-type trunk 6 [S1-GigabitEthernet0/0/5]port trunk allow-pass vlan ALL 7 8 [S2]VLAN batch 10 20 9 [S2]port-group 110 [S2-port-group-1]group-member G0/0/5 G0/0/611 [S2-port-group-1]port link-type trunk12 [S2-GigabitEthernet0/0/5]port trunk allow-pass vlan ALL13 14 [S3]VLAN batch 10 2015 [S3]port-group 116 [S3-port-group-1]group-member G0/0/5 G0/0/617 [S3-port-group-1]port link-type trunk18 [S3-GigabitEthernet0/0/5]port trunk allow-pass vlan ALL19 20 S1、S2、S3配置MSTP区域并激活21 [S1]stp mode mstp 启用MSTP协议22 [S1]stp region-configuration 创建区域23 [S1-mst-region]region-name ntd 定义区域名为ntd24 [S1-mst-region]instance 1 vlan 10 指定vlan与实例的对应关系25 [S1-mst-region]instance 2 vlan 2026 [S1-mst-region]active region-configuration 激活区域配置27 28 29 [S2]stp mode mstp 启用MSTP协议30 [S2]stp region-configuration 创建区域31 [S2-mst-region]region-name ntd 定义区域名为ntd32 [S2-mst-region]instance 1 vlan 10 指定vlan与实例的对应关系33 [S2-mst-region]instance 2 vlan 2034 [S2-mst-region]active region-configuration 激活区域配置35 36 [S3]stp mode mstp 启用MSTP协议37 [S3]stp region-configuration 创建区域38 [S3-mst-region]region-name ntd 定义区域名为ntd39 [S3-mst-region]instance 1 vlan 10 指定vlan与实例的对应关系40 [S3-mst-region]instance 2 vlan 2041 [S3-mst-region]active region-configuration 激活区域配置42 43 3)配置S1为vlan10的主根、vlan20的次根网桥并查看配置44 [S1]stp instance 1 priority 409645 [S1]stp instance 2 priority 819246 47 4)配置S2为vlan20的主根、vlan10的次根根网桥并查看配置48 [S2]stp instance2 priority 409649 [S2]stp instance 1 priority 819250 51 5)配置PC1加入vlan10、PC2加入vlan20**52 [S3]interface GigabitEthernet 0/0/153 [S3-GigabitEthernet0/0/1]port link-type access54 [S3-GigabitEthernet0/0/1]port default vlan 1055 [S3]interface GigabitEthernet 0/0/256 [S3-GigabitEthernet0/0/2]port link-type access57 [S3-GigabitEthernet0/0/2]port default vlan 2058 59 **6)配置S1与路由相连的接口加入vlan10**60 [S1]interface GigabitEthernet 0/0/161 [S1-GigabitEthernet0/0/1]port link-type access62 [S1-GigabitEthernet0/0/1]port default vlan 1063 64 **7)配置S2与路由相连的接口加入 vlan20**65 [S2]interface GigabitEthernet 0/0/266 [S2-GigabitEthernet0/0/2]port link-type access67 [S2-GigabitEthernet0/0/2]port default vlan 2068 69 **8)配置路由器接口IP**70 [R1]interface GigabitEthernet 0/0/171 [R1-GigabitEthernet0/0/1]ip address 192.168.10.254 2472 [R1]interface GigabitEthernet 0/0/273 [R1-GigabitEthernet0/0/2]ip address 192.168.20.254 2474 75 **9)测试与验证**76 pc1 ping pc2 通77 78 **10)查看验证**
2.链路聚合的工作模式 lacpdisplay stp brief查看S1的instance 1 g0/0/5 g0/0/6都是指定接口查看S2的instance 2 g0/0/5 g0/0/6都是指定接口
1)LACP模式也称为M:N模式
2)M条活动链路,N条备份链路
3)当活动链路出现故障时,备份链路才进行转发
配置步骤
1)PC配置IP地址
2)所有的交换机都创建vlan10 20
3) 交换机和pc互联的接口做成access ,并且加入指定的vlan
4)设置交换机的lacp 优先级,确定主动端设备
5) 配置链路聚合
-创建链路聚合组,组号为1
-配置链路聚合的工作模式lacp
-在链路聚合中添加成员接口
-设置接口trunk模式
-设置活动端口(活动链路)的上限阈值为2
-开启lacp 抢占
1 SW1配置:配置好相应交换机的端口(4,5)模式以及 vlan ...10 [SW1]lacp priority 100 //配置lacp的系统优先级(越小越优先)11 [SW1]interface eth-trunk 1 //创建链路聚合组112 [SW1-Eth-Trunk1]mode lacp-static //链路聚合的工作模式是lacp13 [SW1-Eth-Trunk1]trunkport g 0/0/1 to 0/0/3 //在链路聚合组中添加成员接口14 [SW1-Eth-Trunk1]port link-type trunk //设置trunk模式15 [SW1-Eth-Trunk1]port trunk allow-pass vlan 10 20 //允许vlan10 20 流量通过16 [SW1-Eth-Trunk1]max active-linknumber 2 //设置活动端口的上限阈值为2 17 [SW1-Eth-Trunk1]lacp preempt enable //开启抢占功能18 19 SW2配置:20 [SW2]vlan batch 10 20配置好相应交换机的端口(4,5)模式以及 vlan ....28 [SW2]int eth-trunk 129 [SW2-Eth-Trunk1]mode lacp-static 30 [SW2-Eth-Trunk1]trunkport g 0/0/1 to 0/0/331 [SW2-Eth-Trunk1]port link-type trunk32 [SW2-Eth-Trunk1]port trunk allow-pass vlan 10 2036 测试与验证:37 pc1 ping pc3 通38 pc1 ping pc4 通39 40 [SW1]display eth-trunk 1 //显示链路聚合信息 41 Preempt Delay Time: 30 //抢占延迟30秒 42 System Priority: 100 //系统优先级:100 43 Least Active-linknumber: 1 Max Active-linknumber: 2 (最大活跃链路:2) 44 Operate status: up (状态:up) 45 --------------------------------------------------------------------------------46 ActorPortName Status PortType PortPri PortNo47 GigabitEthernet0/0/1 Selected 1GE 32768 2 (lacp给本段接口分配的序号) 48 GigabitEthernet0/0/2 Selected 1GE 32768 3 49 GigabitEthernet0/0/3 Unselect 1GE 32768 450 51 备注: Selected :被选择的接口 52 Unselect :位被选择的接口53 PortPri : 端口lacp优先级54 PortNo : lacp 协议给成员口分配的编号55 56 Partner: (本段接口所连接的对端设备接口信息)57 --------------------------------------------------------------------------------58 ActorPortName SysPri SystemID PortPri PortNo59 GigabitEthernet0/0/1 32768 4c1f-ccef-5a42 32768 4 (lacp给对端接口分配的序号)60 GigabitEthernet0/0/2 32768 4c1f-ccef-5a42 32768 5 61 GigabitEthernet0/0/3 32768 4c1f-ccef-5a42 32768 6链路聚合综合实验
1 [S1]interface Eth-Trunk 1 3 [SW1-Eth-Trunk1]mode lacp-static 5 [S1-Eth-Trunk1]trunkportGigabitEthernet 0/0/3 0/0/4 //注意有空格 7 [S1-Eth-Trunk1]port link-typetrunk 9 [S1-Eth-Trunk1]port trunk allow-pass vlan all 13 [S2]interface Eth-Trunk 1 15 [SW2-Eth-Trunk1]mode lacp-static 17 [S2-Eth-Trunk1]trunkportGigabitEthernet 0/0/5 0/0/6 19 [S2-Eth-Trunk1]port link-typetrunk 21 [S2-Eth-Trunk1]port trunk allow-pass vlan ALL 25 [S3]interface Eth-Trunk 1 27 [SW3-Eth-Trunk1]mode lacp-static 29 [S3-Eth-Trunk1]trunkportGigabitEthernet 0/0/3 0/0/4 31 [S3-Eth-Trunk1]port link-typetrunk 33 [S3-Eth-Trunk1]port trunk allow-pass vlan all 37 [S4]interface Eth-Trunk 1 39 [SW4-Eth-Trunk1]mode lacp-static 41 [S4-Eth-Trunk1]trunkportGigabitEthernet 0/0/5 0/0/6 43 [S4-Eth-Trunk1]port link-typetrunk 45 [S4-Eth-Trunk1]port trunk allow-pass vlan all 49 [S5]interface Eth-Trunk 1 51 [SW5-Eth-Trunk1]mode lacp-static 53 [S5-Eth-Trunk1]trunkportGigabitEthernet 0/0/3 0/0/4 55 [S5-Eth-Trunk1]port link-typetrunk 57 [S5-Eth-Trunk1]port trunkallow-pass vlan all 59 [S5]interface Eth-Trunk 2 61 [SW5-Eth-Trunk2]mode lacp-static 63 [S5-Eth-Trunk2]trunkportGigabitEthernet 0/0/5 0/0/6 65 [S5-Eth-Trunk2]port link-typetrunk 67 [S5-Eth-Trunk2]port trunkallow-pass vlan all 69 [S5]interface Eth-Trunk 3 71 [SW5-Eth-Trunk3]mode lacp-static 73 [S5-Eth-Trunk3]trunkportGigabitEthernet 0/0/7 0/0/8 75 [S5-Eth-Trunk3]port link-typetrunk 77 [S5-Eth-Trunk3]port trunkallow-pass vlan all 81 [S6]interface Eth-Trunk 1 83 [SW6-Eth-Trunk1]mode lacp-static 85 [S6-Eth-Trunk1]trunkportGigabitEthernet 0/0/5 0/0/6 87 [S6-Eth-Trunk1]port link-typetrunk 89 [S6-Eth-Trunk1]port trunkallow-pass vlan all 91 [S6]interface Eth-Trunk 2 93 [SW6-Eth-Trunk2]mode lacp-static 95 [S6-Eth-Trunk2]trunkportGigabitEthernet 0/0/3 0/0/4 97 [S6-Eth-Trunk2]port link-typetrunk 99 [S6-Eth-Trunk2]port trunkallow-pass vlan all101 [S6]interface Eth-Trunk 3103 [SW6-Eth-Trunk3]mode lacp-static 105 [S6-Eth-Trunk3]trunkportGigabitEthernet 0/0/7 0/0/8107 [S6-Eth-Trunk3]port link-typetrunk109 [S6-Eth-Trunk3]port trunk allow-pass vlan all110 111 ## 2)S1-S6创建vlan112 113 [S1]vlan batch 10 20115 [S2]vlan batch 10 20117 [S3]vlan batch 10 20119 [S4]vlan batch 10 20121 [S5]vlan batch 10 20123 [S6]vlan batch 10 20124 125 ## 3)S1-S4端口加入vlan126 127 [S1]interface GigabitEthernet0/0/1129 [S1-GigabitEthernet0/0/1]portlink-type access 131 [S1-GigabitEthernet0/0/1]port default vlan 10135 [S2]interface GigabitEthernet0/0/1137 [S2-GigabitEthernet0/0/1]portlink-type access139 [S2-GigabitEthernet0/0/1]port default vlan 20143 [S3]interface GigabitEthernet0/0/1145 [S3-GigabitEthernet0/0/1]portlink-type access147 [S3-GigabitEthernet0/0/1]port default vlan 10151 [S4]interface GigabitEthernet0/0/1153 [S4-GigabitEthernet0/0/1]portlink-type access155 [S4-GigabitEthernet0/0/1]port default vlan 20
Copyright © 2015-2022 南极快报网版权所有 备案号:粤ICP备2022077823号-13 联系邮箱: 317 493 128@qq.com