华为特有接口Hybrid
用Hybrid接口实现access、trunk功能
拓扑图如下:
用Hybrid接口来当access用:两台交换机都配置
<Huawei>system-view [Huawei]undo info-center enable [Huawei]vlan batch 10 20 [Huawei]interface GigabitEthernet 0/0/2 [Huawei-GigabitEthernet0/0/2]port hybrid pvid vlan 10 #pvid为vlan 10 [Huawei-GigabitEthernet0/0/2]port hybrid untagged vlan 10 #不打vlan标签 [Huawei-GigabitEthernet0/0/2]inter gig0/0/3 [Huawei-GigabitEthernet0/0/3]port hybrid pvid vlan 20 #pvid为vlan 20 [Huawei-GigabitEthernet0/0/3]port hybrid untagged vlan 20 #不打vlan标签
用Hybrid接口来当trunk用:两台交换机都配置
[Huawei-GigabitEthernet0/0/1]port hybrid tagged vlan 10 20 #允许vlan 10 20的数据通过并打上vlan标签
我们将G0/0/10接口设置为access,G0/0/11设置为trunk,可以看到效果和Hybrid基本相同
用Hybrid接口实现端口隔离:
网络拓扑图:
需求:PC1、PC2可以与出口路由器通信,但PC1与PC2不能通信
SW1配置:
<Huawei>system-view [Huawei]undo info-center enable [Huawei]sysname sw1 [sw1]vlan batch 10 20 30
[sw1]interface GigabitEthernet 0/0/2 [sw1-GigabitEthernet0/0/2]port hybrid pvid vlan 30 #本征vlan 30 [sw1-GigabitEthernet0/0/2]port hybrid untagged vlan 10 30 #允许不打标记的vlan 10 30数据通过 [sw1-GigabitEthernet0/0/2]inter gig0/0/3 #进入G0/0/3 [sw1-GigabitEthernet0/0/3]port hybrid pvid vlan 20 #本征vlan 20 [sw1-GigabitEthernet0/0/3]port hybrid untagged vlan 20 30 #允许不打标记的vlan 20 30数据通过 [sw1-GigabitEthernet0/0/3]inte gig0/0/1 #进入G0/0/1 [sw1-GigabitEthernet0/0/1]port hybrid pvid vlan 10 #本征vlan 10 [sw1-GigabitEthernet0/0/1]port hybrid untagged vlan 10 20 30 #允许不打标记的vlan 10 20 30数据通过