By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
Hyper-practical, zero-fluff, hands-on playbook for real-world security engineers
Network segmentation is slicing a flat network into isolated zones to contain breaches, reduce attack surfaces, and enforce least privilege. A DMZ (Demilitarized Zone) is a semi-trusted buffer between the internet and your internal network, while micro-segmentation takes this further by isolating workloads inside the same network (e.g., separating a database from an app server).
Why this matters in production: - Without segmentation, a single compromised host (e.g., a misconfigured web server) can pivot to your entire network. Think of it like a fire in a building with no firewalls—it spreads unchecked. - DMZs let you expose public services (web, email, VPN) without risking your internal LAN. If your web server gets hacked, the attacker still can’t reach your HR or finance systems. - Micro-segmentation is critical in cloud and containerized environments. If your Kubernetes pod gets breached, micro-segmentation ensures it can’t talk to other pods unless explicitly allowed.
Real-world scenario: You’re a security engineer at a healthcare company. A ransomware attack hits your public-facing web portal. Without segmentation, the malware spreads to your patient records database (HIPAA violation = fines + lawsuits). With segmentation, the breach is contained to the DMZ, and your internal systems stay safe.
ANY:ANY ALLOW
Prerequisites: - A hypervisor (VirtualBox, VMware, or bare metal). - pfSense ISO (free download: https://www.pfsense.org/download/). - Two additional VMs (e.g., Ubuntu for a web server, Kali Linux for testing).
You’ll create: - WAN (Internet): Simulated by a NAT network in VirtualBox. - DMZ: A separate subnet for public-facing services. - LAN: Internal network (no direct internet access).
VirtualBox Network Setup:1. Go to File-Preferences-Network.2. Add two Host-Only Networks: - vboxnet0 (LAN, e.g., 192.168.1.0/24). - vboxnet1 (DMZ, e.g., 10.0.0.0/24).3. Configure pfSense VM with 3 network adapters: - Adapter 1: NAT (WAN). - Adapter 2: Host-Only (vboxnet0 – LAN). - Adapter 3: Host-Only (vboxnet1 – DMZ).
vboxnet0
192.168.1.0/24
vboxnet1
10.0.0.0/24
em0
em1
em2
192.168.1.1/24
10.0.0.1/24
Goal: Allow internet-DMZ (web server), but block DMZ-LAN.
https://192.168.1.1
10.0.0.10
10.0.0.10/24
10.0.0.1
bash sudo apt update && sudo apt install apache2 -y sudo systemctl start apache2
http://10.0.0.10
bash ping 192.168.1.100 # Should fail (blocked by firewall).
bash nmap -sV 10.0.0.10 # Should show ports 80/443 open. nmap -sV 192.168.1.1 # Should show no open ports (LAN is blocked).
Expected Output:
Starting Nmap 7.92 ( https://nmap.org ) Nmap scan report for 10.0.0.10 Host is up (0.00045s latency). PORT STATE SERVICE VERSION 80/tcp open http Apache httpd 2.4.41 443/tcp open ssl/http Apache httpd 2.4.41
ANY
DENY ALL
web-tier
db-tier
admin-tier
dmz-web-01
lan-db-01
server1
server2
prod
dev
web
db
10.0.0.10:3306-192.168.1.20:3306
Diagnostics-Backup/Restore
nmap
curl
Trap: "Put the web server on the LAN" (wrong—exposes internal network).
Port-based: "Which port should be open between the DMZ and LAN for a database server?"
3306
1433
5432
Trap: "All ports" (wrong—violates least privilege).
Micro-segmentation: "Which technology enforces micro-segmentation in a cloud environment?"
Trap: "VLANs" (wrong—VLANs are Layer 2, not fine-grained enough).
Zero Trust: "Which principle is most aligned with micro-segmentation?"
Challenge: You’re deploying a web app in AWS. The app has: - A public-facing web server (EC2 in a public subnet). - A private database (RDS in a private subnet). - An admin bastion host (EC2 in a separate private subnet).
Task: Configure Security Groups to:1. Allow internet-web server (HTTP/HTTPS).2. Allow web server-database (MySQL port 3306).3. Allow bastion host-database (SSH port 22).4. Block all other traffic.
22
Solution:
# 1. Web Server Security Group (allow HTTP/HTTPS from internet) aws ec2 create-security-group --group-name WebServerSG --description "Allow HTTP/HTTPS" --vpc-id vpc-123456 aws ec2 authorize-security-group-ingress --group-id sg-123456 --protocol tcp --port 80 --cidr 0.0.0.0/0 aws ec2 authorize-security-group-ingress --group-id sg-123456 --protocol tcp --port 443 --cidr 0.0.0.0/0 # 2. Database Security Group (allow MySQL from WebServerSG, SSH from BastionSG) aws ec2 create-security-group --group-name DBSG --description "Allow MySQL from WebServerSG" --vpc-id vpc-123456 aws ec2 authorize-security-group-ingress --group-id sg-789012 --protocol tcp --port 3306 --source-group sg-123456 aws ec2 authorize-security-group-ingress --group-id sg-789012 --protocol tcp --port 22 --source-group sg-456789 # BastionSG # 3. Bastion Host Security Group (allow SSH from your IP) aws ec2 create-security-group --group-name BastionSG --description "Allow SSH from admin IP" --vpc-id vpc-123456 aws ec2 authorize-security-group-ingress --group-id sg-456789 --protocol tcp --port 22 --cidr YOUR_IP/32
Why it works: - Least privilege: Only necessary ports are open. - Micro-segmentation: Web server can’t SSH to the database (only MySQL). - Stateful: AWS Security Groups track connections (no need to allow return traffic).
192.168.x.x
ALLOW specific
vconfig add eth0 10
eth0
aws ec2 authorize-security-group-ingress --group-id sg-123456 --protocol tcp --port 80 --cidr 0.0.0.0/0
az network nsg rule create --nsg-name MyNSG --name AllowHTTP --priority 100 --access Allow --protocol Tcp --direction Inbound --source-address-prefixes '*' --source-port-ranges '*' --destination-address-prefixes '*' --destination-port-ranges 80
kubectl apply -f - <<EOF
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: deny-all-except-web
spec:
podSelector: {}
policyTypes: ["Ingress"]
ingress:
- ports:
- port: 80
protocol: TCP
EOF
Action: Block
Interface: DMZ
Protocol: Any
Source: Any
Destination: LAN net
80 (HTTP)
443 (HTTPS)
22 (SSH)
3306 (MySQL)
1433 (MSSQL)
5432 (PostgreSQL)
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.