一、Monitor link (监控链路)技术产生背景---为解决什么问题而产生的技术
在Smart Link协议中,开启Smart Link协议的交换机可以判断自己的主端口是否出现故障,从而是否切换到备用端口,但其上行交换机非直连端口如果出现故障,开启Smart Link协议的交换机是无法得知的,这样会导致主链路不通,但开启Smart Link协议的交换机自认为主链路正常,导致数据丢失。
针对上述问题,华为公司开发了Monitor Link私有协议,其主要作用是在一定场景下配合Smart Link的使用,从而更好地避免丢帧情况的发生。
二、Monitor Link协议工作原理
Monitor Link组上行端口不能正常工作时,其所有的下行端口会因此而被Down掉。如果上行端口恢复正常工作,则其下行端口也会自动重新Up,这就是MonitorLink的回切功能。类似Smart Link协议,也可以为Monitor Link回切功能配置一个合适的回切时间。
配置思路
(1)创建Monitor Link组,并添加相应上行端口和下行端口;
(2)配置Monitor Link组的回切时间。
三、示例测验
示例场景
在开启Smart Link协议的交换机配置Monitor Link协议,Monitor Link组上行端口和下行端口进行联动,让Smart Link组实现自动切换到备用端口,防止数据丢失。
拓扑图
代码段
system-view
sysname R
interface GigabitEthernet 0/0/0
ip address 1.1.1.254 24
system-view
sysname SW
interface GigabitEthernet 0/0/1
smart-link flush receive control-vlan 10 password simple 333
interface GigabitEthernet 0/0/2
smart-link flush receive control-vlan 10 password simple 333
interface GigabitEthernet 0/0/24
smart-link flush receive control-vlan 10 password simple 333
system-view
sysname SW1
interface GigabitEthernet 0/0/1
smart-link flush receive control-vlan 10 password simple 333
interface GigabitEthernet 0/0/2
smart-link flush receive control-vlan 10 password simple 333
interface GigabitEthernet 0/0/3
smart-link flush receive control-vlan 10 password simple 333
system-view
sysname SW2
monitor-link group 1
port GigabitEthernet 0/0/2 uplink
port GigabitEthernet 0/0/1 downlink 1
timer recover-time 10
interface GigabitEthernet 0/0/1
smart-link flush receive control-vlan 10 password simple 333
interface GigabitEthernet 0/0/2
smart-link flush receive control-vlan 10 password simple 333
system-view
sysname SW3
monitor-link group 1
port GigabitEthernet 0/0/1 uplink
port GigabitEthernet 0/0/2 downlink 1
timer recover-time 10
interface GigabitEthernet 0/0/1
smart-link flush receive control-vlan 10 password simple 333
interface GigabitEthernet 0/0/2
smart-link flush receive control-vlan 10 password simple 333
system-view
sysname SW4
interface GigabitEthernet 0/0/1
stp disable
interface GigabitEthernet 0/0/2
stp disable
smart-link group 1
port GigabitEthernet 0/0/1 master
port GigabitEthernet 0/0/2 slave
flush send control-vlan 10 password simple 333
restore enable
timer wtr 30
smart-link enable
monitor-link group 1
smart-link group 1 uplink
port Ethernet0/0/1 downlink 1
port Ethernet0/0/2 downlink 2
timer recover-time 10
interface Ethernet 0/0/1
smart-link flush receive control-vlan 10 password simple 333
interface Ethernet 0/0/2
smart-link flush receive control-vlan 10 password simple 333
system-view
sysname SW5
interface GigabitEthernet 0/0/1
stp disable
interface Ethernet 0/0/1
stp disable
smart-link group 1
port GigabitEthernet 0/0/1 master
port Ethernet 0/0/1 slave
flush send control-vlan 10 password simple 333
restore enable
timer wtr 30
smart-link enable
system-view
sysname SW6
monitor-link group 1
port GigabitEthernet 0/0/2 uplink
port GigabitEthernet 0/0/1 downlink 1
port GigabitEthernet 0/0/3 downlink 2
timer recover-time 10
interface GigabitEthernet 0/0/1
smart-link flush receive control-vlan 10 password simple 333
interface GigabitEthernet 0/0/2
smart-link flush receive control-vlan 10 password simple 333
interface GigabitEthernet 0/0/3
smart-link flush receive control-vlan 10 password simple 333
system-view
sysname SW7
interface GigabitEthernet 0/0/1
stp disable
interface Ethernet 0/0/2
stp disable
smart-link group 1
port GigabitEthernet 0/0/1 slave
port Ethernet 0/0/2 master
flush send control-vlan 10 password simple 333
restore enable
timer wtr 30
smart-link enable
代码解释
<Huawei>system-view
[Huawei]sysname R
[R]interface GigabitEthernet 0/0/0
[R-GigabitEthernet0/0/0]ip address 1.1.1.254 24 \\给路由器R的GE0/0/0端口设置IP地址
<Huawei>system-view
[Huawei]sysname SW
[SW]interface GigabitEthernet 0/0/1
[SW-GigabitEthernet0/0/1]smart-link flush receive control-vlan 10 password simple 333 \\SW的GE0/0/1端口允许接收属于控制vlan 10的Flush帧
[SW-GigabitEthernet0/0/1]interface GigabitEthernet 0/0/2
[SW-GigabitEthernet0/0/2]smart-link flush receive control-vlan 10 password simple 333 \\SW的GE0/0/2端口允许接收属于控制vlan 10的Flush帧
[SW-GigabitEthernet0/0/2]interface GigabitEthernet 0/0/24
[SW-GigabitEthernet0/0/24]smart-link flush receive control-vlan 10 password simple 333 \\SW的GE0/0/24端口允许接收属于控制vlan 10的Flush帧
<Huawei>system-view
[Huawei]sysname SW1
[SW1]interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1]smart-link flush receive control-vlan 10 password simple 333 \\SW1的GE0/0/1端口允许接收属于控制vlan 10的Flush帧
[SW1-GigabitEthernet0/0/1]interface GigabitEthernet 0/0/2
[SW1-GigabitEthernet0/0/2]smart-link flush receive control-vlan 10 password simple 333 \\SW1的GE0/0/2端口允许接收属于控制vlan 10的Flush帧
[SW1-GigabitEthernet0/0/2]interface GigabitEthernet 0/0/3
[SW1-GigabitEthernet0/0/3]smart-link flush receive control-vlan 10 password simple 333 \\SW1的GE0/0/3端口允许接收属于控制vlan 10的Flush帧
<Huawei>system-view
[Huawei]sysname SW2
[SW2]monitor-link group 1 \\创建monitor-link组1
[SW2-mtlk-group1]port GigabitEthernet 0/0/2 uplink \\设置SW2的GE0/0/2端口为monitor-link组1的上行端口
[SW2-mtlk-group1]port GigabitEthernet 0/0/1 downlink 1 \\设置SW2的GE0/0/1端口为monitor-link组1的下行端口1
[SW2-mtlk-group1]timer recover-time 10 \\monitor-link组1的回切时间为10秒
[SW2-mtlk-group1]interface GigabitEthernet 0/0/1
[SW2-GigabitEthernet0/0/1]smart-link flush receive control-vlan 10 password simple 333 \\SW2的GE0/0/1端口允许接收属于控制vlan 10的Flush帧
[SW2-GigabitEthernet0/0/1]interface GigabitEthernet 0/0/2
[SW2-GigabitEthernet0/0/2]smart-link flush receive control-vlan 10 password simple 333 \\SW2的GE0/0/2端口允许接收属于控制vlan 10的Flush帧
<Huawei>system-view
[Huawei]sysname SW3
[SW3]monitor-link group 1 \\创建monitor-link组1
[SW3-mtlk-group1]port GigabitEthernet 0/0/1 uplink \\设置SW3的GE0/0/1端口为monitor-link组1的上行端口
[SW3-mtlk-group1]port GigabitEthernet 0/0/2 downlink 1 \\设置SW2的GE0/0/1端口为monitor-link组1的下行端口1
[SW3-mtlk-group1]timer recover-time 10 \\monitor-link组1的回切时间为10秒
[SW3-mtlk-group1]interface GigabitEthernet 0/0/1
[SW3-GigabitEthernet0/0/1]smart-link flush receive control-vlan 10 password simple 333 \\SW3的GE0/0/1端口允许接收属于控制vlan 10的Flush帧
[SW3-GigabitEthernet0/0/1]interface GigabitEthernet 0/0/2
[SW3-GigabitEthernet0/0/2]smart-link flush receive control-vlan 10 password simple 333 \\SW3的GE0/0/2端口允许接收属于控制vlan 10的Flush帧
<Huawei>system-view
[Huawei]sysname SW4
[SW4]interface GigabitEthernet 0/0/1
[SW4-GigabitEthernet0/0/1]stp disable \\关闭STP生成树功能
[SW4-GigabitEthernet0/0/1]interface GigabitEthernet 0/0/2
[SW4-GigabitEthernet0/0/2]stp disable \\关闭STP生成树功能
[SW4-GigabitEthernet0/0/2]smart-link group 1 \\创建smart-link组1
[SW4-smlk-group1]port GigabitEthernet 0/0/1 master \\将GE0/0/1设置为smart-link组1的主端口
[SW4-smlk-group1]port GigabitEthernet 0/0/2 slave \\将GE0/0/2设置为smart-link组1的备用端口
[SW4-smlk-group1]flush send control-vlan 10 password simple 333 \\SW4的smart-link组1发送属于控制vlan 10的Flush帧
[SW4-smlk-group1]restore enable \\开启回切功能
[SW4-smlk-group1]timer wtr 30 \\设置回切时间为30秒
[SW4-smlk-group1]smart-link enable \\开启smart-link
[SW4-smlk-group1]monitor-link group 1 \\创建monitor-link组1
[SW4-mtlk-group1]smart-link group 1 uplink \\设置SW4的smart-link group 1为monitor-link组1的上行端口
[SW4-mtlk-group1]port Ethernet0/0/1 downlink 1 \\设置SW4的E0/0/1端口为monitor-link组1的下行端口1
[SW4-mtlk-group1]port Ethernet0/0/2 downlink 2 \\设置SW4的E0/0/2端口为monitor-link组1的下行端口2
[SW4-mtlk-group1]timer recover-time 10 \\monitor-link组1的回切时间为10秒
[SW4-mtlk-group1]interface Ethernet 0/0/1
[SW4-Ethernet0/0/1]smart-link flush receive control-vlan 10 password simple 333 \\SW4的E0/0/1端口允许接收属于控制vlan 10的Flush帧
[SW4-Ethernet0/0/1]interface Ethernet 0/0/2
[SW4-Ethernet0/0/2]smart-link flush receive control-vlan 10 password simple 333 \\SW4的E0/0/2端口允许接收属于控制vlan 10的Flush帧
<Huawei>system-view
[Huawei]sysname SW5
[SW5]interface GigabitEthernet 0/0/1
[SW5-GigabitEthernet0/0/1]stp disable \\关闭STP生成树功能
[SW5-GigabitEthernet0/0/1]interface Ethernet 0/0/1
[SW5-Ethernet0/0/1]stp disable \\关闭STP生成树功能
[SW5-Ethernet0/0/1]smart-link group 1 \\创建smart-link组1
[SW5-smlk-group1]port GigabitEthernet 0/0/1 master \\将GE0/0/1设置为smart-link组1的主端口
[SW5-smlk-group1]port Ethernet 0/0/1 slave \\将E0/0/1设置为smart-link组1的备用端口
[SW5-smlk-group1]flush send control-vlan 10 password simple 333 \\SW5的smart-link组1发送属于控制vlan 10的Flush帧
[SW5-smlk-group1]restore enable \\开启回切功能
[SW5-smlk-group1]timer wtr 30 \\设置回切时间为30秒
[SW5-smlk-group1]smart-link enable \\开启smart-link
<Huawei>system-view
[Huawei]sysname SW6
[SW6]monitor-link group 1 \\创建monitor-link组1
[SW6-mtlk-group1]port GigabitEthernet 0/0/2 uplink \\设置SW6的smart-link group 1为monitor-link组1的上行端口
[SW6-mtlk-group1]port GigabitEthernet 0/0/1 downlink 1 \\设置SW6的GE0/0/1端口为monitor-link组1的下行端口1
[SW6-mtlk-group1]port GigabitEthernet 0/0/3 downlink 2 \\设置SW6的GE0/0/3端口为monitor-link组1的下行端口2
[SW6-mtlk-group1]timer recover-time 10 \\monitor-link组1的回切时间为10秒
[SW6-mtlk-group1]interface GigabitEthernet 0/0/1
[SW6-GigabitEthernet0/0/1]smart-link flush receive control-vlan 10 password simple 333 \\SW6的GE0/0/1端口允许接收属于控制vlan 10的Flush帧
[SW6-GigabitEthernet0/0/1]interface GigabitEthernet 0/0/2
[SW6-GigabitEthernet0/0/2]smart-link flush receive control-vlan 10 password simple 333 \\SW6的GE0/0/2端口允许接收属于控制vlan 10的Flush帧
[SW6-GigabitEthernet0/0/2]interface GigabitEthernet 0/0/3
[SW6-GigabitEthernet0/0/3]smart-link flush receive control-vlan 10 password simple 333 \\SW6的GE0/0/3端口允许接收属于控制vlan 10的Flush帧
<Huawei>system-view
[Huawei]sysname SW7
[SW7]interface GigabitEthernet 0/0/1
[SW7-GigabitEthernet0/0/1]stp disable \\关闭STP生成树功能
[SW7-GigabitEthernet0/0/1]interface Ethernet 0/0/2
[SW7-Ethernet0/0/2]stp disable \\关闭STP生成树功能
[SW7-Ethernet0/0/2]smart-link group 1 \\创建smart-link组1
[SW7-smlk-group1]port GigabitEthernet 0/0/1 slave \\将GE0/0/1设置为smart-link组1的备用端口
[SW7-smlk-group1]port Ethernet 0/0/2 master \\将E0/0/2设置为smart-link组1的主端口
[SW7-smlk-group1]flush send control-vlan 10 password simple 333 \\SW7的smart-link组1发送属于控制vlan 10的Flush帧
[SW7-smlk-group1]restore enable \\开启回切功能
[SW7-smlk-group1]timer wtr 30 \\设置回切时间为30秒
[SW7-smlk-group1]smart-link enable \\开启smart-link
测试验证