Switching Technologies and Virtual LANs

CompTIA Network+ • Chapter 11

Switching Technologies and Virtual LANs

Learn how Ethernet switches make forwarding decisions, how VLANs divide a physical switch into logical networks, and how STP, trunks, inter-VLAN routing, and switch security keep a modern LAN efficient and resilient.

MAC Learning802.1QSTP / RSTPVLANsInter-VLAN RoutingPoE
HOSTSWITCH
11.1 • Introduction

The Role of Switching in a LAN

A Layer 2 switch connects devices within an Ethernet local area network and forwards frames by examining their destination MAC addresses. Unlike a hub, which repeats every signal out every port, a switch builds a record of where devices are located and sends most frames only through the port that leads to the destination.

This selective forwarding improves bandwidth use and gives every switch port its own collision domain. However, all ports remain in the same broadcast domain unless VLANs or a Layer 3 boundary are introduced.

⇄

Forward

Send a frame through the port associated with its destination MAC address.

◎

Filter

Keep a frame from being transmitted through ports where the destination cannot exist.

⌁

Flood

Replicate certain frames through all eligible ports except the port on which they arrived.

Exam focus: A switch separates collision domains. A router or VLAN boundary separates broadcast domains.
11.2 • MAC Address Learning

How a Switch Builds Its MAC Address Table

A switch learns from the source MAC address of every frame it receives. It records the address, the ingress port, and usually the VLAN. This information is held in the MAC address table, also called a Content Addressable Memory (CAM) table.

1

A frame enters a switch port. The switch reads both the source and destination MAC addresses.

2

The switch associates the source address with the ingress port and VLAN. Existing entries are refreshed.

3

The switch looks up the destination address and selects a forwarding action.

4

Dynamically learned entries eventually age out if no matching source traffic is observed.

VLANMAC addressPortType
1000:1A:2B:3C:4D:01Gi0/1Dynamic
1000:1A:2B:3C:4D:02Gi0/4Dynamic
2000:1A:2B:3C:4D:03Gi0/7Dynamic
Remember: Learning uses the source address; forwarding decisions use the destination address.
11.3 • Ethernet Forwarding

Known Unicast, Unknown Unicast, and Broadcast

TrafficSwitch actionReason
Known unicastForward through one matching portThe destination MAC address exists in the table.
Unknown unicastFlood within the VLANThe destination MAC address has not yet been learned.
BroadcastFlood within the VLANThe destination is FF:FF:FF:FF:FF:FF and is intended for every host in the broadcast domain.
MulticastFlood or selectively forwardBehaviour depends on multicast features such as IGMP snooping.

ARP demonstrates the relationship between broadcasts and unicasts. An IPv4 host first broadcasts an ARP request asking which device owns a destination IP address. The owner normally responds with a unicast ARP reply containing its MAC address.

L2 SWITCHMAC address table Host AHost BHost CHost D

The switch learns where hosts are located and restricts known-unicast traffic to the required path.

Mini MAC-Learning Simulator

Select a frame. Watch the switch learn the source and decide what to do with the destination.

MAC table is empty.
11.4 • Inter-Switch Links

Access Ports, Trunks, and IEEE 802.1Q

An access port normally carries traffic for one VLAN and connects an endpoint such as a workstation, printer, or IP camera. A trunk port carries traffic for multiple VLANs, commonly between switches, a switch and a router, or a switch and a virtualization host.

IEEE 802.1Q inserts a four-byte tag into an Ethernet frame. The tag includes a 12-bit VLAN identifier, allowing VLAN IDs from 0 through 4095; in ordinary configurations, IDs 1–4094 are usable, with 0 and 4095 reserved.

SWITCH 1SWITCH 2 VLANs 10, 20, 30VLANs 10, 20, 30 VLAN 10VLAN 20VLAN 30 802.1Q TRUNK

Tagged traffic

Frames carry an 802.1Q VLAN tag so the receiving device can associate them with the correct VLAN.

Native VLAN

Frames belonging to the native VLAN are untagged by default. Native VLAN mismatches can create connectivity and security problems.

