Short Bytes: Layer 2 Switch is responsible for a lot of operations at the data link layer of the OSI model. Some of their works involve MAC Address Forwarding, Ingress Queue, Access Control List (ACL), MAC Table, CAM Table etc. Let’s take a deeper look into these functionalities.
Layer 2 Switch:
Store-n-forward mode:
In a network, when a switch receives a frame, the frame is first checked for the errors using cyclic redundancy check (CRC) and forwarded. This type of operation by a Layer 2 Switch is called store-n-forward mode. The store-n-forward mode results in latency in frame transmission because an entire frame has to be stored before being transmitted to the another port.
Also Read:Â Hub vs Switch: Comparison And Difference Between Networking Devices
Cut-through switching:
In the case of cut-through switching, some models of a switch bypass the CRC check which results in lowering the latency of the frame transmission because the entire frame is not stored before transmission to another port.
MAC Address Forwarding:
The switch has to be intelligent enough to figure out where a frame must be sent. For that purpose, a switch maintains the MAC address table. Well, the MAC address table is either learnt by the switch over a period of time or the network admin just punches in the address table information in the switch memory.
So, when a frame arrives at one of the ports of the switch, the switch checks the source MAC addresses of the frame. If the MAC address is already not there in the table, the MAC address, switch port, and VLAN (Virtual Lan) will then get recorded in the forwarding table. The forwarding table is also called the CAM (Content Addressable Memory) table.
Also Read: Different Networking Devices And Hardware Types — Hub, Switch, Router, Modem, Bridge, Repeater
Unicast Flooding:
But have you ever wondered what happens to a frame if the destination MAC address of that frame is not known to the switch? In that case, a switch decided to go for unicast flooding. Unicast flooding is a method to forward the frame through all ports within a VLAN except the port the frame was received on.
Ingress Queue:
A switch can maintain one or multiple ingress queue at each port. Let’s say, a switch has 24 ports, then it will maintain ingress queues, one or multiple, at each of these ports. When a frame is received, the switch will place these frames into an ingress queue. Multiple ingress queues are used to service frames differently, for example, for the quality of service or sending a high priority frame first.
You can imagine ingress queue as a ticket counter serving multiple rows at once. However, the counter decides whom to issue the ticket first.
There are different predefined QoS parameters for the Incoming frames. Based on these parameters, an incoming traffic to a switch can then be marked, prioritized, or rate-limited.
Also Read:Â Switch Vs Router: Differences And Comparison Of Their Working Functionalities
MAC table:
Don’t get confused here. MAC and CAM table are almost the same tables. The term CAM simply refers to the way the switch uses memory (in a content-addressable) manner to look up the MAC address to the port association.
The Layer 2 forwarding table is also called the MAC table. The MAC table typically contains information about MAC addresses and destination ports. So, when a packet is received, a switch takes a reference for the destination MAC address of the incoming frame in the MAC table and forward the frames to the destination ports specified in the table.
Access Control List (ACL)
If you think ACL only applies to routers, then that is not the case. Switches can also have ACLs based on MAC and IP addresses. The difference between layer 2 and layer 3 switches is that layer 3 switch can support ACLs based on both MAC and IP addresses whereas Layer 2 switches support ACLs based only on MAC addresses.
Here is our complete coverage on computer networks.