0Pricing
Cloud & IT Cert Prep · Lesson

Network Segmentation and VLANs

Learn how subnets, VLANs, DMZs, and micro-segmentation limit lateral movement and contain the blast radius of a breach.

Network Segmentation and VLANs is a free Cloud & IT Cert Prep lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cloud & IT Cert Prep learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Why Network Segmentation Matters

Network segmentation divides a large flat network into smaller, isolated zones. Without segmentation, a single compromised host can communicate with every other device on the network — giving attackers free rein once they are inside. Segmentation enforces the principle of least privilege at the network layer: a workstation should not be able to directly reach a database server, and a guest Wi-Fi device should never see internal file shares. Segmentation dramatically reduces the blast radius of a breach.

VLANs: Virtual Local Area Networks

A VLAN (Virtual Local Area Network) is a logical network created on a switch that groups ports together regardless of physical location. Devices in the same VLAN communicate as if they are on the same physical segment; devices in different VLANs cannot communicate without going through a router or Layer 3 switch that enforces access control. VLANs are tagged with an 802.1Q header that carries a VLAN ID (1-4094), allowing a single physical link (trunk port) to carry traffic from multiple VLANs simultaneously.

# Cisco switch: create a VLAN and assign a port
vlan database
vlan 10 name CORPORATE
vlan 20 name GUEST
exit

interface FastEthernet0/1
  switchport mode access
  switchport access vlan 10

# Trunk port carries all VLANs:
interface GigabitEthernet0/1
  switchport mode trunk

Subnets and Layer 3 Segmentation

While VLANs segment at Layer 2, subnets segment at Layer 3 (IP). Each VLAN typically maps to its own subnet, and routing between subnets is controlled by a firewall or router that applies access control lists. This creates a clean separation: VLAN 10 might be 10.10.10.0/24 for corporate users, VLAN 20 might be 10.20.20.0/24 for guests. Firewall rules between subnets enforce which traffic is allowed and which is blocked at the IP level.

# Typical subnet assignment:
# VLAN 10 Corporate:  10.10.10.0/24  gateway 10.10.10.1
# VLAN 20 Guest:      10.20.20.0/24  gateway 10.20.20.1
# VLAN 30 Servers:    10.30.30.0/24  gateway 10.30.30.1
# VLAN 40 IoT:        10.40.40.0/24  gateway 10.40.40.1

# ACL: allow corporate to servers, deny guest to servers
# DENY  ip 10.20.20.0/24 10.30.30.0/24
# ALLOW ip 10.10.10.0/24 10.30.30.0/24

DMZ: The Screened Subnet

A DMZ (Demilitarized Zone), also called a screened subnet, is a network zone that sits between the internet and the internal network. Public-facing servers — web servers, mail servers, DNS servers — are placed in the DMZ so that external users can reach them without having direct access to internal systems. If a DMZ host is compromised, the internal firewall prevents the attacker from reaching sensitive internal resources. The DMZ is a critical segmentation concept tested heavily on Security+.

# DMZ architecture:
# [Internet]
#     |
# [External firewall / perimeter]
#     |
# [DMZ: web server, mail server, bastion host]
#     |
# [Internal firewall]
#     |
# [Internal LAN: workstations, databases, file servers]

Micro-Segmentation

Micro-segmentation takes network isolation to the workload level, applying security policies between individual VMs, containers, or applications rather than just between network zones. Software-defined networking (SDN) and hypervisor-based tools (VMware NSX, AWS Security Groups) enforce policies without requiring hardware changes. Micro-segmentation is a core component of zero-trust architecture because it removes implicit trust between workloads running in the same data center or cloud region.

# AWS Security Group micro-segmentation example:
# Web tier:  allow inbound 443 from Internet
# App tier:  allow inbound 8080 from Web SG only
# DB tier:   allow inbound 3306 from App SG only
# Result: no direct path from Internet to database

VLAN Hopping Attacks

VLAN hopping is an attack that allows traffic to escape its VLAN and reach another VLAN without going through a router. Two methods exist: switch spoofing, where an attacker configures their NIC to speak 802.1Q trunking and negotiates a trunk link with the switch, gaining access to all VLANs; and double tagging, where an attacker wraps a frame with two 802.1Q headers to make it appear destined for a different VLAN. The defenses include disabling dynamic trunking protocol (DTP), explicitly configuring access ports, and not using the native VLAN for user traffic.

# Defenses against VLAN hopping:
# 1. Disable DTP on access ports
interface FastEthernet0/1
  switchport mode access
  switchport nonegotiate

# 2. Change native VLAN from default (VLAN 1)
interface GigabitEthernet0/1
  switchport trunk native vlan 999

