划分VLAN
单独划分
[SW1]vlan 2 #创建Vlan [SW1-vlan2]q [SW1]int g0/0/1 #进入接口试图配置 [SW1-GigabitEthernet0/0/1]port link-type access #配置接口类型为Access模式,Access模式一般用户交换机和主机之间的连接,只属于一个Vlan [SW1-GigabitEthernet0/0/1]port default vlan 2 #将接口添加到Vlan 2中
使用Group接口批量划分Vlan
[Huawei]vlan 3
[Huawei-vlan2]q
[Huawei]port-group 1 #创建接口组1 并进入其试图
[Huawei-port-group-1]group-member g0/0/1 g0/0/2 #将接口依次添加到接口组中
[Huawei-port-group-1]port link-type access #将接口组的类型设置为Access模式
[Huawei-port-group-1]port default vlan 3 #将接口组加入Vlan 3
[SW3]vlan 2
[SW3-vlan2]q
[SW3]port-group group-member g0/0/1 to g0/0/4 #创建临时的接口组,并将g0/0/1到g0/0/4的接口添加到临时接口组中
[SW3-port-group]port link-type access #将接口组的类型设置为Access模式
[SW3-port-group]port default vlan 2 #将接口组加入Vlan 2
Trunk接口模式
使用场景:用户交换机之间的连接,允许多个Vlan通信
[SW1]int g0/0/5
[SW1-GigabitEthernet0/0/5]port link-type trunk #设置接口类型为Trunk模式
[SW1-GigabitEthernet0/0/5]port trunk allow-pass vlan all #允许所有的Vlan通过
Eth-Trunk链路聚合模式
手工模式:分担流量,实现负载均衡,所有加入Eth-Trunk的链路都会进行数据的转发。
手工模式:
[SW1]interface Eth-Trunk 1 #接口聚合链路的名字
[SW1-Eth-Trunk1]mode manual load-balance
[SW1-Eth-Trunk1]trunkport g 0/0/5 to 0/0/7
[SW1-Eth-Trunk1]port link-type trunk
[SW1-Eth-Trunk1]port trunk allow-pass vlan all
删除手工模式:
[SW1]interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1]undo eth-trunk 1
[SW1-GigabitEthernet0/0/1]q
[SW1]undo interface Eth-Trunk 1
LACP:LACP模式也称为M:N模式,其中M条链路处于活动状态转发数据,N条链路处于非活动状态作为备份链路。
抢占模式:让主链路在恢复正常状态时,能够优先接管流量传输,以确保主链路优先用于数据传输。
LACP模式:
[SW1]lacp priority 100 #指定LACP的优先级,值越低优先级越高,默认优先级是32768
[SW1]interface Eth-Trunk 1
[SW1-Eth-Trunk1]mode lacp-static #设置聚合链路的模式是LACP模式
[SW1-Eth-Trunk1]trunkport g 0/0/5 to 0/0/7
[SW1-Eth-Trunk1]port link-type trunk
[SW1-Eth-Trunk1]port trunk allow-pass vlan all
[SW1-Eth-Trunk1]max active-linknumber 2 #指定最大活动链路是2
LACP-抢占模式:
[SW1]int Eth-Trunk 1
[SW1-Eth-Trunk1]lacp preempt enable #开启抢占模式
[SW1-Eth-Trunk1]lacp preempt delay 10 #配置抢占模式的时间为10s