Definition and Role
What is a Switch?
Switch: a network device operating at OSI Layer 2 (Data Link Layer). Function: receive, inspect, and forward Ethernet frames based on MAC addresses. Primary role: connect devices within LAN segments, reduce collisions, improve bandwidth utilization.
Role in Computer Networks
Role: enable communication between multiple devices in LAN. Functionality: isolate collision domains, maintain separate communication paths, direct frames only to intended recipients. Outcome: reduce unnecessary traffic, enhance network efficiency.
Comparison with Other Devices
Compared to hubs: switches forward based on MAC; hubs broadcast all traffic. Compared to routers: switches operate at Layer 2, routers at Layer 3. Switches are intermediary between end devices and routers in typical LAN setups.
"Switches revolutionized LAN design by enabling efficient, collision-free communications at the data link layer." -- Andrew S. Tanenbaum
Working Principle
Frame Reception and Inspection
Reception: switch receives Ethernet frame on ingress port. Inspection: extracts source and destination MAC addresses. Decision: determine forwarding port based on MAC address table lookup.
Forwarding and Filtering
Forwarding: if destination MAC address known, forward frame only to corresponding port. Filtering: if source and destination on same port, drop frame to prevent unnecessary transmission.
Learning Process
Learning: switch records source MAC address and ingress port in MAC address table dynamically. Table aging: entries expire after timeout to accommodate topology changes.
Types of Switches
Unmanaged Switches
Unmanaged: plug-and-play devices. No configuration options. Suitable for small networks or home use. Feature set: basic frame forwarding, MAC learning.
Managed Switches
Managed: support configuration, monitoring, and management protocols (SNMP, CLI, web GUI). Features: VLANs, QoS, port mirroring, security policies, link aggregation.
Smart Switches
Hybrid category: limited management capabilities. Offer essential features like VLAN support and basic QoS. Suitable for mid-sized networks needing some control without complexity.
Switch Architecture
Hardware Components
Components: switching fabric, input/output ports, MAC address table memory, processor for management. Switching fabric: internal data path enabling simultaneous frame transfers.
Switching Fabric Types
Types: shared memory, bus-based, crossbar. Shared memory: frames buffered in central memory. Crossbar: multiple simultaneous paths, high throughput. Bus-based: all ports share a common bus, lower performance.
Buffering Techniques
Input buffering: store frames at ingress port to manage contention. Output buffering: store frames before transmission. Combined buffering balances latency and throughput.
Frame Forwarding Methods
Store-and-Forward Switching
Mechanism: switch receives entire frame, checks for errors (CRC), then forwards. Advantage: error-free frames forwarded. Disadvantage: higher latency.
Cut-Through Switching
Mechanism: switch forwards frame after reading destination MAC (first 6 bytes). Advantage: low latency. Disadvantage: error frames may be forwarded.
Fragment-Free Switching
Mechanism: hybrid approach, switch waits for first 64 bytes before forwarding. Purpose: filter collision fragments but reduce latency compared to store-and-forward.
MAC Address Table
Structure and Storage
Table: stores MAC addresses and associated ports. Data structure: hash table or CAM memory for fast lookup. Dynamic entries: learned from traffic; static entries: manually configured.
Learning and Aging
Learning: source MAC addresses recorded when frames arrive. Aging: entries removed after inactivity (default 5 minutes) to adapt to network changes.
Table Overflow and Security
Overflow: too many MAC addresses can cause table overflow, forcing broadcast flooding. Security impact: attackers may flood switch with fake MACs (MAC flooding attack).
VLAN Support
Definition of VLAN
VLAN: Virtual LAN, logical segmentation of a physical LAN into separate broadcast domains. Benefit: improves security and traffic management.
Switch VLAN Implementation
Implementation: switch ports assigned to VLANs. Frame tagging: IEEE 802.1Q tags added to frames for VLAN identification across trunks.
VLAN Trunking
Trunk ports: carry traffic for multiple VLANs simultaneously. Tagging protocol: 802.1Q inserts VLAN ID in Ethernet frame header.
Broadcast and Collision Domains
Collision Domains
Collision domain: network segment where frames can collide. Switch ports separate collision domains, enabling full-duplex communication.
Broadcast Domains
Broadcast domain: network segment where broadcast frames are forwarded. Switches forward broadcasts to all ports within VLAN, extending broadcast domains unless VLANs are used.
Impact on Network Performance
Segmentation: switches reduce collision domains drastically. VLANs reduce broadcast domains, improving scalability and performance.
Switch vs Hub
Operational Differences
Hub: Layer 1 device, repeats electrical signal to all ports. Switch: Layer 2 device, forwards frames selectively based on MAC addresses.
Performance Comparison
Switch: reduces collisions, supports full-duplex, higher throughput. Hub: single collision domain, half-duplex only, prone to collisions.
Use Cases
Switches: modern LANs needing efficiency and security. Hubs: obsolete, legacy or very simple networks.
Performance Metrics
Latency
Latency: time delay between frame reception and forwarding. Influenced by switching method, buffering, and processing speed.
Throughput
Throughput: maximum data rate switch can handle without frame loss. Measured in Mbps or Gbps.
Port Density and Scalability
Port density: number of physical ports available. Scalability: ability to add switches or stack to expand network size.
| Metric | Description | Typical Range |
|---|---|---|
| Latency | Frame processing delay | 1-10 µs |
| Throughput | Maximum data rate | 1 Gbps to 100 Gbps |
| Port Density | Number of ports | 4 to 128 ports |
Common Protocols and Standards
IEEE 802.1Q
Standard: defines VLAN tagging protocol for Ethernet frames. Allows multiple VLANs on a single physical link.
Spanning Tree Protocol (STP)
Protocol: prevents switching loops by creating a loop-free logical topology. Variants: RSTP (Rapid STP), MSTP (Multiple STP).
Link Aggregation Control Protocol (LACP)
Protocol: combines multiple physical links into single logical link to increase bandwidth and redundancy.
Security Features
Port Security
Feature: restrict MAC addresses allowed on a port. Limits unauthorized device access, mitigates MAC flooding attacks.
Access Control Lists (ACLs)
Feature: filter frames based on MAC addresses, VLANs, protocols. Used to enforce security policies at Layer 2.
Dynamic ARP Inspection (DAI)
Feature: prevents ARP spoofing by validating ARP packets against trusted databases.
Future Trends
Software-Defined Networking (SDN)
Trend: decoupling data plane and control plane. Switches become simple forwarding devices controlled by centralized controller.
Multi-Gigabit Ethernet
Trend: support for speeds between 2.5 Gbps and 10 Gbps over existing cabling. Enables higher bandwidth without full infrastructure upgrade.
Energy-Efficient Switching
Trend: switches with adaptive power consumption based on traffic load to reduce energy costs.
References
- Andrew S. Tanenbaum, David J. Wetherall, Computer Networks, 5th Ed., Pearson, 2011, pp. 311-350.
- William Stallings, Data and Computer Communications, 10th Ed., Pearson, 2013, pp. 271-302.
- Behrouz A. Forouzan, Data Communications and Networking, 5th Ed., McGraw-Hill, 2012, pp. 425-460.
- James F. Kurose, Keith W. Ross, Computer Networking: A Top-Down Approach, 7th Ed., Pearson, 2017, pp. 240-275.
- Cisco Systems, LAN Switching and Wireless, CCNA Exploration Companion Guide, Cisco Press, 2008, pp. 130-170.
MAC Address Table Entry Structure:+-------------------+------------------+------------------+| MAC Address (48b) | Port Number (int) | Age Timer (secs) |+-------------------+------------------+------------------+Learning Algorithm:1. On frame reception at port P:2. Extract source MAC (S)3. If S not in table or mapped to different port, update entry with (S,P)4. Reset age timer for S5. Forward frame based on destination MAC lookup6. Periodically remove entries with expired age timerSpanning Tree Protocol (STP) Basic Algorithm:1. Elect Root Bridge (lowest Bridge ID)2. Determine Root Ports (lowest cost path to root)3. Designate Ports for each segment4. Block redundant paths to prevent loops5. Recalculate on topology changes