L2 Switch

L2 switch is a Layer 2 device that solves the problem of thrashing

The problem of thrashing means when two devices communicate with each other then other devices won’t  get unnecessarily disturbed

L2 switch interfaces will not have a Mac address or IP address but it will have port numbers p1….p4

Rendered by QuickLaTeX.com

The above topology contains four devices L3 router and A, B, C devices with MAC address MR, MA, MB, MC in the same subnet that has network id as 12.1.1.0/24 also a L2 switch which have ports from P1 to P4

Mac table

L2 switch maintains a table called mac table which is filled with the help of a procedure called Mac learning

The mac table contains the mapping between Mac address and port number

Mac addressOutgoing port no
MBP4
MRP1
MCP2
MAP3

From the table, let’s suppose if the L2 switch receives a packet with destination Mac =MB then at this instant, the L2 switch will look up its Mac table with MB as a key

If we consider, MB as a key then the matching port for the MB key will be P4 in the Mac table

Therefore from this key MB, the L2 switch would know that it has to forward the frame to the P4 as a result, the frame would go to the P4 port

Thus, the machine B only receives the frame which is destined for it and will not disturb the other machines(thrashing) in the same subnet

As you can see from the above topology the L2 switch will make use of its Mac table to know on which outgoing port no it should forward the frame

How L2 switch fill its Mac table

L2 switch makes an entry in the Mac table by inspecting the contents of the Ethernet header of the frame

In case, if L2 switch does not have entry and also do not know which port to forward the packet at that instant, it will floods the packet out on all ports

Mohammed Anees

Hey there, welcome to aneescraftsmanship I am Mohammed Anees an independent developer/blogger. I like to share and discuss the craft with others plus the things which I have learned because I believe that through discussion and sharing a new world opens up

Leave a Reply

Your email address will not be published.