Important: A trunk does not merge VLANs. It transports several logically separate VLANs over one physical link.
11.5 • Switching Loops

Why Redundant Links Can Create Broadcast Storms

Redundant paths improve availability, but Ethernet frames do not contain a Layer 2 equivalent of the IP Time to Live field. If parallel paths form a loop, broadcast and unknown-unicast frames can circulate repeatedly. The results include a broadcast storm, duplicate frames, high link utilization, and an unstable MAC address table known as MAC flapping.

↻

Frames circulate

Flooded frames repeatedly cross the same links.

≋

MAC table instability

The same source appears to arrive through different ports.

!

LAN disruption

Bandwidth and switch resources become overwhelmed.

11.6 • STP and RSTP

Creating a Loop-Free Logical Topology

Spanning Tree Protocol (STP), standardized as IEEE 802.1D, prevents Layer 2 loops by placing selected redundant ports into a non-forwarding state. The physical links remain connected and can be activated if the preferred path fails. Rapid Spanning Tree Protocol (RSTP), IEEE 802.1w, achieves the same purpose with faster convergence.

How the spanning tree is selected

1

Switches exchange Bridge Protocol Data Units (BPDUs).

2

The switch with the lowest Bridge ID becomes the root bridge. The ID is influenced by bridge priority and MAC address.

3

Each non-root switch chooses one root port, representing its best path toward the root bridge.

4

Each network segment selects a designated port. Alternate redundant paths are prevented from forwarding.

STP conceptMeaning
Root bridgeThe reference switch at the centre of the spanning-tree calculation.
Root portThe best path from a non-root switch toward the root bridge.
Designated portThe forwarding port selected for a LAN segment.
Blocked / alternate portA redundant path held out of forwarding to prevent a loop.
ConvergenceThe period in which switches recalculate and agree on a stable topology.
Exam clue: STP does not remove redundancy. It controls redundancy by permitting only a loop-free set of forwarding paths.
11.7 • Virtual LANs

Logical Segmentation on Shared Switches

A Virtual LAN (VLAN) creates a logical Layer 2 broadcast domain independent of the physical switch layout. Ports assigned to different VLANs behave as though they were attached to different switches, even when they share the same hardware.

ONE PHYSICAL SWITCHseveral logical broadcast domains VLAN 10 • SalesVLAN 10 • SalesVLAN 20 • HRVLAN 20 • HRVLAN 30 • VoiceVLAN 30 • Voice

Why organizations use VLANs

Security separation

Place user groups, servers, guests, voice devices, or management interfaces into distinct broadcast domains.

Broadcast control

Limit the scope of broadcasts instead of exposing every switched device to every broadcast.

Flexible organization

Group users by role or policy rather than by their location in a building.

Policy enforcement

Apply routing, access control, quality of service, and monitoring at the boundary between VLANs.

Static VLAN assignment maps a switch port to a VLAN through manual configuration. Dynamic VLAN assignment uses information such as device identity, authentication, or policy to determine the VLAN automatically. Static assignment is simpler and common; dynamic assignment is more flexible but depends on additional control systems.

Security boundary note: A VLAN provides segmentation, but it is not a complete security solution. Inter-VLAN routing and access policies must be configured carefully.
11.8 • Inter-VLAN Routing

Communicating Across VLAN Boundaries

Devices in the same VLAN can exchange frames through Layer 2 switching. Devices in different VLANs require a Layer 3 device because each VLAN normally maps to a different IP subnet. The Layer 3 interface for a VLAN becomes the hosts' default gateway.

Separate router interfaces

Each VLAN connects to a different physical router interface. Clear but inefficient at scale.

Router-on-a-stick

One router interface uses tagged subinterfaces over an 802.1Q trunk.

Layer 3 switch

Switch Virtual Interfaces (SVIs) perform routing at high speed inside a multilayer switch.

VLANExample subnetDefault gateway / SVI
10 — Sales192.168.10.0/24192.168.10.1
20 — HR192.168.20.0/24192.168.20.1
30 — Voice192.168.30.0/24192.168.30.1
Traffic path: Host → access port → VLAN gateway → routing decision and policy check → destination VLAN → destination host.
11.9 • Switch Features and Protection

