Switch – What do switches do to tagged and untagged VLAN packets

hp-procurveswitchvlan

Let's say we have a 4-port switch that is VLAN capable.

1     2     3     4       

Port 1 is TAGGED to VLAN10` and `UNTAGGED to Default_VLAN(1)

Port 2 is UNTAGGED to VLAN10

Port 3 is UNTAGGED to VLAN10

For the sake of this question, we have a packet coming into Port 1 which is tagged with VID 10. Port 1 preserves the tag.

It just so happens the device it needs to send the packet to is connected to Port 2. Does the switch remove the VLAN 10 tag from the packet as it is sending the packet out of a port UNTAGGED to that VID?

Furthermore, let's say this was a ICMP packet, and the device on Port 2 sends the reply, which goes to Port 2 untagged, and becomes part of VLAN 10. Does it get TAGGED with VID 10 when it leaves Port 1 to its destination device because Port1 is TAGGED to that VID? (Let's also make a large assumption for the sake of the question the switch is doing the layer 3 IP routing).

Best Answer

Switches strip or add tags depending on the port's settings. Your hypothetical packet tagged VLAN 10 ingressing on port 1 would have its tag stripped and when it egressed port 2 (or port 3, because both are untagged members of VLAN 10).

Similarly, when a packet ingresses port 2 it will be tagged VLAN 10 before egressing port 1, as per the second part of your question.

I know of at least one Ethernet switch implementation that tags frames on ingress on an untagged port, moves all frames around inside the switch as tagged frames. That particualr switch strips tags only when frames egress an untagged port.

I would assume that this type of behavior is probably fairly common, seeing as how the switch needs some way to keep track of the origin VLAN of frames as they move around inside the switch. Since I only know the low-level details of one (now very outdated and no longer manufactured) switch, though, I won't make sweeping generalizations that I can't back up.