实验拓扑:
实验步骤
[sw1]vlan batch 5 10
[sw1]interface GigabitEthernet 0/0/1
[sw1-GigabitEthernet0/0/1]port hybrid pvid vlan 5 //确保该端口的入向数据打标签 valn5
[sw1-GigabitEthernet0/0/1]port hybrid untagged vlan 5 //确保交换机之间的链路转发数据出去时 携带标签vlan 5 为了让sw2识别
[sw1]interface GigabitEthernet 0/0/24
[sw1-GigabitEthernet0/0/24]port hybrid tagged vlan 5
------------------------------------------------------
[sw1]interface GigabitEthernet 0/0/2
[sw1-GigabitEthernet0/0/2]port hybrid pvid vlan 10
[sw1-GigabitEthernet0/0/2]port hybrid untagged vlan 10
[sw1]interface GigabitEthernet 0/0/24
[sw1-GigabitEthernet0/0/24]port hybrid tagged vlan 10
=========================================================
[sw2]vlan batch 5 10
[sw2]interface GigabitEthernet 0/0/3
[sw2-GigabitEthernet0/0/3]port hybrid pvid vlan 5
[sw2-GigabitEthernet0/0/3]port hybrid untagged vlan 5 //sw2收到后携带标签vlan 5 的数据后 将其拆除 在g0/0/3发出去
[sw2]interface GigabitEthernet 0/0/24
[sw2-GigabitEthernet0/0/24]port hybrid tagged vlan 5
----------------------------------------------------------
[sw2]interface GigabitEthernet 0/0/4
[sw2-GigabitEthernet0/0/4]port hybrid pvid vlan 10
[sw2-GigabitEthernet0/0/4]port hybrid untagged vlan 10
[sw2]interface GigabitEthernet 0/0/24
[sw2-GigabitEthernet0/0/24]port hybrid tagged vlan 10
实验结果:
PC1--PC3互通 PC2--PC4互通