In this section, we will discuss about remaining VLAN types in continuation in last post VLAN technology.
MAC-based VLAN
The MAC-based VLAN divides VLAN ID for packets according to the source MAC address of the received packets. The untag packets received in the port are process as follows according to different configuration:
- If the source MAC and the MAC address of MAC-based VLAN are consistent, and the In port of the packets is allocated to the VLAN of the corresponding VLAN ID, the packet is allocated to the VLAN ID corresponding to the MAC VLAN.
- If the packets have no MAC set by the matched MAC VLAN, the packets are divided to the default VLAN ID of the port.
IP subnet-based VLAN
The IP subnet-based VLAN divides VLAN ID for packets according to the source IP address of the received packets. The untag packets received in the port are process as follows according to different configuration:
- If the source IP address is in the network segment of IP subnet-based VLAN, and the In port of the packets is allocated to the VLAN of the corresponding VLAN ID, the packet is allocated to the VLAN ID corresponding to the network segment.
- If the packets have no network segment set by the matched IP subnet VLAN, the packets are divided to the default VLAN ID of the port.
Protocol-based VLAN
The protocol-based VLAN divides VLAN ID for packets according to the encapsulation format and protocol type of the received packets. The protocol VLAN defines the protocol template. The protocol template is composed of the frame encapsulation format and the protocol type. The same port can be configured with multiple protocol templates. When the protocol VLAN is enabled in the port, the port is configured with protocol template, the protocol VLAN process the received untag packets as follows according to different configuration.
- If the packet matches the protocol template, and the In port of the packet is allocated to the VLAN of the corresponding VLAN ID, the packet is allocated to VLAN ID corresponding to the port configuration protocol template.
- If the packets have no matched protocol template, the packets are divided to the default VLAN ID of the port.
Till now we have seen, types of VLANs. Now we will have a example for each type of VLAN configuration.
Configuring VLAN for Access Port
Command | Description |
switch#configure terminal | Users enter the global configuration mode from the privilege user mode . |
switch(config)#port 0/1 | Enter port 0/1 configuration status |
switch(config-port-0/1)#port mode access | Configure the type of a port as Access (The default type is Access) |
switch(config-port-0/1)#port access vlan 10 | Add the port into VLAN 10. |
Configuring VLAN of a Trunk Port
Command | Description |
switch#configure terminal | Users enter the global configuration mode from the privilege user mode |
switch(config)#port 0/1 | Enter port 0/1 configuration status |
switch(config-port-0/1)#port mode trunk | Configure the type of the port as Trunk |
switch(config-port-0/1)#port trunk allowed vlan 10 - 20 | The port permits VLAN 10–20 to pass |
switch(config-port-0/1)#port trunk pvid vlan 30 | Configure the default VLAN of the port |
switch(config-port-0/1)#vlan dot1q tag pvid | Configure the default VLAN packets of a Trunk port to be sent with Tag |
Configuring VLAN of Hyrbid Port
Command | Description |
switch#configure terminal | Users enter the global configuration mode from the privilege user mode |
switch(config)#port 0/1 | Enter port 0/1 configuration status |
switch(config-port-0/1)#port mode hybrid | Configure the type of the port as Hybrid. |
switch(config-port-0/1)# port hybrid untagged vlan 10 | The port is added to VLAN 10. The VLAN packets are sent without tag |
switch(config-port-0/1)#port hybrid tagged vlan 30 | The port is added to VLAN30. The VLAN packets are sent with tag. |
switch(config-port-0/1)# port hybrid pvid vlan 20 | Configure the default VLAN of the port |
Command | Description |
switch#configure terminal | Users enter the global configuration mode from the privilege user mode |
switch(config)# mac-vlan mac-address | Configure the items in the MAC VLAN table, to assign the Untagged of the corresponding MAC into the VLAN. |
switch(config)#port 0/1 | Enter port 0/1 configuration status |
switch(config-port-0/1)# mac-vlan enable | Configure the port to enable the MAC VLAN function |
Command | Description |
switch#configure terminal | Users enter the global configuration mode from the privilege user mode |
switch(config)# ip-subnet-vlan ipv4 100.100.100.100 mask 255.255.255.0 vlan 10 | Configure the items in IP subnet VLAN table, to assign the Untagged of the corresponding network segment to the VLAN. |
switch(config)#port 0/1 | Enter port 0/1 configuration status |
switch(config-port-0/1)# ip-subnet-vlan enable | Configure the port enabling IP subnet VLAN function |
Command | Description |
switch#configure terminal | Users enter the global configuration mode from the privilege user mode |
switch(config)#protocol-vlan profile 1 frame-type ETHERII ether-type 0x8200 | Configure the protocol template |
switch(config)#port 0/1 | Enter port 0/1 configuration status |
switch(config-port-0/1)# protocol-vlan enable | Configure the port to enable the protocol VLAN function |
switch(config-port-0/1)#protocol-vlan profile 1 vlan 10 | Configure the port to match the corresponding VLAN of the protocol template |