Learning Switches (Basic)
Tags: #◇CSNETWK #◇Computer Science #◇Computer Networks #◇Networking Protocols #◇Graph Theory Basics
◇Overview
A switch is "transparent." It doesn't have a hardcoded map. It learns by listening.
◇Key Concepts
If Known If Unknown Switch 1 (Right) Switch 2 (Left) Inter-Switch Link
◇Details / Theory
◇1. Concept Overview: Self-Learning Switches
Definition
A switch is "transparent." It doesn't have a hardcoded map. It learns by listening.
The Algorithm
- Listen (Learn): When a frame arrives on Interface with Source MAC , the switch writes in its table: (MAC A Interface X).
- Forward (Act): The switch looks at the Destination MAC.
If Known: Send only to the specific interface found in the table.
If Unknown: Flood the frame out to all interfaces (except the incoming one).
◇2. The Network Topology
Connections
!◇Pasted image 20251121094303.png
Switch 1 (Right): Connects computers A-F and link to Switch 2. Switch 2 (Left): Connects computers G-L and link to Switch 1. Inter-Switch Link: Switch 1 (Int 7) Switch 2 (Int 8).
◇3. Problem Analysis (Step-by-Step)
Time :
Action: Node K sends to Node L. Switch 2 (Left): Receives frame from K on Int 14.
Learn: Records (K, 14).
Forward: Does it know L? No (Table is empty). Floods to everyone, including Switch 1 via Int 8. Switch 1 (Right): Receives flooded frame from Switch 2 (Source K) on Int 7.
Learn: Records (K, 7). (Note: Switch 1 thinks K is "out that way" towards Int 7).
Table Entries Added:
Switch 1: (K, 7) Switch 2: (K, 14)
Time :
Action: Node B sends to Node I. Switch 1 (Right): Receives from B on Int 2.
Learn: Records (B, 2).
Forward: Does it know I? No. Floods. Sends to Switch 2 via Int 7. Switch 2 (Left): Receives from Switch 1 (Source B) on Int 8.
Learn: Records (B, 8).
Forward: Does it know I? No. Floods.
Table Entries Added:
Switch 1: (B, 2) Switch 2: (B, 8)
Time :
Action: Node F sends to Node E. Switch 1 (Right): Receives from F on Int 6.
Learn: Records (F, 6).
Forward: Does it know E? No. Floods. Sends to Switch 2 via Int 7. Switch 2 (Left): Receives from Switch 1 (Source F) on Int 8.
Learn: Records (F, 8).
Table Entries Added:
Switch 1: (F, 6) Switch 2: (F, 8)
Time :
Action: Node G sends to Node B. Switch 2 (Left): Receives from G on Int 10.
Learn: Records (G, 10).
Forward: Does it know B? YES! (Learned at ). Table says B is on Int 8.
Selective Forward: Sends only to Int 8 (Switch 1). Switch 1 (Right): Receives from Switch 2 (Source G) on Int 7.
Learn: Records (G, 7).
Forward: Does it know B? YES! (Learned at ). Sends to Int 2.
Table Entries Added:
Switch 1: (G, 7) Switch 2: (G, 10)
(Note: No entry for B is added because it already exists).
◇Summary of Logic (Cheat Sheet)
-
Source Check: Always add the Source MAC and the Incoming Interface to the table.
-
Dest Check: Look for Destination MAC.
Found? Send to specific port.
Not Found? Flood (send to all). -
Inter-Switch Rule: If a packet comes from another switch, the "Interface" recorded is the link connecting the switches.
◇Common Pitfalls
Assuming a switch knows all MAC addresses from the start — switches start with empty tables and learn incrementally. Confusing flooding (sending to all ports except the source) with forwarding (sending to a specific known port). Forgetting that the switch records the source MAC and the incoming interface, not the destination.
◇Summary
TL;DR — Self-learning switches build MAC-to-port tables by recording source addresses of incoming frames. Known destinations are forwarded to specific ports; unknown destinations are flooded to all ports.
◇Links
Related: - ◇Pasted image 20251121094303.png Source / Reference:
◇References & Navigation
- Previous Topic: ◇Addressing and Forwarding
- Next Topic: ◇Learning Switches (Advanced)
- Related Notes: ◇Internetworking
ACTIVE RECALL VERIFICATION
Select an answer to verify conceptual comprehension and reveal the technical rationale.
Why is a Layer-2 Ethernet switch described as transparent and plug-and-play?
When a frame with Source MAC and Destination MAC arrives on Interface of a self-learning switch, which field does the switch use to update (learn) its switch table, and which field does it use to make the forwarding decision?
What are the three possible actions a self-learning switch can take after looking up the frame's Destination MAC (which arrived on Interface ) in its switch table?
How does a Layer-2 Ethernet Switch improve performance compared to a legacy Layer-1 Hub (Repeater)?
Why does a switch associate an aging timer (TTL) with every learned (MAC Address, Interface) entry in its switch table?