SW1为接入层交换机,上联SW2和SW3双上行到出口交换机S4,SW4连接外网.
SW1,SW2,SW3,SW4位置4个VLAN,VLAN 10,20,30,40
4台机器都如下配置
[SW1]vlan batch 10 20 30 40
[SW1]interface g0/0/1
[SW1-GigabitEthernet0/0/1]port link-type trunk
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20 30 40
[SW1-GigabitEthernet0/0/1]int g0/0/2
[SW1-GigabitEthernet0/0/2]port link-type trunk
[SW1-GigabitEthernet0/0/2]port trunk allow-pass vlan 10 20 30 40
查看
[SW1-GigabitEthernet0/0/2]dis port vlan
在SW1上创建Smart Link组,设备最大16个组
[SW1]smart-link group 1
查看SMLK 1组
[SW1-smlk-group1]dis smart-link group 1
报错了,因为有几种情况不能加入smlk口,上面stp就不能
我们去g0/0/1 g0/0/2关闭stp
[SW1-smlk-group1]int g 0/0/1
[SW1-GigabitEthernet0/0/1]stp disable
[SW1-GigabitEthernet0/0/1]int g0/0/2
[SW1-GigabitEthernet0/0/2]stp disable
然后我们在加入下
[SW1]smart-link group 1
[SW1-smlk-group1]port g 0/0/1 master
[SW1-smlk-group1]port g 0/0/2 slave
我们在查看下smlk的配置
我们还需要配置flush报文才能切换,用vlan10来发送控制vlan
[SW1]smart-link group 1
[SW1-smlk-group1]flush send control-vlan 10 password simple wgg //刷新发送VLAN 10控制,密码wgg
密码是可选项,VLAN必须使用已存在的VLAN,密码VLAN大家都要相同
SW2,3,4都去配置下
[SW2]int g 0/0/1
[SW2-GigabitEthernet0/0/1]smart-link flush receive control-vlan 10 password simple wgg
[SW2-GigabitEthernet0/0/1]int g0/0/2
[SW2-GigabitEthernet0/0/2] smart-link flush receive control-vlan 10 password simple wgg
其他2台配置相同
[SW3]int g 0/0/1
[SW3-GigabitEthernet0/0/1]smart-link flush receive control-vlan 10 password simple wgg
[SW3-GigabitEthernet0/0/1]int g0/0/2
[SW3-GigabitEthernet0/0/2]smart-link flush receive control-vlan 10 password simple wgg
[SW4]int g 0/0/1
[SW4-GigabitEthernet0/0/1]smart-link flush receive control-vlan 10 password simple wgg
[SW4-GigabitEthernet0/0/1]int g0/0/2
[SW4-GigabitEthernet0/0/2]smart-link flush receive control-vlan 10 password simple wgg
检测Flush报文配置命令
[SW2-GigabitEthernet0/0/2]dis smart-link flush
我们现在都配置好了,现在就要在SW1上启用SMLK功能了
[SW1]smart-link g 1
[SW1-smlk-group1]smart-link enable
现在我们在查看ok了
在SW2上关闭g0/0/1口,查看smlk 1的状态
[SW2]int g0/0/1
[SW2-GigabitEthernet0/0/1]shu
[SW2-GigabitEthernet0/0/1]shutdown
我们去SW1查看
1口gg了,现在2口激活
回到SW2,打开1口
[SW2-GigabitEthernet0/0/1]un shut
查看SW1
1口继续gg,我们需要通过下面2种办法来抢占回来
在SW1上配置,默认回切时间60s,我们可用改下
[SW1]sm g 1
[SW1-smlk-group1]restore enable
[SW1-smlk-group1]timer wtr 30
第二种方法,我们进行强制切回
[SW1-smlk-group1]smart-link manual switch
这时我们在SW2上会看到下面的Flush报文
[SW2-GigabitEthernet0/0/1]dis smart-link flush
[SW1]sm g 1
[SW1-smlk-group1]smart-link hold-time 1 //这里1是100ms
这个功能锁定掉接口,但是出问题也不会切换
[SW1-smlk-group1]smart-link force //锁定在从接口
[SW1-smlk-group1]smart-link lock //锁定在主接口
配置VLAN和Trunk和前面一样
负载分担要用到MSTP生成树
[SW1]stp region-configuration
[SW1-mst-region]instance 1 vlan 20 30 40
[SW1-mst-region]active region-configuration
在SW1上配置
[SW1-smlk-group1]load-balance instance 1 slave //让instance 1走从接口,实现分组
由于我是接着前面的实验做的,所以要设置负载均衡会报错,说已经启用了smlk
用下面的命令先把smlk停止了,在去配置
[SW1-smlk-group1]un smart-link enable
[SW1-smlk-group1]smart-link enable
检查下,下面有这个load-balance说明生效了