PROJECTENGRAM

LEARNING SWITCHES (BASIC)

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

  1. Listen (Learn): When a frame arrives on Interface XX with Source MAC AA, the switch writes in its table: (MAC A →\rightarrow Interface X).
  2. 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) ↔\leftrightarrow Switch 2 (Int 8).

◇3. Problem Analysis (Step-by-Step)

Time t=1t=1: K→LK \rightarrow L

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 t=2t=2: B→IB \rightarrow I

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 t=3t=3: F→EF \rightarrow E

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 t=4t=4: G→BG \rightarrow B

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 t=2t=2). 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 t=2t=2). 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)

  1. Source Check: Always add the Source MAC and the Incoming Interface to the table.

  2. Dest Check: Look for Destination MAC.
    Found? →\rightarrow Send to specific port.
    Not Found? →\rightarrow Flood (send to all).

  3. 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.

Related: - ◇Pasted image 20251121094303.png Source / Reference:

◇References & Navigation

CONFIRMATION // 理解度の確認

ACTIVE RECALL VERIFICATION

Select an answer to verify conceptual comprehension and reveal the technical rationale.

Q1

Why is a Layer-2 Ethernet switch described as transparent and plug-and-play?

Q2

When a frame with Source MAC XX and Destination MAC YY arrives on Interface ii 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?

Q3

What are the three possible actions a self-learning switch can take after looking up the frame's Destination MAC YY (which arrived on Interface ii) in its switch table?

Q4

How does a Layer-2 Ethernet Switch improve performance compared to a legacy Layer-1 Hub (Repeater)?

Q5

Why does a switch associate an aging timer (TTL) with every learned (MAC Address, Interface) entry in its switch table?

Learning Switches (Basic) | PROJECT ENGRAM