0x0 拓扑图

  • 要求
    1. 所有交换机属于一个MST域
    2. 所有交换机的实例1包含vlan10、vlan20;实例2包含vlan30、vlan40
    3. LSW1的为实例1的主根,LSW2为实例2的主根
    4. LSW1和LSW2运行VRRP协议
    5. LSW1为vlan 10 20 30的MASTER,LSW2为vlan40的MASTER
    6. 所有PC机可以互通

0x1 指令配置

  • LSW1
    undo info-center enable
    vlan batch 10 20 30 40
    stp instance 1 priority 4096
    stp instance 2 priority 8192 //更改实例对应的优先级
    stp region-configuration //设置MSTP区域
     region-name RA
     revision-level 1
     instance 1 vlan 10 20
     instance 2 vlan 30 40
     active region-configuration
    interface Vlanif10 //设置SVI10 维护的虚拟IP
     ip address 192.168.10.252 255.255.255.0
     vrrp vrid 10 virtual-ip 192.168.10.254
     vrrp vrid 10 priority 110
    interface Vlanif20
     ip address 192.168.20.252 255.255.255.0
     vrrp vrid 20 virtual-ip 192.168.20.254
     vrrp vrid 20 priority 110
    interface Vlanif30
     ip address 192.168.30.252 255.255.255.0
     vrrp vrid 30 virtual-ip 192.168.30.254
     vrrp vrid 30 priority 110
    interface Vlanif40
     ip address 192.168.40.252 255.255.255.0
     vrrp vrid 40 virtual-ip 192.168.40.254
    interface GigabitEthernet0/0/1
     port link-type access
     port default vlan 40
    interface GigabitEthernet0/0/2
     port link-type trunk
     port trunk allow-pass vlan 2 to 4094
    interface GigabitEthernet0/0/3
     port link-type trunk
     port trunk allow-pass vlan 2 to 4094
    
  • LSW2
    undo info-center enable
    vlan batch 10 20 30 40
    stp instance 1 priority 8192
    stp instance 2 priority 4096 //更改实例对应的优先级
    stp region-configuration //设置MSTP区域
     region-name RA
     revision-level 1
     instance 1 vlan 10 20
     instance 2 vlan 30 40
     active region-configuration
    interface Vlanif10 //设置SVI10 维护的虚拟IP
     ip address 192.168.10.252 255.255.255.0
     vrrp vrid 10 virtual-ip 192.168.10.254
    interface Vlanif20
     ip address 192.168.20.252 255.255.255.0
     vrrp vrid 20 virtual-ip 192.168.20.254
    interface Vlanif30
     ip address 192.168.30.252 255.255.255.0
     vrrp vrid 30 virtual-ip 192.168.30.254
    interface Vlanif40 //设置SVI40 维护的IP和优先级
     ip address 192.168.40.252 255.255.255.0
     vrrp vrid 40 virtual-ip 192.168.40.254
     vrrp vrid 40 priority 110
    interface GigabitEthernet0/0/1
     port link-type access
     port default vlan 30
    interface GigabitEthernet0/0/2
     port link-type trunk
     port trunk allow-pass vlan 2 to 4094
    interface GigabitEthernet0/0/3
     port link-type trunk
     port trunk allow-pass vlan 2 to 4094
    
  • LSW3
    undo info-center enable
    vlan batch 10 20 30 40
    stp region-configuration //设置MSTP区域
     region-name RA
     revision-level 1
     instance 1 vlan 10 20
     instance 2 vlan 30 40
     active region-configuration
    interface GigabitEthernet0/0/1 //设置接口模式
     port link-type trunk
     port trunk allow-pass vlan 2 to 4094
    interface GigabitEthernet0/0/2
     port link-type trunk
     port trunk allow-pass vlan 2 to 4094
    interface GigabitEthernet0/0/3
     port link-type access
     port default vlan 10
    interface GigabitEthernet0/0/4
     port link-type access
     port default vlan 20
    interface GigabitEthernet0/0/5
     port link-type access
     port default vlan 40
    

0x2 连通性验证

  • MSTI1主根验证

  • MSTI2主根验证

  • LSW1为vlan 10 vlan 20 vlan 30的MSATER
  • LSW2为vlan 40的MASTER

  • PC1(vlan40) -> PC7(VLAN40),因为vlan40属于实例2,对于LSW3的实例2应该阻塞g0/0/1,再g0/0/2口抓包

  • PC1(vlan40) -> PC3(VLAN10),因为vlan40属于实例2,对于LSW3的实例2应该阻塞g0/0/1,再g0/0/2口抓包

因为三层交换机使用的是SVI接口,在入接口打上对应的PVID后,转发的时候会查看是二层转发还是三层转发,三层转发就要查路由表,并且把vlan id改变成转发目的对应的vlan id(svi的交换层次把id去掉,交给接收方的网关,网关再转发,转发的时候打上接收方的id),所以在交换机内部数据包的Vlan id被改为10 所以会走左边进行转发

  • PC1(vlan40) -> PC3(VLAN10),因为vlan40属于实例2,对于LSW3的实例2应该阻塞g0/0/1,再g0/0/2口抓包

  • VRRP备份验证
  • PC1(vlan40) -> PC7(VLAN40)
  • 删除这条线后
  • PC1(vlan40) -> PC7(VLAN40)
  • PC1(vlan40) -> PC7(VLAN40) 走备份链路