Course contentsShow
← Cloud and Infrastructure
Lesson 208 of 2,9894. Cloud Networking BasicsFree lesson

NACL Allow and Deny Rules

Learn to configure both allow and deny rules in NACLs to implement defense-in-depth network security.

NACL Allow and Deny Rules

You'll learn: How to configure both allow and deny rules in Network ACLs to create layered network security with explicit blocking capabilities.

The Power of Allow and Deny

Unlike Security Groups (which only allow traffic), Network ACLs give you the ability to explicitly deny traffic. This means you can say both "let this through" and "block that," making NACLs perfect for implementing defense-in-depth security.

Think of it like a sophisticated bouncer with two lists: a VIP list (allow rules) and a banned list (deny rules). The bouncer checks both lists in order to make the final decision.

How Allow and Deny Work Together

When configuring NACL rules, you specify:

  • Rule number (determines evaluation order)
  • Type (allow or deny)
  • Protocol (TCP, UDP, ICMP, etc.)
  • Port range
  • Source/Destination (IP address or CIDR block)

Common pattern: Create specific deny rules for known bad actors, then broader allow rules for legitimate traffic.

Example scenario:

  • Rule 50: Deny TCP port 22 from 198.51.100.0/24 (block SSH from suspicious IP range)
  • Rule 100: Allow TCP port 22 from 0.0.0.0/0 (allow SSH from everyone else)
  • Rule 200: Allow TCP port 443 from 0.0.0.0/0 (allow HTTPS)

Because rule 50 is evaluated before rule 100, that specific range is blocked even though rule 100 would otherwise allow it.

Defense-in-Depth Strategy

NACLs with deny rules provide network-level protection before traffic reaches Security Groups. Block entire countries, known malicious IPs, or unwanted protocols at the subnet boundary, reducing load on your instances.

Key Takeaway: Network ACL deny rules enable explicit traffic blocking at the subnet level, creating a critical first line of defense that complements Security Group allow-only rules for comprehensive network security.