Switch
1. Definition
A switch is a Layer-2 (data link layer) device with many ports, often described as a multiport bridge. It examines the destination MAC address of each incoming frame and forwards it only to the port on which that address lives. Every port is its own collision domain, so all ports can transmit simultaneously in full duplex at their full rated speed.
2. How a Switch Works
┌───────────────────────── SWITCH ─────────────────────────┐
│ MAC address table (CAM) │
│ port 1 → 00:1A:2B:...:11 port 3 → 00:1A:2B:...:33 │
│ port 2 → 00:1A:2B:...:22 port 4 → 00:1A:2B:...:44 │
└───┬────────────┬───────────────┬───────────────┬─────────┘
│ │ │ │
PC-A PC-B PC-C PC-D
(each port = its own collision domain, full duplex, dedicated bandwidth)
- Learning — the switch reads the source MAC of every frame and records "address → incoming port" in its MAC/CAM address table, with an ageing timer (typically 5 minutes).
- Forwarding — if the destination MAC is in the table, the frame goes out only on that port.
- Flooding — if the destination is unknown, or the frame is a broadcast (FF:FF:FF:FF:FF:FF) or multicast, the switch floods it out of all ports except the incoming one.
- Filtering — if source and destination are on the same port, the frame is dropped (no need to forward it).
- Loop avoidance — redundant links between switches create loops; STP/RSTP blocks redundant paths logically while keeping them ready for failover.
Switching modes:
| Mode | Behaviour | Speed / risk |
|---|---|---|
| Store-and-forward | Receives the whole frame, checks the FCS, then forwards | Safest (drops corrupted frames); slight latency |
| Cut-through | Forwards as soon as the destination MAC is read | Fastest; forwards corrupted frames |
| Fragment-free | Waits for the first 64 bytes (minimum frame) | Compromise |
3. Features of Modern Switches
Full-duplex per port (no collisions) · dedicated bandwidth per port (1 Gbps to a PC, not shared) · VLANs (logical segmentation of broadcast domains) · port security (limit MAC addresses per port) · QoS (priority queues for voice/video) · link aggregation (LACP) (bond several links for extra bandwidth and redundancy) · port mirroring / SPAN (copy traffic of one port to a monitoring port) · SNMP/remote management, MAC address table size (thousands of entries) · STP/RSTP/MSTP · PoE (Power over Ethernet) — powers IP phones, cameras and access points through the data cable · stacking — several physical switches managed as one · Layer-3 switches that can also route between VLANs and subnets.
4. Types of Switch
Unmanaged (plug and play, home/small office) · Managed/smart (VLANs, monitoring, QoS; offices and campuses) · Layer-3 switch (hardware routing between VLANs — used in the core) · Modular/chassis switch (line cards for hundreds of ports in a data centre) · PoE switch (CCTV, Wi-Fi APs, IP phones) · Stackable switches (stacked to act as one logical unit). In a campus design, switches are arranged in three tiers: access (per floor) → distribution (per building) → core (campus backbone).
5. Advantages
- Much better performance than a hub — no collisions, full duplex, dedicated bandwidth per port; a 24-port gigabit switch offers up to 24 Gbps aggregate (48 Gbps in full duplex).
- Security and isolation — unicast traffic goes only to the intended port, so sniffing becomes difficult; port security blocks unknown devices.
- VLAN segmentation — departments, staff/guest Wi-Fi and servers can be separated logically, reducing broadcast traffic.
- Intelligence — monitoring, statistics, QoS for voice/video, PoE, redundant links with STP.
- Scalable and easy to expand — add a switch or a port; stackable switches grow capacity without redesign.
- Same or lower cost than a hub today, with far greater capability.
6. Disadvantages
- More expensive and complex than a hub — managed switches need configuration and trained staff.
- Layer-2 limitations — a switch cannot route between different networks (IP subnets); a router or L3 switch is required, and it does not normally stop broadcasts within a VLAN.
- Loops — a misconfigured redundant link causes a broadcast storm; STP must be configured correctly.
- Single point of failure if a core switch dies without redundancy (solved by stacking and dual uplinks).
- Broadcast storms / MAC flooding attacks are possible if features such as storm control, port security and DHCP snooping are not enabled.
7. Exam Points
- Define a switch; state its OSI layer and how it differs from a hub — 5 marks, almost certain.
- Explain MAC learning, forwarding, flooding and filtering in a switch — 5-7 marks, very frequent.
- Explain store-and-forward vs cut-through switching — 3-5 marks.
- Explain VLANs, STP, link aggregation and PoE with one use each — 5 marks.
- Differentiate hub, switch and router (tabular) — 5-7 marks, very frequent.
- Advantages and disadvantages of switches — 5 marks.
- Numerical: aggregate bandwidth of a 24-port gigabit switch — 3 marks.