# 3. Disable unused ports and put them in a dead VLAN
switchport access vlan 999

Air Gaps and Physical Segmentation

The most extreme form of network segmentation is an air gap — a network with no physical or logical connection to external networks. Air-gapped systems are used for highly classified government networks, industrial control systems, and nuclear facility controls. Data transfer requires physical media (USB drives, CDs), which itself introduces risks (Stuxnet spread via USB to reach air-gapped Iranian centrifuges). Even air-gapped systems need controls: strict media management, hardware write blockers, and endpoint protection.

Network Access Control (NAC)

NAC (Network Access Control) enforces security policies before a device is allowed onto the network. NAC systems check the device's posture — patch level, antivirus status, and certificate — before granting full network access. Devices that fail checks are quarantined to a remediation VLAN where they can only reach update servers. NAC integrates with 802.1X for authentication and communicates with directory services to apply policies based on user role and device type.

# NAC 802.1X posture check workflow:
# 1. Device connects to switch port
# 2. Switch challenges device via 802.1X (EAP)
# 3. Device authenticates to RADIUS server
# 4. RADIUS checks posture agent health data
# 5a. Compliant -> assigned to CORPORATE VLAN (10)
# 5b. Non-compliant -> assigned to QUARANTINE VLAN (99)

East-West vs North-South Traffic

Traditional perimeter security focused on north-south traffic — data entering and leaving the data center from external sources. Modern attackers exploit east-west traffic — lateral movement between servers within the data center or cloud environment, which historically lacked inspection. Micro-segmentation and internal firewalls address east-west risks. SIEM correlation rules should monitor for unusual east-west connection patterns, such as a workstation suddenly communicating with dozens of internal hosts, which may indicate a worm or active attacker.

Segmentation in Industrial Control Systems

ICS/SCADA networks that control physical infrastructure (power grids, water treatment, manufacturing) require strict segmentation from corporate IT networks. The Purdue Model defines levels from field devices (Level 0) through plant control (Level 2) to enterprise IT (Level 4), with a DMZ between Levels 2 and 3 to prevent direct connectivity. NERC CIP standards mandate this separation for energy sector organizations. A breach in the corporate network should never be able to directly manipulate physical actuators or sensors.

# Purdue Model segmentation zones:
# Level 4: Enterprise (ERP, email)
# Level 3.5: ICS DMZ (historians, patching servers)
# Level 3: Site operations (MES)
# Level 2: Area supervisory (SCADA, HMI)
# Level 1: Basic control (PLCs, DCS)
# Level 0: Field devices (sensors, actuators)
#
# One-way data diode between Level 2 and 3.5 for highest security

Blast Radius and Defense in Depth

The ultimate goal of network segmentation is to minimize the blast radius of any single compromise — the scope of damage an attacker can cause once inside one segment. Combined with other controls (endpoint detection, strict IAM, patch management), segmentation creates defense in depth: multiple independent layers that an attacker must breach serially. Segmentation alone does not prevent initial compromise, but it slows attackers, generates detection opportunities, and limits the impact of ransomware and worms that rely on unrestricted lateral movement.

Quick Check

Test your understanding of CompTIA Security+ (SY0-701) concepts from this lesson.

Lesson Recap

In this lesson you learned: VLANs provide logical Layer 2 segmentation that limits broadcast domains and lateral movement, a DMZ (screened subnet) isolates public-facing servers between an external and internal firewall, and VLAN hopping attacks can be prevented by disabling dynamic trunking, changing the native VLAN, and assigning unused ports to a dead VLAN. Next up we explore common network attacks including DoS, spoofing, and MITM.

Frequently asked questions

Is the “Network Segmentation and VLANs” lesson free?

Yes — the full text of “Network Segmentation and VLANs” is free to read here on the web, and the Cloud & IT Cert Prep course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cloud & IT Cert Prep course, upgrade to CoddyKit PRO.

What will I learn in “Network Segmentation and VLANs”?

Learn how subnets, VLANs, DMZs, and micro-segmentation limit lateral movement and contain the blast radius of a breach. You practise Cloud & IT Cert Prep with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Cloud & IT Cert Prep?

No prior experience is required. Cloud & IT Cert Prep on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Network Segmentation and VLANs” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Cloud & IT Cert Prep lesson?

Yes. Every Cloud & IT Cert Prep lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. TCP/IP Model and Common Ports
  2. Firewalls: Packet Filtering vs Next-Gen
  3. Network Segmentation and VLANs
  4. Common Network Attacks: DoS, Spoofing, and MITM
← Back to Cloud & IT Cert Prep