CS24305 • Module 4

Module 4: Switching & Local Area Networks (LANs)

Topics 28 to 36 • Circuit/Packet Switching, ALOHA, CSMA/CD, Ethernet & STP
Module IV: Switching & Local Area Networks (LANs) — 9-Topic Master Syllabus Guide
Topic 28: Circuit Switching vs. Packet Switching (Connection Setup, Resource Reservation, Latency)
Topic 29: Packet Switching Modes: Virtual Circuits (Connection-Oriented) vs. Datagram Networks (Connectionless)
Topic 30: Switching Fabric Architectures (Space-Division Crossbar, Banyan Networks & Time-Division TDM Switches)
Topic 31: Local Area Network (LAN) Technologies & Media Access Control (MAC Sublayer Architecture)
Topic 32: Random Access Protocols (Pure ALOHA, Slotted ALOHA, CSMA: 1-Persistent, Non-Persistent, p-Persistent)
Topic 33: CSMA/CD Protocol (Ethernet Collision Detection, Minimum Frame Size Formula & Exponential Backoff)
Topic 34: CSMA/CA & Wireless LANs (IEEE 802.11 Wi-Fi, Hidden/Exposed Terminal Problem & RTS/CTS Handshake)
Topic 35: IEEE 802.3 Ethernet Standards (Standard 10BASE-T, Fast Ethernet 100BASE-TX, Gigabit 1000BASE-T Frame Anatomy)
Topic 36: Interconnecting Devices & Layer 2 Switching (Repeaters, Hubs, Bridges, Switches, Spanning Tree Protocol STP)

Topic 28 & 29: Circuit Switching vs. Packet Switching & Virtual Circuits

Dimension Circuit Switching (PSTN Telephone) Packet Switching (Internet IP)
Dedicated Path Dedicated end-to-end physical circuit established prior to data transfer. No dedicated circuit; packets dynamically share statistical communication links.
Resource Reservation Bandwidth and buffer capacity reserved exclusively along path for duration. On-demand statistical multiplexing (packets queue up in router buffers).
Setup Delay High initial connection establishment delay; zero delay during transmission. Zero connection setup delay in datagram networks; variable packet queuing jitter.
Channel Efficiency Low efficiency: idle periods (silence in voice) waste dedicated bandwidth. High Efficiency: Inactive users consume zero bandwidth.
Congestion Behavior Call blocking (busy signal) if capacity exhausted; active calls unimpaired. Packet delay, queuing buffers, and packet drops under heavy load.

Topic 32, 33 & 34: Random Access MAC Protocols (ALOHA, CSMA, CSMA/CD, CSMA/CA)

MAC Protocol Vulnerable Time ($T_{\text{vul}}$) Maximum Theoretical Throughput ($S_{\text{max}}$) Operating Mechanism
Pure ALOHA $$T_{\text{vul}} = 2 \times T_{\text{fr}}$$ $$S_{\text{max}} = \frac{1}{2e} \approx \mathbf{18.4\%} \quad (\text{at } G = 0.5)$$ Stations transmit immediately whenever data is ready; retransmits after random backoff on collision.
Slotted ALOHA $$T_{\text{vul}} = 1 \times T_{\text{fr}}$$ $$S_{\text{max}} = \frac{1}{e} \approx \mathbf{36.8\%} \quad (\text{at } G = 1.0)$$ Time divided into discrete slots equal to $T_{\text{fr}}$; stations transmit only at slot start boundaries.
1-Persistent CSMA $$T_{\text{vul}} = \tau \ (\text{Propagation Delay})$$ Significantly higher than ALOHA Listens to channel: if idle, transmits immediately; if busy, continually listens until idle, then transmits instantly.
Non-Persistent CSMA $$T_{\text{vul}} = \tau$$ Higher throughput at heavy load If channel is busy, waits a random duration before sensing again (reduces collisions).
$p$-Persistent CSMA $$T_{\text{vul}} = \tau$$ Optimal trade-off for slotted channels If idle, transmits with probability $p$, and defers to next slot with probability $1-p$.
CSMA/CD (Ethernet) $$T_{\text{vul}} = 2 \tau$$ Approaches $100\%$ on switched networks Listens while transmitting: on collision, halts immediately, emits 32-bit Jam Signal, executes Exponential Backoff.
CSMA/CA (Wi-Fi) Uses IFS & Contention Window High in wireless media Cannot detect collisions in air: avoids collisions using Inter-Frame Spaces (DIFS/SIFS), RTS/CTS frames, and ACKs.

