SECURITY ENGINEERING · PART 2 · NETWORKING FOR SECURITY · DEFENSE · 31 OF 229

Network Segmentation, VLANs and DMZ Design

Limiting how far an attacker can travel once inside: why flat networks turn one compromised machine into a company-wide breach, zones and trust levels, VLANs and subnets, the DMZ for public-facing systems, three-tier designs, microsegmentation down to single workloads, the same ideas in cloud VPCs, and how to test that the walls really hold.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 9
  9. 10
  10. 11
  11. 12
  12. 13
  13. 14
  14. 15
  15. 16
  16. 17
  17. 18
  18. 19
  19. 20
  20. 21
  21. 22
  22. 23
  23. 24
  24. 25
  25. 26
  26. 27
  27. 28
  28. 29
  29. 30
  30. 31
  31. 32
  32. 33
  33. 34
  34. 35
  35. 36
  36. 37
  37. 38
  38. 39
  39. 40
  40. 41
  41. 42
  42. 43
  43. 44
  44. 45
  45. 46
  46. 47
  47. 48
  48. 49
  49. 50
  50. 51
  51. 52
  52. 53
  53. 54
  54. 55
  55. 56
  56. 57
  57. 58
  58. 59
  59. 60
  60. 61
  61. 62
  62. 63
  63. 64
  64. 106
  65. 107
  66. 108
  67. 109
  68. 110
  69. 111
  70. 112
  71. 113
  72. 114
  73. 115
  74. 116
  75. 117
  76. 118
  77. 119
  78. 120
  79. 121
  80. 122
  81. 123
  82. 124
  83. 125
  84. 126
  85. 127
  86. 128
  87. 129
  88. 130
  89. 131
  90. 132
  91. 133
  92. 134
  93. 135
  94. 136
  95. 137
  96. 138
  97. 139
  98. 140
  99. 141
  100. 142
  101. 143
  102. 144
1 / 13

Press play to hear the narration, or step through at your own pace.

Key takeaways

  • Flat networks spread everything
  • zones with default deny
  • DMZ and three tiers
  • microsegmentation
  • test the walls

Notes

The flat network

Start with what goes wrong. In a flat network every machine can reach every other: laptops, printers, servers and databases all on one segment. One phished laptop can scan the whole company and connect straight to the database server. Ransomware spreads to everything it can reach, which is everything. The blast radius of any single mistake is the entire organisation. Many of the worst ransomware incidents on record were this simple.

Why flat is dangerous
  • one big network: laptops, printers, servers, databases
  • any machine can connect to any other
  • one phished laptop can scan and attack everything
  • ransomware spreads to every machine it can reach
  • blast radius = the company

Zones

The answer is to group systems into zones by their job and by how sensitive they are. Traffic inside a zone flows freely. Traffic between zones must cross a firewall with explicit rules and default deny. The guiding principle is that a less trusted zone may not open connections into a more trusted one, except through a few named doors. You are applying least privilege from Part zero, to network paths instead of people.

Zones and trust
  • a zone: systems with a similar job and sensitivity
  • traffic inside a zone flows
  • traffic between zones crosses a firewall, with rules
  • default deny between zones
  • less trusted zones may not start connections into more trusted ones

The DMZ

The oldest zone design is the DMZ, the demilitarised zone. It holds the systems the internet is allowed to touch: web servers, reverse proxies, mail gateways. The internet may reach the DMZ. The DMZ may reach inward only on a few specific ports. The internet may never reach the inside directly. You design it assuming a DMZ server will be compromised one day, so that when it is, the attacker still faces another wall.

Demilitarised zone
  • holds public-facing systems: web servers, reverse proxies, mail gateways
  • internet may reach the DMZ
  • the DMZ may reach inside only on specific ports
  • internet may never reach inside directly
  • assume the DMZ will be compromised one day

Three tiers

The standard application layout extends that idea into three tiers. The web tier takes requests, the application tier runs the logic, and the data tier holds the database. The rules are short: web may talk to app on one port, app may talk to data on one port, and nothing may skip a tier. The database has no path to or from the internet at all. An attacker who takes the web tier still has two walls in front of the data.

Classic three-tier design
  • web tier: takes requests
  • app tier: runs the logic
  • data tier: holds the database
  • rules: web to app on one port; app to data on one port; nothing skips a tier
  • the database has no route to or from the internet
  • compromise the web tier and two walls still stand

More zones

A few more zones are worth having. Staff laptops in one. Guest Wi-Fi with internet access only. Printers, cameras and other devices isolated, because they are rarely patched. A management zone that is the only place administrative access may come from. Production separated from staging and development, which would have stopped the attack in Part zero. Backups reachable by almost nothing. And payment systems in a tiny zone of their own.

Zones worth having
  • office: staff laptops
  • guest Wi-Fi: internet only IoT and printers: isolated
  • management: the only place admin access may come from production apart from staging and development
  • backups: reachable by almost nothing
  • payment systems: a tiny zone (shrinks PCI scope)

How it is built

