Hybrid接口的工作原理涉及及接口的三个属性:
分别为:untag列表,tag列表,PVID(port-base VLAN ID,基于端口的VLAN ID)
-
untag列表:只在接口发送数据帧时起作用,如果需要发送的数据的VLAN标签在接口的untag列表中,那么将去除标签发送数据。
-
tag列表:作用于接受别标记的数据帧和发送数据帧。其作用类似于一个允许的vlan标识列表。当接口接收到带vlan标签的数据帧时,该接口的tag列表相当于vlan的允许列表,不在列表中的数据帧将被丢弃;当接口发送数据帧时,数据的vlan标签在接口的tag列表中,将保持标签发送数据帧,否则丢弃数据帧。
-
PVID:接口默认PVID为vlan1,PVID只在接收未标记帧中起作用。PVID用于接收未标记数据帧时给数据帧打上当前的PVID标记。
实验案例:(本是实验中不涉及同vlan通信,因此不需要配置 <tag列表> )
某公司内部网络由四个vlan构成,分别为vlan10 vlan20 vlan30 及服务器 vlan100 公司核心交换机是一台华为交换机 。公司要求每个vlan的员工都能够访问到服务器,但各部门之间都不能相互访问。
如图所示:
- 为客户端配置IP地址
- 配置hybrid接口
[sw1]interface Ethernet 0/0/1
[sw1-Ethernet0/0/1]port link-type hybrid
[sw1-Ethernet0/0/1]port hybrid pvid vlan 10
[sw1-Ethernet0/0/1]port hybrid untagged vlan 10 100
.
[sw1]interface Ethernet 0/0/2
[sw1-Ethernet0/0/1]port link-type hybrid
[sw1-Ethernet0/0/1]port hybrid pvid vlan 20
[sw1-Ethernet0/0/1]port hybrid untagged vlan 20 100
.
[sw1]interface Ethernet 0/0/3
[sw1-Ethernet0/0/1]port link-type hybrid
[sw1-Ethernet0/0/1]port hybrid pvid vlan 30
[sw1-Ethernet0/0/1]port hybrid untagged vlan 30 100
.
[sw1]interface Ethernet 0/0/4
[sw1-Ethernet0/0/1]port link-type hybrid
[sw1-Ethernet0/0/1]port hybrid pvid vlan 100
[sw1-Ethernet0/0/1]port hybrid untagged vlan 10 20 30 100 - 验证实验结果。
1) 用vlan10的主机验证。
2) 用vlan20的主机验证。
3) 用vlan30的主机验证。