Topic 33.1: CSMA/CD Minimum Frame Size Derivation & Exponential Backoff

The Fundamental CSMA/CD Collision Detection Condition: In CSMA/CD, a transmitting station must not finish transmitting its frame before the collision signal propagates back from the furthest point in the network ($2 \times T_{\text{prop}}$): $$\mathbf{T_{\text{trans}} \ge 2 \times T_{\text{prop}}}$$ $$\mathbf{\frac{\text{Frame Size}_{\text{min}}}{\text{Bandwidth}} \ge 2 \times \frac{\text{Distance}}{\text{Propagation Velocity}}}$$ $$\mathbf{\text{Frame Size}_{\text{min}} = 2 \times T_{\text{prop}} \times \text{Bandwidth}}$$
🏛️ Step-by-Step Solved Problem: Minimum Ethernet Frame Size Calculation

A $1\text{ Gbps}$ Gigabit Ethernet network operates across a maximum cable distance of $1\text{ km}$ with signal propagation speed $v = 2 \times 10^8\text{ m/s}$. Calculate the minimum frame size required for CSMA/CD.

Solution:

$$T_{\text{prop}} = \frac{\text{Distance}}{v} = \frac{1000\text{ m}}{2 \times 10^8\text{ m/s}} = 5 \times 10^{-6}\text{ s} = 5 \ \mu\text{s}$$ $$\text{Round-Trip Propagation Time (Slot Time): } 2 \times T_{\text{prop}} = 2 \times 5 \ \mu\text{s} = 10 \ \mu\text{s}$$ $$\mathbf{\text{Frame Size}_{\text{min}} = 2 T_{\text{prop}} \times \text{Bandwidth} = 10 \times 10^{-6}\text{ s} \times 10^9\text{ bps} = 10,000\text{ bits} = \mathbf{1250 \text{ bytes}}}$$

Topic 35: IEEE 802.3 Ethernet Frame Structure

Field Size Operational Function
Preamble7 BytesAlternating `10101010` pattern for receiver clock synchronization.
SFD (Start Frame Delimiter)1 ByteExact pattern `10101011` indicating start of valid frame payload.
Destination MAC6 Bytes48-bit physical hardware address of destination device or broadcast (`FF:FF:FF:FF:FF:FF`).
Source MAC6 Bytes48-bit physical hardware address of transmitting NIC.
Length / Type2 Bytes$\le 1500$: Length of payload; $\ge 1536$ (`0x0800`): EtherType identifying IPv4, ARP (`0x0806`), IPv6 (`0x86DD`).
Data Payload$46\text{ to }1500\text{ B}$High-level Network layer packet (Padded with zeros if $< 46$ bytes).
CRC / FCS Checksum4 Bytes32-bit Cyclic Redundancy Check (`CRC-32`) for error detection.

Topic 36: Interconnecting Devices & Spanning Tree Protocol (STP)

The Broadcast Storm Problem & Spanning Tree Protocol (IEEE 802.1D)
Redundant physical links between Layer 2 bridges/switches create infinite loops, generating catastrophic Broadcast Storms and corrupting MAC address learning tables. STP (Spanning Tree Protocol) dynamically builds a loop-free logical spanning tree by:
  1. Electing a unique Root Bridge (switch with lowest Bridge ID: Priority + MAC).
  2. Selecting one Root Port on every non-root bridge with minimum path cost to Root.
  3. Selecting one Designated Port per LAN segment.
  4. Placing all other redundant ports into Blocking State (disabling packet forwarding).

🧠 M4 Active Recall & 10-Question University Exam Master Bank