How is it built? A subnet is a range of addresses, and a VLAN is a separate virtual network carried on shared switches. Together they draw the lines between zones. But a line is not a wall. If the router between two VLANs passes everything, you have segmentation on a diagram and none in reality. The wall is the firewall or access list between them. Switch settings matter too, since a misconfigured port can let a device hop between VLANs.

The mechanics
  • subnet: a range of addresses, e.g. 10.0.2.0/24
  • VLAN: a separate virtual network on shared switches
  • a VLAN alone is a line, not a wall
  • the wall is the firewall or ACL between them
  • VLAN hopping exists: disable auto-trunking on ports

Microsegmentation

Zones still allow neighbours inside one zone to attack each other. Microsegmentation shrinks the zone until it holds a single workload, with a policy for each: the orders service may call the payments service on one port, and nothing else may. It is built with cloud security groups, Kubernetes network policies and host firewalls rather than hardware. This is zero trust at the network layer: no connection is allowed just because of where it comes from.

Down to the workload
  • zones still let neighbours attack each other
  • microsegmentation: a policy per workload
  • "orders may call payments on 443; nothing else may"
  • cloud security groups, Kubernetes network policies, host firewalls
  • this is zero trust at the network layer

In the cloud

In the cloud the same design uses different names. A VPC is your private network. Public subnets hold only load balancers. Applications and databases live in private subnets with no public addresses. Security groups do the microsegmentation, one per workload. And the strongest wall of all is not a network control: it is putting production and non-production in separate cloud accounts, so no network path or shared permission connects them.

Cloud translation
  • VPC or VNet: your private network
  • public subnet: load balancers only private subnets: apps and databases, no public IPs
  • security groups: the microsegmentation
  • separate accounts for prod and non-prod: the strongest wall

Prove it

Finally, prove it. From a machine in each zone, scan the others, and confirm that only the allowed ports answer. Keep the rules as code and review changes. Log and alert on denied traffic between zones, because a laptop trying to reach a database is either a mistake or an attacker. And look for the classic holes: a rule allowing everything between two zones, a server with a leg in both, and admin accounts shared across every zone.

Test the walls
  • from each zone, scan the others with Nmap: only the allowed ports answer?
  • keep rules as code, reviewed
  • log and alert on denied cross-zone traffic
  • watch for the classic holes: "any-any" between zones, dual-homed servers, shared admin accounts

Common mistakes

Mistakes. A single flat network. VLANs with no filtering between them, which is decoration. Production and staging sharing a network or an account. Databases with public addresses. Administrative access allowed from any laptop instead of a management zone. Rules between zones that only ever grow. And never testing from the inside, so the first person to discover the gaps is an attacker.

Avoid these
  • one flat network
  • VLANs with no filtering between them
  • prod and staging together
  • databases with public IPs
  • admin from any laptop
  • rules that grow, never shrink
  • never testing from inside

Say it like this

In the interview: I divide the network into zones by function and sensitivity, with default deny between them. Public-facing systems go in a DMZ, application and data tiers may only talk to the adjacent tier, administration comes only from a management zone, and production is separated from non-production, ideally in different cloud accounts. On top I microsegment individual workloads with security groups or network policies, and I verify it with scans from each zone.

In the interview
  • "Zones by function and sensitivity, default deny
  • between them: a DMZ for public
  • systems, app and data tiers
  • that only talk to the next
  • tier, a management zone, prod apart from non-prod.
  • Then microsegment workloads, and test with scans."

Interview questions

Q1What is network segmentation and why does it matter?

Dividing a network into zones with controlled, default-deny traffic between them. It limits lateral movement, so a compromised machine cannot directly reach unrelated systems, shrinking the blast radius of breaches and ransomware.

Q2What is a DMZ?

A demilitarised zone is a network segment for public-facing systems such as web servers and reverse proxies. The internet may reach the DMZ, the DMZ may reach internal systems only on specific ports, and the internet may never reach the internal network directly.

Q3What is a three-tier network architecture?

Separate web, application and data tiers, where each tier accepts connections only from the tier in front of it on specific ports. The database tier has no route to or from the internet, so an attacker must breach several layers to reach data.

Q4Is a VLAN a security boundary?

Only when traffic between VLANs is filtered. A VLAN separates broadcast domains, but if the router or firewall between VLANs allows everything, there is no real isolation. Switch hardening is also needed to prevent VLAN hopping.

Q5What is microsegmentation?

Applying network policy at the level of individual workloads rather than large zones, so each service may communicate only with the specific peers and ports it needs. It is implemented with security groups, Kubernetes network policies or host firewalls.

Q6How does segmentation work in the cloud?

With VPCs or VNets, public subnets for load balancers only, private subnets without public IPs for applications and databases, security groups per workload, and separate accounts or subscriptions for production and non-production.

Q7Why separate production from staging and development?

Non-production systems are usually less patched and monitored but often share credentials or network paths with production. Separation, ideally at the account level, stops a compromise of a test system from reaching production data.

Q8How do you verify that segmentation works?

Scan from within each zone to confirm only permitted ports are reachable, review firewall rules kept as code, alert on denied cross-zone traffic, and look for exceptions such as any-any rules, dual-homed hosts and shared administrative accounts.