华为基于mac地址vlan和基于IP地址的vlan
【基于MAC地址的vlan】
vlan 5
mac-vlan mac-address 5489-983e-251f priority 0
mac-vlan mac-address 5489-98c6-337e priority 0
interface GigabitEthernet0/0/1
port hybrid untagged vlan 5
mac-vlan enable
#
interface GigabitEthernet0/0/2
port hybrid untagged vlan 5
mac-vlan enable
【基于 IP地址的vlan】
SW1的配置
vlan 6
ip-subnet-vlan 1 ip 192.168.1.3 255.255.255.255
ip-subnet-vlan 2 ip 192.168.1.4 255.255.255.255
interface GigabitEthernet0/0/3
port hybrid untagged vlan 2 to 4094
mac-vlan enable
ip-subnet-vlan enable
#
interface GigabitEthernet0/0/4
port hybrid untagged vlan 2 to 4094 //一种偷懒的配置方法
mac-vlan enable
ip-subnet-vlan enable
interface GigabitEthernet0/0/5
port link-type trunk
port trunk allow-pass vlan 2 to 4094 //设置上联端口
SW2的配置
vlan 6
ip-subnet-vlan 2 ip 192.168.1.5 255.255.255.255
#
interface GigabitEthernet0/0/1
port hybrid untagged vlan 6
ip-subnet-vlan enable //开启IP-subnet-vlan 功能
interface GigabitEthernet0/0/5
port link-type trunk
port trunk allow-pass vlan 2 to 4094 //设置上联端口