Q1. Derive the maximum throughput formula for Pure ALOHA ($S = G e^{-2G}$) and Slotted ALOHA ($S = G e^{-G}$). (10 Marks)
Assuming Poisson frame arrival with rate $G$ frames per frame-time $T$:
• Pure ALOHA: Vulnerable period is $2T$. Probability of 0 other frames arriving is $P(0) = e^{-2G}$. Throughput $S = G P(0) = \mathbf{G e^{-2G}}$. Maximum at $dS/dG = 0 \implies G = 0.5 \implies S_{\text{max}} = 1/(2e) \approx \mathbf{18.4\%}$.
• Slotted ALOHA: Vulnerable period is $1T$. Probability of 0 arrivals in slot is $P(0) = e^{-G}$. Throughput $S = \mathbf{G e^{-G}}$. Maximum at $G = 1.0 \implies S_{\text{max}} = 1/e \approx \mathbf{36.8\%}$.
Q2. Explain CSMA/CD operation, 1-persistent sensing, jamming signal, and Binary Exponential Backoff algorithm. (10 Marks)
1. Carrier Sense: Station senses channel before transmitting.
2. Collision Detection: Listens while transmitting. If signal amplitude doubles, collision detected!
3. Jamming Signal: Emits 32-bit jam signal to notify all stations.
4. Binary Exponential Backoff: After $n$-th collision ($n \le 10$), chooses random integer $k \in [0, 2^n - 1]$ and waits $k \times \text{SlotTime}$. Aborts after 16 failed attempts!
Q3. Why does standard CSMA/CD fail in wireless LANs? Explain the Hidden Terminal Problem and RTS/CTS solution. (8 Marks)
In wireless, signals attenuate exponentially ($1/d^2$ to $1/d^4$), making transmit signal drown out weak colliding signals. In the Hidden Terminal Problem, stations A and C cannot hear each other but both transmit to B, colliding at B. CSMA/CA solves this via 4-way RTS/CTS handshaking: A sends RTS; B responds with CTS (reserving channel for A and silencing C via Network Allocation Vector NAV).
Q4. Compare Repeaters, Hubs, Bridges, Layer 2 Switches, and Routers across OSI layer, collision domain, and broadcast domain. (8 Marks)
• Repeater/Hub (Layer 1): Extends physical distance; 1 shared Collision Domain, 1 Broadcast Domain.
• Bridge/Switch (Layer 2): Filters by MAC; separates Collision Domains per port; 1 shared Broadcast Domain.
• Router (Layer 3): Routes by IP; separates Collision Domains AND separates Broadcast Domains!
Q5. Explain the Spanning Tree Protocol (STP) algorithm with Root Bridge election and port states. (8 Marks)
STP prevents broadcast storms in looped Layer 2 networks:
1. Elects Root Bridge (lowest Bridge ID = Priority + MAC).
2. Elects Root Port per bridge (lowest cost to root).
3. Elects Designated Port per segment.
4. Places all redundant loop ports in Blocking state.

Topic 36.2: Advanced Ethernet Switching, VLANs & Spanning Tree Calculations

Modern enterprise local area networks replace shared collision domains with Full-Duplex Layer 2 Switched Ethernet and Virtual Local Area Networks (VLANs, IEEE 802.1Q).

Switching Technique Operating Architecture Latency & Error Propagation
1. Store-and-Forward Switch buffers entire frame in memory, verifies 32-bit CRC checksum, checks destination MAC in CAM table, and forwards frame. Highest latency (proportional to frame size); 100% immune to corrupt frames (discards CRC errors).
2. Cut-Through Switch reads only first 6 bytes (Destination MAC) and immediately begins forwarding frame to target port before receiving remainder. Lowest Latency: Fixed instant forwarding; propagates corrupt frames and collision fragments.
3. Fragment-Free Switch buffers first 64 bytes (collision window) before forwarding. Filters out all collision fragments (runt frames $< 64$ bytes) with minimal latency penalty.
🏛️ Step-by-Step Spanning Tree Protocol (STP) Bridge Port Calculation

Consider 3 switches $S_1, S_2, S_3$ connected in a ring with Gigabit links (Path Cost = 4):

STP State Derivation:

  1. Root Bridge Election: $S_1$ has the lowest MAC address $\implies$ $\mathbf{S_1 \text{ is elected ROOT BRIDGE}}$. All ports on $S_1$ become Designated Ports (Forwarding).
  2. Root Ports on $S_2$ and $S_3$: Port facing $S_1$ on $S_2$ has cost 4 $\implies$ Root Port. Port facing $S_1$ on $S_3$ has cost 4 $\implies$ Root Port.
  3. Link between $S_2$ and $S_3$: Both have cost 4 to Root. Tie-breaker: $S_2$ has lower Bridge ID than $S_3$. Therefore, $S_2$'s port becomes Designated Port, and $S_3$'s port is placed in BLOCKING STATE, breaking the loop!

