Configuring Network Segmentation with VLANs
When to Use
- Segmenting an enterprise network into isolated security zones (corporate, servers, DMZ, guest, IoT)
- Meeting compliance requirements (PCI-DSS, HIPAA, SOC 2) that mandate network isolation for sensitive data
- Reducing blast radius of security incidents by preventing lateral movement between network segments
- Isolating high-risk devices (IoT, BYOD, legacy systems) from critical infrastructure
- Implementing defense-in-depth by combining VLANs with firewall rules and access control lists
Do not use VLANs as the sole security control without Layer 3 filtering, for isolating networks that require air-gapping, or without proper switch hardening against VLAN hopping attacks.
Prerequisites
- Managed switches supporting 802.1Q VLAN trunking (Cisco Catalyst, HP Aruba, Juniper EX, etc.)
- Layer 3 switch or firewall for inter-VLAN routing and access control
- Network design document specifying VLAN assignments, IP subnets, and traffic flow requirements
- Console or SSH access to switches with privileged configuration mode
- Understanding of 802.1Q trunking, STP, and inter-VLAN routing concepts
Workflow
Step 1: Design the VLAN Architecture
# Define VLANs based on security zones and function
VLAN Plan:
VLAN 10 - CORPORATE (10.10.10.0/24) - Employee workstations
VLAN 20 - SERVERS (10.10.20.0/24) - Internal servers
VLAN 30 - DMZ (10.10.30.0/24) - Internet-facing servers
VLAN 40 - GUEST (10.10.40.0/24) - Guest WiFi
VLAN 50 - IOT (10.10.50.0/24) - IoT/OT devices
VLAN 60 - VOIP (10.10.60.0/24) - VoIP phones
VLAN 100 - MANAGEMENT (10.10.100.0/24) - Switch/AP management
VLAN 999 - QUARANTINE (10.10.99.0/24) - Isolated/compromised hosts
VLAN 998 - NATIVE_UNUSED - Native VLAN (no traffic)
# Traffic flow matrix:
# CORPORATE -> SERVERS: Allowed (specific ports)
# CORPORATE -> DMZ: Allowed (HTTP/HTTPS only)
# CORPORATE -> GUEST: Denied
# CORPORATE -> IOT: Denied
# GUEST -> Any Internal: Denied
# IOT -> SERVERS: Allowed (specific ports to specific hosts only)
# DMZ -> SERVERS: Allowed (database ports only)
# MANAGEMENT -> All: Allowed (from management stations only)
Step 2: Configure VLANs on Cisco Catalyst Switch
! Enter configuration mode
enable
configure terminal
! Create VLANs
vlan 10
name CORPORATE
exit
vlan 20
name SERVERS
exit
vlan 30
name DMZ
exit
vlan 40
name GUEST
exit
vlan 50
name IOT
exit
vlan 60
name VOIP
exit
vlan 100
name MANAGEMENT
exit
vlan 998
name NATIVE_UNUSED
exit
vlan 999
name QUARANTINE
exit
! Configure access ports for workstations (VLAN 10)
interface range GigabitEthernet1/0/1-24
switchport mode access
switchport access vlan 10
switchport nonegotiate
spanning-tree portfast
spanning-tree bpduguard enable
no shutdown
exit
! Configure access ports for servers (VLAN 20)
interface range GigabitEthernet1/0/25-36
switchport mode access
switchport access vlan 20
switchport nonegotiate
spanning-tree portfast
spanning-tree bpduguard enable
no shutdown
exit
! Configure trunk ports to other switches
interface GigabitEthernet1/0/48
switchport mode trunk
switchport trunk encapsulation dot1q
switchport trunk native vlan 998
switchport trunk allowed vlan 10,20,30,40,50,60,100
switchport nonegotiate
no shutdown
exit
! Configure trunk to firewall/router
interface GigabitEthernet1/0/47
switchport mode trunk
switchport trunk encapsulation dot1q
switchport trunk native vlan 998
switchport trunk allowed vlan 10,20,30,40,50,60,100
switchport nonegotiate
no shutdown
exit
! Shutdown unused ports
interface range GigabitEthernet1/0/37-46
shutdown
switchport mode access
switchport access vlan 999
exit
Step 3: Harden Switch Against VLAN Hopping
! Disable DTP on all ports (prevents switch spoofing)
interface range GigabitEthernet1/0/1-46
switchport nonegotiate
exit
! Set native VLAN to unused VLAN on all trunks
interface range GigabitEthernet1/0/47-48
switchport trunk native vlan 998
exit
! Enable DHCP Snooping
ip dhcp snooping
ip dhcp snooping vlan 10,20,30,40,50,60
interface GigabitEthernet1/0/47
ip dhcp snooping trust
exit
! Enable Dynamic ARP Inspection
ip arp inspection vlan 10,20,30,40,50,60
interface GigabitEthernet1/0/47
ip arp inspection trust
exit
! Enable IP Source Guard (prevents IP spoofing)
interface range GigabitEthernet1/0/1-36
ip verify source
exit
! Enable Port Security
interface range GigabitEthernet1/0/1-24
switchport port-security
switchport port-security maximum 2
switchport port-security violation restrict
switchport port-security aging time 60
exit
! Set VTP to transparent mode (prevents VTP attacks)
vtp mode transparent
! Enable BPDU Guard globally
spanning-tree portfast bpduguard default
! Enable Storm Control
interface range GigabitEthernet1/0/1-36
storm-control broadcast level 10
storm-control multicast level 10
storm-control action shutdown
exit
Step 4: Configure Inter-VLAN Routing with ACLs
! On the Layer 3 switch or firewall, configure SVIs
interface Vlan10
ip address 10.10.10.1 255.255.255.0
no shutdown
exit
interface Vlan20
ip address 10.10.20.1 255.255.255.0
no shutdown
exit
interface Vlan30
ip address 10.10.30.1 255.255.255.0
no shutdown
exit
interface Vlan40
ip address 10.10.40.1 255.255.255.0
no shutdown
exit
interface Vlan50
ip address 10.10.50.1 255.255.255.0
no shutdown
exit
! ACL: Corporate to Servers (allow specific services)
ip access-list extended CORP-TO-SERVERS
permit tcp 10.10.10.0 0.0.0.255 10.10.20.0 0.0.0.255 eq 80
permit tcp 10.10.10.0 0.0.0.255 10.10.20.0 0.0.0.255 eq 443
permit tcp 10.10.10.0 0.0.0.255 10.10.20.0 0.0.0.255 eq 445
permit udp 10.10.10.0 0.0.0.255 10.10.20.0 0.0.0.255 eq 53
permit icmp 10.10.10.0 0.0.0.255 10.10.20.0 0.0.0.255 echo
deny ip any any log
exit
! ACL: Guest to Internet only (deny all internal)
ip access-list extended GUEST-OUTBOUND
deny ip 10.10.40.0 0.0.0.255 10.0.0.0 0.255.255.255
deny ip 10.10.40.0 0.0.0.255 172.16.0.0 0.15.255.255
deny ip 10.10.40.0 0.0.0.255 192.168.0.0 0.0.255.255
permit tcp 10.10.40.0 0.0.0.255 any eq 80
permit tcp 10.10.40.0 0.0.0.255 any eq 443
permit udp 10.10.40.0 0.0.0.255 any eq 53
deny ip any any log
exit
! ACL: IoT limited access
ip access-list extended IOT-OUTBOUND
permit tcp 10.10.50.0 0.0.0.255 host 10.10.20.10 eq 443
permit tcp 10.10.50.0 0.0.0.255 any eq 443
permit udp 10.10.50.0 0.0.0.255 host 10.10.20.1 eq 53
deny ip 10.10.50.0 0.0.0.255 10.10.50.0 0.0.0.255 log
deny ip any any log
exit
! Apply ACLs to VLAN interfaces
interface Vlan10
ip access-group CORP-TO-SERVERS out
exit
interface Vlan40
ip access-group GUEST-OUTBOUND in
exit
interface Vlan50
ip access-group IOT-OUTBOUND in
exit
Step 5: Configure DHCP and DNS per VLAN
! DHCP pools for each VLAN
ip dhcp pool CORPORATE
network 10.10.10.0 255.255.255.0
default-router 10.10.10.1
dns-server 10.10.20.10
domain-name corp.example.com
lease 1
exit
ip dhcp pool GUEST
network 10.10.40.0 255.255.255.0
default-router 10.10.40.1
dns-server 1.1.1.1 8.8.8.8
lease 0 4
exit
ip dhcp pool IOT
network 10.10.50.0 255.255.255.0
default-router 10.10.50.1
dns-server 10.10.20.10
lease 7
exit
! Exclude gateway and server IPs from DHCP pools
ip dhcp excluded-address 10.10.10.1 10.10.10.10
ip dhcp excluded-address 10.10.40.1 10.10.40.10
ip dhcp excluded-address 10.10.50.1 10.10.50.10
Step 6: Verify and Test Segmentation
# From a workstation on VLAN 10 (Corporate):
# Should succeed:
ping 10.10.20.10 # Server access
curl https://10.10.20.10 # HTTPS to server
# Should fail:
ping 10.10.40.100 # Guest VLAN - should be blocked
ping 10.10.50.100 # IoT VLAN - should be blocked
# From a device on VLAN 40 (Guest):
# Should succeed:
ping 8.8.8.8 # Internet access
curl https://www.google.com
# Should fail:
ping 10.10.10.1 # Corporate gateway - blocked
ping 10.10.20.10 # Server - blocked
# Verify switch configuration
show vlan brief
show interfaces trunk
show ip arp inspection statistics
show ip dhcp snooping binding
show port-security
show ip access-lists
# Run VLAN hopping tests (from authorized pentest)
# These should all fail if hardening is correct:
# 1. DTP negotiation - should fail (nonegotiate)
# 2. Double tagging - should fail (native VLAN 998)
# 3. ARP spoofing - should fail (DAI enabled)
Key Concepts
| Term |
Definition |
| VLAN (Virtual LAN) |
Logical network partition at Layer 2 that groups switch ports into isolated broadcast domains, regardless of physical location |
| 802.1Q Trunking |
IEEE standard for VLAN tagging that adds a 4-byte header to Ethernet frames, identifying which VLAN a frame belongs to across trunk links |
| Inter-VLAN Routing |
Layer 3 forwarding of traffic between VLANs using a router, Layer 3 switch, or firewall with access control lists |
| Native VLAN |
VLAN assigned to untagged frames on trunk ports; should be set to an unused VLAN to prevent VLAN hopping attacks |
| DHCP Snooping |
Switch feature that validates DHCP messages and builds a binding table of IP-MAC-port mappings, preventing rogue DHCP servers |
| Port Security |
Switch feature that limits the number of MAC addresses per port and takes action (shutdown, restrict) when violated |
Tools & Systems
- Cisco Catalyst/Nexus: Enterprise managed switches with comprehensive VLAN, trunking, and security feature support
- HP Aruba CX: Enterprise switches with REST API management and VLAN segmentation capabilities
- pfSense/OPNsense: Open-source firewalls for inter-VLAN routing with stateful access control
- NetBox: Open-source IPAM and DCIM tool for documenting VLAN assignments, IP addressing, and network topology
- Nmap: Network scanner for verifying segmentation effectiveness by testing reachability across VLAN boundaries
Common Scenarios
Scenario: Implementing PCI-DSS Compliant Network Segmentation for Retail
Context: A retail chain must isolate their payment card processing systems from the general corporate network to meet PCI-DSS requirements. The current flat network has point-of-sale terminals, employee workstations, inventory servers, and guest WiFi on a single VLAN. The environment uses Cisco Catalyst 9300 switches.
Approach:
- Design VLAN architecture: POS terminals on VLAN 50 (CDE), corporate on VLAN 10, servers on VLAN 20, guest on VLAN 40
- Create VLANs on all access-layer switches and configure access ports by function
- Configure trunk links between switches with explicit VLAN allowed lists (no "all" trunks)
- Set native VLAN to 998 (unused) on all trunks and disable DTP on every port
- Configure ACLs on the Layer 3 switch: CDE VLAN can only reach the payment processor's IP on port 443; no other inter-VLAN traffic to/from CDE
- Enable DHCP snooping, DAI, and port security on all access ports
- Verify segmentation with penetration testing from each VLAN, confirming CDE is fully isolated
Pitfalls:
- Leaving DTP enabled on access ports, allowing VLAN hopping to reach the CDE
- Using VLAN 1 as the native VLAN, enabling double-tagging attacks
- Not restricting trunk allowed VLANs, carrying all VLANs including CDE to non-essential switches
- Creating ACLs that allow "any" source to reach CDE servers instead of specific POS terminal IPs
Output Format
## Network Segmentation Implementation Report
**Network**: Retail Store #42
**Switch Platform**: Cisco Catalyst 9300
**VLANs Configured**: 8
### VLAN Summary
| VLAN ID | Name | Subnet | Ports | Purpose |
|---------|------|--------|-------|---------|
| 10 | CORPORATE | 10.10.10.0/24 | Gi1/0/1-24 | Employee workstations |
| 20 | SERVERS | 10.10.20.0/24 | Gi1/0/25-36 | Internal servers |
| 30 | DMZ | 10.10.30.0/24 | Gi2/0/1-4 | Internet-facing |
| 40 | GUEST | 10.10.40.0/24 | WiFi AP trunk | Guest WiFi |
| 50 | CDE | 10.10.50.0/24 | Gi2/0/5-12 | POS terminals |
| 100 | MGMT | 10.10.100.0/24 | Gi1/0/48 | Switch management |
| 998 | NATIVE | N/A | Trunks only | Unused native |
| 999 | QUARANTINE | 10.10.99.0/24 | Unused ports | Isolation |
### Security Hardening Status
| Control | Status |
|---------|--------|
| DTP Disabled (nonegotiate) | All ports |
| Native VLAN (998) | All trunks |
| DHCP Snooping | VLANs 10,20,40,50 |
| Dynamic ARP Inspection | VLANs 10,20,40,50 |
| Port Security | Access ports |
| BPDU Guard | Access ports |
| Unused Ports Shutdown | 10 ports in VLAN 999 |
| VTP Transparent Mode | Enabled |
1---
2name: configuring-network-segmentation-with-vlans
3description: 'Designs and implements VLAN-based network segmentation on managed switches
4 to isolate network zones, enforce access control between segments, and reduce the
5 attack surface by limiting lateral movement paths in enterprise network environments.
6
7 '
8domain: cybersecurity
9subdomain: network-security
10tags:
11- network-security
12- vlan
13- network-segmentation
14- switch-security
15- 802.1q
16version: '1.0'
17author: mahipal
18license: Apache-2.0
19nist_csf:
20- PR.IR-01
21- DE.CM-01
22- ID.AM-03
23- PR.DS-02
24mitre_attack:
25- T1046
26- T1040
27- T1557.002
28- T1021
29- T1018
30source: https://github.com/mukul975/Anthropic-Cybersecurity-Skills
31source_commit: 04450304b12645cb2b974ab96d28c0664758a88d
32note: "Vendored verbatim from an external Apache-2.0 security-skill library, pinned by commit. Exceeds the internal 300-line skill guideline (agent-code-constraints.md) -- kept as-is because this is vendored reference material (forensics/threat-intel procedure), not Yana AI-authored content, and trimming would damage technical accuracy."
33metadata:
34 source: https://skillmd.com/skills/yanacuti1121/configuring-network-segmentation-with-vlans
35---
36
37# Configuring Network Segmentation with VLANs
38
39## When to Use
40
41- Segmenting an enterprise network into isolated security zones (corporate, servers, DMZ, guest, IoT)
42- Meeting compliance requirements (PCI-DSS, HIPAA, SOC 2) that mandate network isolation for sensitive data
43- Reducing blast radius of security incidents by preventing lateral movement between network segments
44- Isolating high-risk devices (IoT, BYOD, legacy systems) from critical infrastructure
45- Implementing defense-in-depth by combining VLANs with firewall rules and access control lists
46
47**Do not use** VLANs as the sole security control without Layer 3 filtering, for isolating networks that require air-gapping, or without proper switch hardening against VLAN hopping attacks.
48
49## Prerequisites
50
51- Managed switches supporting 802.1Q VLAN trunking (Cisco Catalyst, HP Aruba, Juniper EX, etc.)
52- Layer 3 switch or firewall for inter-VLAN routing and access control
53- Network design document specifying VLAN assignments, IP subnets, and traffic flow requirements
54- Console or SSH access to switches with privileged configuration mode
55- Understanding of 802.1Q trunking, STP, and inter-VLAN routing concepts
56
57## Workflow
58
59### Step 1: Design the VLAN Architecture
60
61```
62# Define VLANs based on security zones and function
63
64VLAN Plan:
65 VLAN 10 - CORPORATE (10.10.10.0/24) - Employee workstations
66 VLAN 20 - SERVERS (10.10.20.0/24) - Internal servers
67 VLAN 30 - DMZ (10.10.30.0/24) - Internet-facing servers
68 VLAN 40 - GUEST (10.10.40.0/24) - Guest WiFi
69 VLAN 50 - IOT (10.10.50.0/24) - IoT/OT devices
70 VLAN 60 - VOIP (10.10.60.0/24) - VoIP phones
71 VLAN 100 - MANAGEMENT (10.10.100.0/24) - Switch/AP management
72 VLAN 999 - QUARANTINE (10.10.99.0/24) - Isolated/compromised hosts
73 VLAN 998 - NATIVE_UNUSED - Native VLAN (no traffic)
74
75# Traffic flow matrix:
76# CORPORATE -> SERVERS: Allowed (specific ports)
77# CORPORATE -> DMZ: Allowed (HTTP/HTTPS only)
78# CORPORATE -> GUEST: Denied
79# CORPORATE -> IOT: Denied
80# GUEST -> Any Internal: Denied
81# IOT -> SERVERS: Allowed (specific ports to specific hosts only)
82# DMZ -> SERVERS: Allowed (database ports only)
83# MANAGEMENT -> All: Allowed (from management stations only)
84```
85
86### Step 2: Configure VLANs on Cisco Catalyst Switch
87
88```
89! Enter configuration mode
90enable
91configure terminal
92
93! Create VLANs
94vlan 10
95 name CORPORATE
96 exit
97vlan 20
98 name SERVERS
99 exit
100vlan 30
101 name DMZ
102 exit
103vlan 40
104 name GUEST
105 exit
106vlan 50
107 name IOT
108 exit
109vlan 60
110 name VOIP
111 exit
112vlan 100
113 name MANAGEMENT
114 exit
115vlan 998
116 name NATIVE_UNUSED
117 exit
118vlan 999
119 name QUARANTINE
120 exit
121
122! Configure access ports for workstations (VLAN 10)
123interface range GigabitEthernet1/0/1-24
124 switchport mode access
125 switchport access vlan 10
126 switchport nonegotiate
127 spanning-tree portfast
128 spanning-tree bpduguard enable
129 no shutdown
130 exit
131
132! Configure access ports for servers (VLAN 20)
133interface range GigabitEthernet1/0/25-36
134 switchport mode access
135 switchport access vlan 20
136 switchport nonegotiate
137 spanning-tree portfast
138 spanning-tree bpduguard enable
139 no shutdown
140 exit
141
142! Configure trunk ports to other switches
143interface GigabitEthernet1/0/48
144 switchport mode trunk
145 switchport trunk encapsulation dot1q
146 switchport trunk native vlan 998
147 switchport trunk allowed vlan 10,20,30,40,50,60,100
148 switchport nonegotiate
149 no shutdown
150 exit
151
152! Configure trunk to firewall/router
153interface GigabitEthernet1/0/47
154 switchport mode trunk
155 switchport trunk encapsulation dot1q
156 switchport trunk native vlan 998
157 switchport trunk allowed vlan 10,20,30,40,50,60,100
158 switchport nonegotiate
159 no shutdown
160 exit
161
162! Shutdown unused ports
163interface range GigabitEthernet1/0/37-46
164 shutdown
165 switchport mode access
166 switchport access vlan 999
167 exit
168```
169
170### Step 3: Harden Switch Against VLAN Hopping
171
172```
173! Disable DTP on all ports (prevents switch spoofing)
174interface range GigabitEthernet1/0/1-46
175 switchport nonegotiate
176 exit
177
178! Set native VLAN to unused VLAN on all trunks
179interface range GigabitEthernet1/0/47-48
180 switchport trunk native vlan 998
181 exit
182
183! Enable DHCP Snooping
184ip dhcp snooping
185ip dhcp snooping vlan 10,20,30,40,50,60
186interface GigabitEthernet1/0/47
187 ip dhcp snooping trust
188 exit
189
190! Enable Dynamic ARP Inspection
191ip arp inspection vlan 10,20,30,40,50,60
192interface GigabitEthernet1/0/47
193 ip arp inspection trust
194 exit
195
196! Enable IP Source Guard (prevents IP spoofing)
197interface range GigabitEthernet1/0/1-36
198 ip verify source
199 exit
200
201! Enable Port Security
202interface range GigabitEthernet1/0/1-24
203 switchport port-security
204 switchport port-security maximum 2
205 switchport port-security violation restrict
206 switchport port-security aging time 60
207 exit
208
209! Set VTP to transparent mode (prevents VTP attacks)
210vtp mode transparent
211
212! Enable BPDU Guard globally
213spanning-tree portfast bpduguard default
214
215! Enable Storm Control
216interface range GigabitEthernet1/0/1-36
217 storm-control broadcast level 10
218 storm-control multicast level 10
219 storm-control action shutdown
220 exit
221```
222
223### Step 4: Configure Inter-VLAN Routing with ACLs
224
225```
226! On the Layer 3 switch or firewall, configure SVIs
227interface Vlan10
228 ip address 10.10.10.1 255.255.255.0
229 no shutdown
230 exit
231interface Vlan20
232 ip address 10.10.20.1 255.255.255.0
233 no shutdown
234 exit
235interface Vlan30
236 ip address 10.10.30.1 255.255.255.0
237 no shutdown
238 exit
239interface Vlan40
240 ip address 10.10.40.1 255.255.255.0
241 no shutdown
242 exit
243interface Vlan50
244 ip address 10.10.50.1 255.255.255.0
245 no shutdown
246 exit
247
248! ACL: Corporate to Servers (allow specific services)
249ip access-list extended CORP-TO-SERVERS
250 permit tcp 10.10.10.0 0.0.0.255 10.10.20.0 0.0.0.255 eq 80
251 permit tcp 10.10.10.0 0.0.0.255 10.10.20.0 0.0.0.255 eq 443
252 permit tcp 10.10.10.0 0.0.0.255 10.10.20.0 0.0.0.255 eq 445
253 permit udp 10.10.10.0 0.0.0.255 10.10.20.0 0.0.0.255 eq 53
254 permit icmp 10.10.10.0 0.0.0.255 10.10.20.0 0.0.0.255 echo
255 deny ip any any log
256 exit
257
258! ACL: Guest to Internet only (deny all internal)
259ip access-list extended GUEST-OUTBOUND
260 deny ip 10.10.40.0 0.0.0.255 10.0.0.0 0.255.255.255
261 deny ip 10.10.40.0 0.0.0.255 172.16.0.0 0.15.255.255
262 deny ip 10.10.40.0 0.0.0.255 192.168.0.0 0.0.255.255
263 permit tcp 10.10.40.0 0.0.0.255 any eq 80
264 permit tcp 10.10.40.0 0.0.0.255 any eq 443
265 permit udp 10.10.40.0 0.0.0.255 any eq 53
266 deny ip any any log
267 exit
268
269! ACL: IoT limited access
270ip access-list extended IOT-OUTBOUND
271 permit tcp 10.10.50.0 0.0.0.255 host 10.10.20.10 eq 443
272 permit tcp 10.10.50.0 0.0.0.255 any eq 443
273 permit udp 10.10.50.0 0.0.0.255 host 10.10.20.1 eq 53
274 deny ip 10.10.50.0 0.0.0.255 10.10.50.0 0.0.0.255 log
275 deny ip any any log
276 exit
277
278! Apply ACLs to VLAN interfaces
279interface Vlan10
280 ip access-group CORP-TO-SERVERS out
281 exit
282interface Vlan40
283 ip access-group GUEST-OUTBOUND in
284 exit
285interface Vlan50
286 ip access-group IOT-OUTBOUND in
287 exit
288```
289
290### Step 5: Configure DHCP and DNS per VLAN
291
292```
293! DHCP pools for each VLAN
294ip dhcp pool CORPORATE
295 network 10.10.10.0 255.255.255.0
296 default-router 10.10.10.1
297 dns-server 10.10.20.10
298 domain-name corp.example.com
299 lease 1
300 exit
301
302ip dhcp pool GUEST
303 network 10.10.40.0 255.255.255.0
304 default-router 10.10.40.1
305 dns-server 1.1.1.1 8.8.8.8
306 lease 0 4
307 exit
308
309ip dhcp pool IOT
310 network 10.10.50.0 255.255.255.0
311 default-router 10.10.50.1
312 dns-server 10.10.20.10
313 lease 7
314 exit
315
316! Exclude gateway and server IPs from DHCP pools
317ip dhcp excluded-address 10.10.10.1 10.10.10.10
318ip dhcp excluded-address 10.10.40.1 10.10.40.10
319ip dhcp excluded-address 10.10.50.1 10.10.50.10
320```
321
322### Step 6: Verify and Test Segmentation
323
324```bash
325# From a workstation on VLAN 10 (Corporate):
326# Should succeed:
327ping 10.10.20.10 # Server access
328curl https://10.10.20.10 # HTTPS to server
329
330# Should fail:
331ping 10.10.40.100 # Guest VLAN - should be blocked
332ping 10.10.50.100 # IoT VLAN - should be blocked
333
334# From a device on VLAN 40 (Guest):
335# Should succeed:
336ping 8.8.8.8 # Internet access
337curl https://www.google.com
338
339# Should fail:
340ping 10.10.10.1 # Corporate gateway - blocked
341ping 10.10.20.10 # Server - blocked
342
343# Verify switch configuration
344show vlan brief
345show interfaces trunk
346show ip arp inspection statistics
347show ip dhcp snooping binding
348show port-security
349show ip access-lists
350
351# Run VLAN hopping tests (from authorized pentest)
352# These should all fail if hardening is correct:
353# 1. DTP negotiation - should fail (nonegotiate)
354# 2. Double tagging - should fail (native VLAN 998)
355# 3. ARP spoofing - should fail (DAI enabled)
356```
357
358## Key Concepts
359
360| Term | Definition |
361|------|------------|
362| **VLAN (Virtual LAN)** | Logical network partition at Layer 2 that groups switch ports into isolated broadcast domains, regardless of physical location |
363| **802.1Q Trunking** | IEEE standard for VLAN tagging that adds a 4-byte header to Ethernet frames, identifying which VLAN a frame belongs to across trunk links |
364| **Inter-VLAN Routing** | Layer 3 forwarding of traffic between VLANs using a router, Layer 3 switch, or firewall with access control lists |
365| **Native VLAN** | VLAN assigned to untagged frames on trunk ports; should be set to an unused VLAN to prevent VLAN hopping attacks |
366| **DHCP Snooping** | Switch feature that validates DHCP messages and builds a binding table of IP-MAC-port mappings, preventing rogue DHCP servers |
367| **Port Security** | Switch feature that limits the number of MAC addresses per port and takes action (shutdown, restrict) when violated |
368
369## Tools & Systems
370
371- **Cisco Catalyst/Nexus**: Enterprise managed switches with comprehensive VLAN, trunking, and security feature support
372- **HP Aruba CX**: Enterprise switches with REST API management and VLAN segmentation capabilities
373- **pfSense/OPNsense**: Open-source firewalls for inter-VLAN routing with stateful access control
374- **NetBox**: Open-source IPAM and DCIM tool for documenting VLAN assignments, IP addressing, and network topology
375- **Nmap**: Network scanner for verifying segmentation effectiveness by testing reachability across VLAN boundaries
376
377## Common Scenarios
378
379### Scenario: Implementing PCI-DSS Compliant Network Segmentation for Retail
380
381**Context**: A retail chain must isolate their payment card processing systems from the general corporate network to meet PCI-DSS requirements. The current flat network has point-of-sale terminals, employee workstations, inventory servers, and guest WiFi on a single VLAN. The environment uses Cisco Catalyst 9300 switches.
382
383**Approach**:
3841. Design VLAN architecture: POS terminals on VLAN 50 (CDE), corporate on VLAN 10, servers on VLAN 20, guest on VLAN 40
3852. Create VLANs on all access-layer switches and configure access ports by function
3863. Configure trunk links between switches with explicit VLAN allowed lists (no "all" trunks)
3874. Set native VLAN to 998 (unused) on all trunks and disable DTP on every port
3885. Configure ACLs on the Layer 3 switch: CDE VLAN can only reach the payment processor's IP on port 443; no other inter-VLAN traffic to/from CDE
3896. Enable DHCP snooping, DAI, and port security on all access ports
3907. Verify segmentation with penetration testing from each VLAN, confirming CDE is fully isolated
391
392**Pitfalls**:
393- Leaving DTP enabled on access ports, allowing VLAN hopping to reach the CDE
394- Using VLAN 1 as the native VLAN, enabling double-tagging attacks
395- Not restricting trunk allowed VLANs, carrying all VLANs including CDE to non-essential switches
396- Creating ACLs that allow "any" source to reach CDE servers instead of specific POS terminal IPs
397
398## Output Format
399
400```
401## Network Segmentation Implementation Report
402
403**Network**: Retail Store #42
404**Switch Platform**: Cisco Catalyst 9300
405**VLANs Configured**: 8
406
407### VLAN Summary
408
409| VLAN ID | Name | Subnet | Ports | Purpose |
410|---------|------|--------|-------|---------|
411| 10 | CORPORATE | 10.10.10.0/24 | Gi1/0/1-24 | Employee workstations |
412| 20 | SERVERS | 10.10.20.0/24 | Gi1/0/25-36 | Internal servers |
413| 30 | DMZ | 10.10.30.0/24 | Gi2/0/1-4 | Internet-facing |
414| 40 | GUEST | 10.10.40.0/24 | WiFi AP trunk | Guest WiFi |
415| 50 | CDE | 10.10.50.0/24 | Gi2/0/5-12 | POS terminals |
416| 100 | MGMT | 10.10.100.0/24 | Gi1/0/48 | Switch management |
417| 998 | NATIVE | N/A | Trunks only | Unused native |
418| 999 | QUARANTINE | 10.10.99.0/24 | Unused ports | Isolation |
419
420### Security Hardening Status
421
422| Control | Status |
423|---------|--------|
424| DTP Disabled (nonegotiate) | All ports |
425| Native VLAN (998) | All trunks |
426| DHCP Snooping | VLANs 10,20,40,50 |
427| Dynamic ARP Inspection | VLANs 10,20,40,50 |
428| Port Security | Access ports |
429| BPDU Guard | Access ports |
430| Unused Ports Shutdown | 10 ports in VLAN 999 |
431| VTP Transparent Mode | Enabled |
432```