Operational, Security, and Availability Features

FeaturePurposeKey detail
Port securityRestricts which MAC addresses may use a port.May use static, dynamically learned, or sticky MAC addresses and can shut, restrict, or protect on violation.
Flood guard / storm controlLimits excessive broadcast, multicast, or unknown-unicast traffic.Helps keep abnormal flooding from consuming the LAN.
Port channelCombines several physical links into one logical link.Provides added bandwidth and redundancy; protocols include LACP (802.1AX, formerly 802.3ad).
PoEDelivers electrical power over Ethernet cabling.Powers devices such as wireless APs, VoIP phones, and cameras.
PoE budgetDefines total power that a switch can supply.A switch may have enough ports but insufficient wattage to power every attached device at maximum demand.
Management VLANSeparates switch-management traffic from ordinary user traffic.Should be protected by access controls and secure management protocols.

Common Power over Ethernet standards

StandardCommon nameMaximum power from sourceTypical use
IEEE 802.3afPoE15.4 WPhones, basic cameras
IEEE 802.3atPoE+30 WWireless APs, advanced cameras
IEEE 802.3bt Type 3PoE++60 WMultiradio APs, displays
IEEE 802.3bt Type 4Higher-power PoE90 WHigh-power endpoints
11.10 • Troubleshooting

A Structured Switching and VLAN Checklist

  1. Verify the physical layer: power, cable, transceiver, port LEDs, negotiated speed, and duplex.
  2. Check port state: confirm the interface is enabled and not err-disabled or blocked unexpectedly.
  3. Confirm VLAN membership: validate the access VLAN and ensure the VLAN exists on every required switch.
  4. Inspect trunks: verify trunk mode, allowed VLANs, tagging, and native VLAN consistency.
  5. Review the MAC table: determine whether source addresses are learned on the expected interfaces and VLANs.
  6. Check STP: identify the root bridge and ensure port roles match the intended topology.
  7. Validate Layer 3: confirm IP subnet, default gateway, SVI state, routing, and access-control rules.
  8. Look for security actions: review port-security violations, storm-control counters, and authentication results.
Scenario tip: If users in the same VLAN cannot communicate, investigate Layer 1/2 and VLAN membership first. If users in different VLANs cannot communicate, also investigate gateways, routing, and access policies.
11.11 • Guided Switch Lab

Practice Tasks for a Switch Simulator

Task A — Observe learning

  1. Clear the MAC table.
  2. Generate traffic between two hosts.
  3. Inspect learned source addresses.
  4. Wait or clear entries to observe aging.

Task B — Build VLANs

  1. Create VLANs 10 and 20.
  2. Assign access ports.
  3. Test within each VLAN.
  4. Confirm that cross-VLAN traffic fails without routing.

Task C — Configure a trunk

  1. Connect two switches.
  2. Set the link to 802.1Q trunking.
  3. Allow the required VLANs.
  4. Test same-VLAN connectivity across switches.

Task D — Examine STP

  1. Add a redundant link.
  2. Identify the root bridge.
  3. Find the blocked or alternate port.
  4. Fail the active path and observe convergence.
11.12 • Knowledge Check

Test Your Understanding

1. Which address does a switch use when learning a new MAC table entry?
2. What happens to an unknown-unicast frame?
3. Which technology prevents Layer 2 switching loops?
4. What is required for hosts in different VLANs to communicate?
11.13 • Chapter Summary

Essential Takeaways

Switches learn source MAC addresses and forward using destination addresses.
Known unicasts use one path; unknown unicasts and broadcasts are flooded within a VLAN.
802.1Q trunks carry traffic for multiple VLANs using tags.
STP and RSTP create a loop-free logical topology while retaining physical redundancy.
Each VLAN is a separate Layer 2 broadcast domain and normally a separate IP subnet.
Communication between VLANs requires routing through a router or multilayer switch.
Port security and storm control protect access ports and limit abnormal traffic.
Port channels add bandwidth and resilience; PoE carries power to compatible endpoints.