When I create a VLAN sub-interface in Linux, then it gets the same MAC address as its parent interface. For example with ip link add link eth0 name eth0.333 type vlan id 333 command, the eth0.333 gets the same MAC as eth0. Am I correct that server identifies received frames based on VLAN tag or if the VLAN tag is missing, then the frame from the switch is to eth0 itself?
How does server identify frames in case of multiple VLAN sub-interfaces?
ip;ethernet
The default behavior is to add a interface that will only accept packets where the 802.1q field is the same as the vlan id to this given interface. In a very simplified way, the Mac address will be the same as the parent, so the packet is delivered to the phy interface, and processed by the kernel, searching for a 802.1q Tag field that is right after the source mac address field. This field will be identified with the 0x8100 EtherType. The last 12 bits define the vlan id.This Ethernet frame will have the tag removed and delivered to the vlan interface. You can double-check this using tcpdump on both interfaces and pinging an ip address of eth0.333. You shall see output only on eth0:# tcpdump -ni eth0 vlan 333# tcpdump -ni eth0.333 vlan 333The default behavior on the opposite traffic direction will be tag and deliver(can be configured).If you want to create virtual interfaces with a Mac Address that is different from the parent, you will have to use the macvlan option of iputils2. Remember that your switches could have some mac related restrictions and block traffic from this newly created interface.And yes, you are correct. If there is no tag the traffic will be delivered to your physical interface. Your configurations will define if the packet will be accepted.