Topic 36.3: Advanced Switching Fabrics & Ethernet Standards Evolution

At the physical switching core of enterprise routers and central office telephone exchanges, high-speed non-blocking Space-Division and Time-Division Switching Fabrics transfer incoming frames across line cards:

Crossbar vs. Clos Non-Blocking Multi-Stage Network Complexity: - Single-Stage $N \times N$ Crossbar Switch: Requires $\mathbf{N^2 \text{ crosspoints}}$. (For $N=1000$, requires $1,000,000$ crosspoint switches $\implies$ high cost!). - 3-Stage Clos Non-Blocking Network ($N$ inputs, $n$ inputs/stage-1 switch, $k$ middle switches): $$\text{Strict-Sense Non-Blocking Condition: } \mathbf{k \ge 2n - 1}$$ $$\text{Total Crosspoints: } \mathbf{C = 2 N k + k \left(\frac{N}{n}\right)^2} \ll N^2$$
Ethernet Standard Data Rate Physical Medium & Connector Max Segment Span Line Coding
10BASE-T $10\text{ Mbps}$ Cat 3/5 UTP, RJ-45 $100\text{ meters}$ Manchester ($20\text{ MHz}$)
100BASE-TX (Fast) $100\text{ Mbps}$ Cat 5 UTP (2 pairs) $100\text{ meters}$ 4B/5B + MLT-3
1000BASE-T (Gigabit) $1000\text{ Mbps} (1\text{ Gbps})$ Cat 5e/6 UTP (4 pairs simultaneously) $100\text{ meters}$ 4D-PAM5 ($125\text{ MBaud}$)
10GBASE-T (10 GbE) $10\text{ Gbps}$ Cat 6A / Cat 7 UTP $100\text{ meters}$ PAM-16 + 64B/65B
1000BASE-SX / LX $1\text{ Gbps}$ Multi-Mode / Single-Mode Fiber $550\text{ m (SX)} / 5\text{ km (LX)}$ 8B/10B NRZ
🏛️ Solved Problem: IEEE 802.1Q VLAN Tagging & Trunking

In modern switched LANs, multiple Virtual LANs (VLANs) share a common inter-switch trunk link. The **IEEE 802.1Q standard** inserts a **4-byte VLAN tag** into the standard Ethernet frame between the Source MAC and EtherType fields:

Topic 36.4: Master University Solved Examination Numerical Bank

🏛️ Solved Numerical 4: CSMA/CD Maximum Cable Distance Calculation

A 10 Mbps Standard Ethernet network transmits frames with minimum size 64 bytes (512 bits) over coaxial cable with propagation velocity $v = 2 \times 10^8\text{ m/s}$. The network includes 4 repeaters, each introducing an internal processing delay of $1.5 \ \mu\text{s}$. Calculate the maximum permissible cable distance between the two furthest stations.

Solution:

$$T_{\text{trans}} = \frac{512\text{ bits}}{10 \times 10^6\text{ bps}} = 51.2 \ \mu\text{s}$$ $$\text{Condition: } T_{\text{trans}} \ge 2 \times T_{\text{prop\_total}} = 2 \times (T_{\text{cable}} + 4 \times T_{\text{repeater}})$$ $$51.2 \ \mu\text{s} \ge 2 \times (T_{\text{cable}} + 4 \times 1.5 \ \mu\text{s}) = 2 T_{\text{cable}} + 12 \ \mu\text{s}$$ $$2 T_{\text{cable}} \le 51.2 - 12 = 39.2 \ \mu\text{s} \implies T_{\text{cable}} \le 19.6 \ \mu\text{s}$$ $$\mathbf{\text{Max Cable Distance } D = T_{\text{cable}} \times v = 19.6 \times 10^{-6}\text{ s} \times (2 \times 10^8\text{ m/s}) = \mathbf{3920 \text{ meters (3.92 km)}}}$$
🏛️ Solved Numerical 5: Pure ALOHA vs. Slotted ALOHA Station Scaling

