So, guys, next we will going to discuss the rules of Vlan tagging.
So we have five rules of Vlan tagging.
These rules will state that when will the ethernet frame will going to be tagged with 802.1 q vlan header
and when it will going to be untagged.
So remember the frames gets tagged or untagged as they move across L2 switch boundaries.
So let us discuss these five rules of Vlan tagging one by one.
So rule number one.
Rule number one says that hosts are Vlan unaware.
Now here host are n machines that is your computer, laptop, mobile devices, etcetera.
So these host neither generates vlan tag packet nor should they receive Vlan tag packets.
Right.
So for example, any frame which is generated by host H1 or any other host in this topology will always
be untagged.
Untagged means the Ethernet header of that particular frame will not contain 802.1 q vlan header.
So you can see that this host has generated a frame F one and the ethernet header of the frame F one
consists of only destination Mac source, mac and type field.
Of course there are other fields of ethernet header, but I have not shown you because their discussion
is not relevant here.
But the thing to note here is that that the frame generated by the host H1 will never going to contain
802.1 q vlan header.
Similarly, when the host H1 receives any frame from the L2 switch, then that frame is not supposed
to contain any 802.1 q vlan header.
So this is the rule number one that hosts are Vlan unaware.
Now, let us discuss the rule number two.
Rule number two says that when Untagged Frame enters the L2 switch from interface operating in access
mode, the frames get tagged with corresponding Vlan ID.
Right.
So let us take an example.
Suppose the untagged frame F one that is this frame which is generated by the host H1 enters the L2
switch from interface ethernet zero.
Right.
The frame f one gets tagged with Vlan ten resulted in frame f one dash.
So you can see that f one dash is a frame f one, but inside an l2 switch.
Right?
So f one dash is an ethernet frame in the ethernet header of whose 802.1 q vlan header has been inserted.
The number in brackets that is ten denotes that the frame has been tagged with Vlan id ten.
So you can see that the ethernet header of the frame F one is shown here and you can see that there
is no 802.1 q vlan header as per the rule number one, but as soon as the same frame f one enters into
the L2 switch, then the frame gets tagged with the vlan id ten.
That is 802.1 q vlan header is inserted by l2 switch in the ethernet header of the frame f one.
The tagged version of the frame f one is f one dash.
Also note that that the frame F1 gets tagged with the Vlan ID ten because the frame F1 enters into the
L2 switch through an interface Ethernet zero and that interface Ethernet zero is operating in access
mode in Vlan ten.
So because this interface is operating in Vlan ten, therefore the frame which enters into L2 switch
through this interface will get tagged with the Vlan id ten.
Now coming to the rule number three.
Rule number three is actually exactly opposite of rule number two.
Rule number three says that when tagged frame leaves the L2 switch from interface operating in access
mode, then those frames get untagged with corresponding vlan ID.
Right.
So you can see here that suppose we have a tagged frame F1 dash, which is tagged with Vlan ID ten.
And suppose this frame leaves the L2 switch through an interface Ethernet zero which is operating in
access mode in Vlan ten.
So when the frame F one leaves the L2 switch through an interface Ethernet zero, the frame F one becomes
untagged when it leaves the L2 switch from interface Ethernet zero resulted frame is F one, so you
can see that this frame f one dash is converted to the frame f one when it leaves the L2 switch from
an interface ethernet zero.
Right.
Now note that that the frame tagged with vlan id not equal to ten.
That is.
Suppose if this F1 dash frame was tagged with Vlan 20 right then it will not be allowed to exit out
of interface ethernet zero of l2 switch because of mismatch vlan id.
Right.
So you can see here that the frame f1 dash has ethernet header format somewhat like this in which 802.1
q vlan header is present with vlan id ten and when the same frame exit out of the interface ethernet
zero of l2 switch, you can see that there is no 802.1 q vlan header.
So you can see that whenever the hosts receive the frame from an L2 switch, those frames are always
untagged.
So it follows the rule number one that hosts are Vlan unaware.
So guys, going forward discussing the rule number four frames tagged with Vlan id x are allowed to
exit out of those interface of an L2 switch.
Now those interface could be access or trunk which are configured with the same Vlan ID, right?
So you can see in this example that the frame F1 which is tagged with Vlan ten.
So here we have a frame F1 and it is tagged with Vlan id ten.
So this frame can actually leave this l2 switch through an interface ethernet zero and interface ethernet
three only.
Why?
Because both the interfaces that is Ethernet zero and Ethernet three are configured to operate in Vlan
ten.
Right.
Similarly, the frame F2, which is tagged with Vlan ID 11 is allowed to exit the L2 switch from interfaces
Ethernet one, Ethernet two and Ethernet three only.
So we can see in this diagram that the frame F2, which is tagged with Vlan 11, is allowed to leave
the L2 switch from Interface Ethernet one, Ethernet two and Ethernet three.
Right.
And when the frame F2 leaves the L2 switch, it becomes untagged.
And you can see that when the frame F2 dash leaves the add to switch from interface Ethernet one or
interface Ethernet two, the frame becomes untagged.
Right frame.
F2 dash cannot leave the L2 switch from interface Ethernet zero because of mismatch of Vlan id that
is the frame.
F2 is tagged with Vlan 11, but the interface ethernet zero is operating in Vlan ten.
And finally we have the rule number five.
Rule number five says that trunk ports are only pass through ports.
They allow the tagged frame to pass through them that is, exit or enter the L2 switch which are tagged
with matching vlan id.
Right.
Untagged frames are dropped by trunk interfaces.
So you can see in this example that the frame F1 tag tagged with Vlan ID ten.
That is, this frame is allowed to exit the L2 switch from trunk interface ethernet three without any
change in the Mac header.
So you can see that the frame f1 dash even after leaving the L2 switch through an interface Ethernet
three it continues to be Vlan tagged.
So it is the property of the trunk interfaces that they are just pass through ports or pass through
interfaces.
Trunk interfaces do not insert or remove 802.1 q Vlan headers from the ethernet header of a frame.
Similarly, frame f2 dash tagged with vlan id 11 that is, this frame is allowed to exit the L2 switch
from interface ethernet three without any change in the Mac header.
Right.
And the third one is that the frame f3 dash.
Now f3 dash is not shown in the diagram, but assume that F3 dash is a frame which is tagged with Vlan
ID 15 and this frame is not allowed to exit l2 switch from interface ethernet three.
Why?
Because the interface Ethernet three is not configured to operate in Vlan 15.
Right.
The interface ethernet three can only pass the frames which are tagged with Vlan ID ten or 11 or 12.
So these are the five rules of Vlan tagging.
You can revise all the rules from 1 to 5 again, because we will going to use these rules when we will
be learning Vlan based routing.