Back to the 2017 paper

Module 2: Data Link Layer & MAC Sublayer

20177m

What do you mean by layer 2 switching? Explain in detail the functioning of layer 2 switches.

Worked SolutionAI Assisted

Layer 2 switching refers to forwarding data frames based on information found at the Data Link layer (Layer 2 of the OSI model) — specifically, the destination MAC address — rather than on IP addresses (Layer 3, used by routers).

A Layer 2 switch is essentially a multi-port bridge: it connects multiple devices within a LAN and intelligently forwards each incoming frame only out the port leading to its actual destination, instead of broadcasting it out every port like a hub.

Functioning of a Layer 2 switch

  1. Learning — for every frame that arrives, the switch inspects the source MAC address and the port it came in on, and records this pairing in its MAC address table (also called a CAM table — Content Addressable Memory table). Over time it "learns" which devices sit behind which ports.

  2. Forwarding/Filtering — for the frame's destination MAC address, the switch looks it up in its MAC address table:

    • If found, the frame is forwarded only out the specific port associated with that address (unicast forwarding) — not out every port.
    • If not found (an "unknown unicast"), the switch floods the frame out every port except the one it arrived on, since it doesn't yet know where that address lives.
  3. Aging — entries in the MAC address table are automatically removed after a period of inactivity, keeping the table current as devices move or disconnect.

  4. Broadcast/Multicast handling — broadcast frames (destination FF:FF:FF:FF:FF:FF) and unknown-destination frames are flooded to all ports (except the source), ensuring they reach every device, since these inherently need wide delivery.

  5. Collision domain segmentation — each switch port is its own separate collision domain (unlike a hub, where all ports share one collision domain), allowing full-duplex, essentially collision-free communication on each link and letting multiple conversations happen simultaneously across different port pairs.

Benefit: by making per-frame forwarding decisions based on learned MAC addresses, a Layer 2 switch dramatically reduces unnecessary traffic compared to a hub, increases effective bandwidth (since unrelated conversations don't interfere with each other), and eliminates most collisions — all while remaining transparent to higher-layer protocols, since it never inspects IP addresses or routing information.

Similar questions

Free AppAndroid App

Coursify Android App

Generate AI courses, take quick quizzes between classes, and master complex engineering concepts on the go.