A broadcast channel is shared by $N$ independent stations, each generating a $1000\text{-bit}$ frame on average every $10\text{ seconds}$. The channel bandwidth is $50\text{ kbps}$. How many stations can be supported by: (a) Pure ALOHA, and (b) Slotted ALOHA?

Solution: Frame duration $T_{\text{fr}} = \frac{1000\text{ bits}}{50,000\text{ bps}} = 0.020\text{ s} = 20\text{ ms}$.

$$\text{Each station generation rate } \lambda = \frac{1 \text{ frame}}{10\text{ s}} = 0.1 \text{ frames/s}$$ $$\text{Normalized frame rate per station } g = \lambda \times T_{\text{fr}} = 0.1 \times 0.020 = 0.002 \text{ frames/slot}$$

Topic 36.5: Mathematical MAC Throughput & Wireless Protocol States

Carrier Sense Multiple Access with Collision Detection (CSMA/CD) Efficiency Formula: $$\mathbf{\eta = \frac{1}{1 + 5 \times a} \quad \text{where } a = \frac{T_{\text{prop}}}{T_{\text{trans}}}}$$ As network cable length increases or transmission data rate increases, parameter $a$ grows, dramatically reducing channel efficiency. This is why 10-Gigabit and 100-Gigabit Ethernet completely abandon CSMA/CD in favor of Switched Full-Duplex Point-to-Point Links!
IEEE 802.11 Standard Frequency Band Modulation & Physical Layer Max Physical Data Rate MIMO Stream Count
802.11b (Wi-Fi 1)$2.4\text{ GHz}$DSSS / CCK$11\text{ Mbps}$$1 \times 1$ (SISO)
802.11g (Wi-Fi 3)$2.4\text{ GHz}$OFDM (64-QAM)$54\text{ Mbps}$$1 \times 1$
802.11n (Wi-Fi 4)$2.4\text{ GHz} / 5\text{ GHz}$MIMO-OFDM (64-QAM)$600\text{ Mbps}$Up to $4 \times 4$ MIMO
802.11ac (Wi-Fi 5)$5\text{ GHz}$ only256-QAM ($160\text{ MHz}$ channels)$3.46\text{ Gbps}$Up to $8 \times 8$ MU-MIMO
802.11ax (Wi-Fi 6)$2.4 / 5 / 6\text{ GHz}$OFDMA + 1024-QAM$9.6\text{ Gbps}$$8 \times 8$ Target Wake Time
802.11be (Wi-Fi 7)$2.4 / 5 / 6\text{ GHz}$4096-QAM ($320\text{ MHz}$ channels)$46\text{ Gbps}$$16 \times 16$ Multi-Link MLO
🏛️ Solved Numerical 6: Binary Exponential Backoff Simulation

In a 10 Mbps CSMA/CD Ethernet network (Slot Time = $51.2 \ \mu\text{s}$), two stations collide 3 consecutive times. What is the probability that they will collide again on the 4th attempt?

Solution:

