I have a dumb question regarding VLAN and switching.

Suppose I have a switch that receives some incoming packets which are tagged with different VLANs. The packets' destinations are to the router which is connected to the switch also:

Host ----> Switch --(trunk)---> Router

The reason why the host send out the packets with different kind of VLAN is that the Host has a lot of VMs inside and the VM are connected with different sub-interfaces internally

My question is that how does the switch treats the incoming packet if they are tagged with VLAN? Will the switch drops the packets or will the switch forward it to the router?


  • 1
    This depends on the specific switch (Cisco vs. HP vs. Nortel) and how it has been configured. Some switches will pass a "tagged frame" the same as any other frame. At layer-2, the switch doesn't have to care what the protocol is (0x8100 for 802.1q, vs. anything else) Most switches, however, are "VLAN aware" and have special processing for 802.1q frames.
    – Ricky
    Jul 2 '15 at 21:44
  • Is the link between the Host and the Switch configured as a Trunk on the switch? Or as an access port on the Switch (If so, what VLAN)?
    – Eddie
    Sep 30 '15 at 20:19
  • Maybe you should read up on the basics. Oh and there are many other interesting questions about this on the site, like networkengineering.stackexchange.com/questions/6483/…
    – Marki
    Jan 1 '16 at 22:35
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer.
    – Ron Maupin
    Aug 11 '17 at 18:22

In a perfect world, the switch should only pass Ethernet frames that are tagged if it is specifically configured with those VLAN IDs trunked on that interface, or if a VLAN with a matching VLAN ID is the native/access VLAN on that interface.

Frames with tags that are unknown to the switch should be dropped.

However: on some unmanaged switches I have seen instances where the switch will completely ignore the Ethertype (indicating a tagged frame) and simply forward based on Destination MAC, passing the frame through the switch and maintaining the 802.1Q header (essentially acting as a hub with MAC learning).

In this case, your router should then drop the tagged frame if is not configured to receive one, even if the frame was destined for a local MAC address.


All packets internal to a switch is associated with a vlan id.

They get the vlan id in one of two ways, 1. when entering on a normal access port, the port is associated with a vlan, default 1, but this can be changed. 2. when entering on a trunk/tagged port the packet arrives with a vlan id.

When packets leave a switch port there is again 2 choices. 1. on a access port, only packets that match the port vlan is allowed out, and the vlan id is stripped and only a plain Ethernet packet leave. 3. on a trunk/tagged port, the packet is transmitted with it's vlan tag (for native vlan it is also stripped)

To answer the question we would have to guess some of the information not provided. Senario A: both ports on the switch are access port on same vlan. Tagged packet arrives on VM-in port, and get sent out Router-out port with vlan tag. Possible problems with mtu as vlan tag increase's packet length and for maximum size frames could be dropped. (Inside the switch the packet will have double vlan tags, but only single original vlan tag when leaving.)

Senario B: Switch is properly configured with trunk ports for VM-in and Router out. Packets from VM will hit switch with vlan tag, tag preserved in switch and packets out to router will be tagged, router will need vlan sub-interfaces for each vlan to accept packets.

Not the answer you're looking for? Browse other questions tagged or ask your own question.