NACL Rule Ordering and Evaluation
What You'll Learn
You'll learn how Network ACLs process rules sequentially and stop at the first match, making rule order critical to your network security.
How NACLs Evaluate Traffic
Unlike Security Groups (which you learned earlier evaluate all rules), Network ACLs work through their rules in strict numerical order, starting from the lowest rule number and moving up. Think of it like a bouncer checking a checklist from top to bottom—the moment they find a match, they stop looking and make their decision.
Each rule has a number (typically in increments like 100, 200, 300), and the NACL evaluates them in ascending order. The first rule that matches the traffic wins, and no further rules are checked.
The Critical Role of Explicit Denies
Here's where it gets important: if rule #100 explicitly denies traffic from a certain IP range, that traffic is blocked immediately—even if rule #200 would have allowed it. The evaluation stops at the first match.
Example Scenario
Imagine these NACL rules for inbound traffic:
- Rule 100: DENY all traffic from 203.0.113.0/24
- Rule 200: ALLOW all HTTP traffic (port 80)
A request from 203.0.113.50 on port 80 hits rule 100 first and gets denied. The NACL never reaches rule 200. Order matters!
Every NACL also has a final catch-all rule (usually rule * or 32767) that denies everything not explicitly allowed earlier.
Planning Your Rule Numbers
Leave gaps between rule numbers (100, 200, 300) so you can insert new rules later without renumbering everything.
Key Takeaway: NACLs evaluate rules in numerical order and stop at the first match—place deny rules carefully before allow rules, and always number with gaps for future flexibility.