Q6. Compare IEEE 802.3 Ethernet, IEEE 802.4 Token Bus, and IEEE 802.5 Token Ring across media access method and determinism. (8 Marks)
• IEEE 802.3 (Ethernet): CSMA/CD random access; probabilistic latency (collisions increase with load); simple, low cost; worldwide industry standard.
• IEEE 802.4 (Token Bus): Physical bus, logical token ring; deterministic access delay; complex token maintenance; industrial automation (MAP).
• IEEE 802.5 (Token Ring): Physical star/ring; token passing round-robin; deterministic worst-case latency; zero collisions; high hardware cost.
Q7. Explain Transparent Bridges and the Backward Learning Algorithm for building MAC address forwarding tables. (8 Marks)
A Transparent Bridge automatically learns network topology without manual configuration:
1. When a frame arrives on port $P$ from source MAC $S$, the bridge records $(S, P, \text{timestamp})$ in its forwarding database.
2. When forwarding to destination MAC $D$: if $D$ is in the table on port $P'$, forwards frame strictly out port $P'$ (or filters if $P'=P$); if $D$ is unknown, floods frame out all ports except the arrival port!

Topic 36.6: Advanced Multi-Access Markov Chains & High-Speed Ethernet Fabrics

The theoretical throughput of Random Access MAC protocols under saturation load is modeled via Poisson arrival processes and Markov birth-death state chains:

Slotted ALOHA vs. 1-Persistent CSMA Throughput Derivations: - Slotted ALOHA: $S = G e^{-G} \implies S_{\text{max}} = \frac{1}{e} = \mathbf{36.8\%}$ (at offer load $G = 1$). - Non-Persistent CSMA: $\mathbf{S = \frac{G e^{-a G}}{G(1 + 2a) + e^{-a G}}} \implies S_{\text{max}} \approx \mathbf{82\%}$ (for small $a = 0.01$). - 1-Persistent CSMA: $\mathbf{S = \frac{G [1 + G + a G (1 + G + a G/2)] e^{-G(1+2a)}}{G(1 + 2a) - (1 - e^{-a G}) + (1 + a G) e^{-G(1+a)}}} \approx \mathbf{53\%}$.
🏛️ Step-by-Step Solved Problem: Complete 5-Switch Spanning Tree Protocol (STP) Convergence Trace

Consider 5 enterprise switches $S_1, S_2, S_3, S_4, S_5$ interconnected with 100 Mbps Fast Ethernet links (Link Cost = 19):

Topic 36.7: Master University Long-Answer Exam Solutions Bank

Q8. Explain the IEEE 802.11 Wi-Fi Medium Access Control architecture: DCF, PCF, Inter-Frame Spaces (SIFS, PIFS, DIFS, EIFS), and Network Allocation Vector (NAV). (10 Marks)
IEEE 802.11 defines two operational coordination modes:
• Distributed Coordination Function (DCF): Contention-based CSMA/CA protocol used by all Wi-Fi stations.
• Point Coordination Function (PCF): Optional contention-free polling protocol managed by the Access Point (AP).
• Inter-Frame Space (IFS) Hierarchy:
1. SIFS (Short IFS): Highest priority; used for instant ACK, CTS, and fragmented frame bursts.
2. PIFS (PCF IFS): Medium priority; used by Access Point to gain channel control for PCF polling.
3. DIFS (DCF IFS): Normal priority; minimum idle duration a station must wait before contending for channel.
4. EIFS (Extended IFS): Longest wait time used when a frame is received with checksum errors.
• Network Allocation Vector (NAV): A virtual carrier sensing timer maintained inside every Wi-Fi station. When a station overhears an RTS or CTS frame, it sets its NAV to the duration value specified in the frame header, remaining asleep and deferring all channel access until NAV reaches 0!
Q9. Compare 10BASE5 (Thicknet), 10BASE2 (Thinnet), 10BASE-T, 100BASE-TX, and 1000BASE-T across physical media, topology, connector, and maximum span. (8 Marks)
• 10BASE5: Thick coaxial cable, Bus topology, Vampire taps & AUI cable, max $500\text{ meters}$.
• 10BASE2: RG-58 Thin coaxial cable, Bus topology, BNC T-connectors, max $185\text{ meters}$.
• 10BASE-T: Cat 3/5 UTP copper, Star topology (Hub), RJ-45, max $100\text{ meters}$.
• 100BASE-TX: Cat 5 UTP (2 pairs), Star topology (Switch), RJ-45, max $100\text{ meters}$.
• 1000BASE-T: Cat 5e/6 UTP (4 pairs simultaneously full-duplex), Star topology, RJ-45, max $100\text{ meters}$.
Q10. Explain Virtual LANs (VLANs, IEEE 802.1Q) and how Trunking and Inter-VLAN Routing operate. (8 Marks)
• VLAN (Virtual LAN): Logically segments a single physical Layer 2 switch into multiple independent broadcast domains. Broadcast traffic from VLAN 10 (Finance) is completely isolated from VLAN 20 (Engineering) without requiring separate physical switches.
• Trunking (IEEE 802.1Q): A high-speed link carrying traffic for multiple VLANs simultaneously between switches. Each frame is tagged with a 4-byte 802.1Q header containing a 12-bit VLAN ID (VID).
• Inter-VLAN Routing: Because VLANs are isolated broadcast domains, communication between two different VLANs requires a Layer 3 Router (using "Router-on-a-Stick" subinterfaces) or a Multi-Layer Switch (SVI / Switched Virtual Interfaces).