Segmentation is the map of what may talk to what, enforced by something that actually drops the rest. A diagram that nobody enforces is not segmentation, it is a poster. This skill designs zones around trust and blast radius, writes firewall policy that defaults to deny, and proves the policy with tests from both sides of every boundary. It applies to networks you own or are authorized to defend, including on-premises, cloud, and OT-adjacent networks.
Quick Workflow
- Inventory assets and data flows: what talks to what, on which ports, and why, from real flow logs, not from memory.
- Define zones by trust and blast radius: user, server, management, DMZ, OT, and cloud, each with its own risk if breached.
- Define conduits: the only permitted paths between zones, each with protocol, port, direction, and business owner.
- Write policy default deny, with explicit allows in order, and a final log rule so denied attempts are visible.
- Place enforcement where it cannot be bypassed: firewalls between zones, host firewalls inside zones, and jump hosts for admin.
- Build remote access through one controlled path, never direct admin access from user networks to servers.
- Test every boundary from both sides: allowed flows succeed, denied flows fail, and the denies are logged.
- Govern changes: every policy change is a ticket with owner, expiry for temporary rules, and a test after implementation.
1. Zone and conduit design
Start from data flows, not from a vendor diagram. Pull a week of flow logs, group by source zone and destination zone, and the real architecture will show itself, including the flows nobody documented. Zones follow two rules: hosts that share a trust level and hosts that share a blast radius go together. A domain controller and a print server do not share either, so they do not share a zone.
# flows.py - summarize observed flows into a zone-to-zone matrix.
# Input: flows.csv with columns src_zone, dst_zone, port, protocol, bytes.
# Output: the conduit candidates, ranked by volume, plus any flow
# that crosses a boundary you thought was closed.
import csv
from collections import Counter
flows = Counter()
with open("flows.csv", newline="") as fh:
for row in csv.DictReader(fh):
flows[(row["src_zone"], row["dst_zone"], row["port"], row["protocol"])] += int(row["bytes"])
print("Top zone-to-zone flows (conduit candidates):")
for (src, dst, port, proto), total in flows.most_common(25):
print(f" {src} -> {dst} port {port}/{proto} ({total} bytes)")
print("\nSuspicious crossings to investigate before designing policy:")
for (src, dst, port, proto) in flows:
if src == "user" and dst == "ot":
print(f" USER -> OT on {port}/{proto}: must be closed, no business case")
if src == "dmz" and dst == "management":
print(f" DMZ -> MANAGEMENT on {port}/{proto}: must be closed, use a jump host")
A conduit table is the contract. Every row needs an owner and a reason, because the day someone asks "why is this open" is the day an undocumented rule gets deleted or, worse, kept out of fear.
Conduit table (example, adapt zones and ports to your network):
Source zone -> Destination zone | Port/protocol | Owner | Reason
user -> server (web) | 443/tcp | web team | user web access
server (web) -> server (db) | 5432/tcp | dba team | app to database
management -> server (all) | 22/tcp,3389 | infra team | admin via jump host
dmz -> internet | 443/tcp | web team | outbound updates
user -> ot | DENY ALL | n/a | no business case
dmz -> management | DENY ALL | n/a | no business case
server (db) -> internet | DENY ALL | n/a | updates via proxy
2. Firewall policy authoring
Write default deny first, then explicit allows, then a final log rule. Order matters: the first matching rule wins, so broad allows above narrow denies will silently swallow the denies. Keep the rule base small enough to review: if it passes 200 rules, it is probably carrying dead rules and overlapping allows that nobody dares to touch. Review quarterly, delete what has no traffic and no owner, and give every temporary rule an expiry date.
# Example host/zone firewall policy (nftables syntax).
# Default deny, explicit allows, final logging. Adapt interfaces
# and addresses to your network; test in a lab before production.
table inet filter {
chain forward {
type filter hook forward priority 0; policy drop;
# Established traffic back to the requester is allowed.
ct state established,related accept
# Conduit: user zone to web servers on HTTPS only.
iifname "user" oifname "server" tcp dport 443 accept
# Conduit: web tier to database tier on the database port only.
iifname "web" oifname "db" tcp dport 5432 accept
# Conduit: management zone to servers for admin, via jump host only.
iifname "mgmt" oifname "server" tcp dport { 22, 3389 } accept
# Everything else is dropped and logged for review.
log prefix "SEG-DENY: " drop
}
}
# Apply and verify the policy, then prove the denies are logged.
# Run these on the firewall host after loading the ruleset above.
nft -c -f /etc/nftables/segmentation.nft && echo "syntax OK"
nft -f /etc/nftables/segmentation.nft
nft list ruleset | head -40
# Watch the deny log while a test host attempts a denied flow.
journalctl -k -f | grep "SEG-DENY"
3. Microsegmentation inside zones
Zone firewalls stop zone-to-zone movement. Inside a zone, one compromised server can still reach its neighbours, so servers get host firewalls too: each server accepts only the ports its role needs, from only the zones and hosts that need them. This is where ransomware lateral movement dies, because the next hop is closed even though the attacker is already inside the zone. Start with the crown jewels (domain controllers, databases, backup servers), then expand, and keep a per-role template so a new server inherits the right policy at build time, not after an incident.
4. Validation testing
A policy that has never been tested is a guess. Test from a host in each zone, against a host in each other zone, for both allowed and denied flows. Allowed flows must succeed end to end, denied flows must fail, and every denied attempt must appear in the firewall log. Record the results as the evidence auditors and incident responders will ask for, and re-run the tests after every policy change and every network change, not just once a year.
# Boundary test script: run from a test host in each source zone.
# Expected results are written in comments; a mismatch is a finding,
# not a note. Replace addresses with your zone test hosts.
TARGET_WEB="10.20.0.10"
TARGET_DB="10.30.0.10"
echo "Allowed flow, user -> web on 443 (expect: open)"
nmap -Pn -p 443 "$TARGET_WEB" | grep -E "443/tcp"
echo "Denied flow, user -> db on 5432 (expect: filtered)"
nmap -Pn -p 5432 "$TARGET_DB" | grep -E "5432/tcp"
echo "Denied flow, user -> db on 22 (expect: filtered)"
nmap -Pn -p 22 "$TARGET_DB" | grep -E "22/tcp"
Edge cases
- Legacy systems that cannot be patched: isolate them in their own zone with no internet and no path to crown jewels, and treat every conduit to them as a temporary rule with an owner.
- OT networks: never scan OT hosts with aggressive probes, and never route OT traffic through IT firewalls that can be rebooted for patching. Use a data diode or a strictly one-way conduit where the process allows it.
- Cloud landing zones: security groups are the zone firewall, but they are per-workload, so a misconfigured group opens one host, not the zone. Audit groups centrally and alert on 0.0.0.0/0.
- Temporary rules for incidents or projects: expiry dates are mandatory. A rule without an expiry is a permanent rule that nobody remembers approving.
- Encrypted traffic crossing zones: the firewall sees ports, not payloads, so a conduit on 443 can carry anything. Pair network segmentation with TLS inspection or application allowlisting where the risk justifies it.
- Flat networks with no budget for new firewalls: host firewalls and VLAN ACLs on existing switches still deliver most of the benefit, and they are better than waiting for a perfect design.
Key references
- NIST SP 800-207, Zero Trust Architecture (zone and policy model).
- CISA guidance on network segmentation and ransomware containment: https://www.cisa.gov/
- MITRE ATT&CK T1021 (Remote Services) and T1135 (Network Share Discovery), the lateral movement techniques segmentation blocks.
- nftables documentation and rule syntax reference for the example policy format used above.
- Zero trust principle applied here: no zone trusts another by default, every conduit is explicit, logged, and reviewed.
