2-VLAN原理和配置
2-VLAN原理和配置
VLAN配置
[SWA] vlan 10
[SWA-vlan10]quit
创建多个连续VLAN
[SWA] vlan batch 2 to 3
创建多个不连续的VLAN
[SWA] vlan 4 5
配置验证
[SWA]display vlan
配置Access端口
[SWA]interface g0/0/5
[SWA-Gigabitethernet0/0/5] port link-type access
[SWA-Gigabitethernet0/0/5] interface G0/0/7
[SWA-Gigabitethernet0/0/7] port link-type access
添加端口到VLAN
[SWA] vlan 2
[SWA-vlan2] port GigabitEthernet 0/0/7
[SWA-vlan2] quit
[SWA]interface g0/0/5
[SWA-Gigabitethernet0/0/5] port default vlan 3
配置Trunk端口
[SWA-GigabitEthernet0/0/1] port link-type trunk
[SWA-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 3
执行port trunk pvid vlan vlan-id
命令,可以修改trunk端口的PVID。修改Trunk端口的PVID之后,需要注意:缺省VLAN不一定是端口允许通过的VLAN。只有使用命令port trunk allow-pass vlan {{ vlan-id1 [to vlan-id2]} | all}
允许缺省VLAN通过,才能转发缺省VLAN的数据帧。交换机的所有端口默认允许VLAN1的数据通过。
配置Hybrid端口
[SWA-GigabitEthernet0/0/1] port link-type hybrid
[SWA-GigabitEthernet0/0/1] port hybrid tagged vlan 2 3 100
[SWA-GigabitEthernet0/0/2] port hybrid pvid vlan 2
[SWA-GigabitEthernet0/0/2] port hybrid untagged vlan 2 100
[SWA-GigabitEthernet0/0/3] port hybrid pvid vlan 3
[SWA-GigabitEthernet0/0/3] port hybrid untagged vlan 3 100
[SWB-GigabitEthernet0/0/1] port link-type hybrid
[SWB-GigabitEthernet0/0/1] port hybrid tagged vlan 2 3 100
[SWB-GigabitEthernet0/0/2] port hybrid pvid vlan 100
[SWB-GigabitEthernet0/0/2] port hybrid untagged vlan 2 3 100