Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Stateless behavior of NACLs
📖 Scenario: You are managing network security in AWS. You want to understand how Network Access Control Lists (NACLs) work, especially their stateless nature. NACLs control traffic in and out of subnets, but unlike security groups, they do not remember previous traffic. This means you must explicitly allow both inbound and outbound traffic rules.
🎯 Goal: Create an AWS NACL configuration that allows inbound HTTP traffic on port 80 and outbound HTTP response traffic on ephemeral ports, demonstrating the stateless behavior of NACLs.
📋 What You'll Learn
Create a Network ACL with a specific ID
Add an inbound rule allowing TCP traffic on port 80 from any IPv4 address
Add an outbound rule allowing TCP traffic on ephemeral ports (1024-65535) to any IPv4 address
Use explicit rule numbers and protocol numbers
Demonstrate stateless behavior by having separate inbound and outbound rules
💡 Why This Matters
🌍 Real World
Network Access Control Lists (NACLs) are used in AWS to control traffic at the subnet level. Understanding their stateless nature helps in designing secure and functional network architectures.
💼 Career
Cloud engineers and network administrators must configure NACLs correctly to ensure security and proper traffic flow in AWS environments.
Progress0 / 4 steps
1
Create the initial NACL data structure
Create a variable called nacl as a dictionary with the key NetworkAclId set to 'acl-12345678' and an empty list for Entries.
AWS
Hint
Think of nacl as a container holding the NACL ID and its rules.
2
Add inbound HTTP allow rule configuration
Add a dictionary to nacl["Entries"] representing an inbound rule with RuleNumber 100, Protocol 6 (TCP), RuleAction 'allow', Egress False, CidrBlock '0.0.0.0/0', and PortRange from 80 to 80.
AWS
Hint
Inbound rules have Egress set to False. Port 80 is for HTTP.
3
Add outbound ephemeral port allow rule configuration
Append a dictionary to nacl["Entries"] representing an outbound rule with RuleNumber 100, Protocol 6 (TCP), RuleAction 'allow', Egress True, CidrBlock '0.0.0.0/0', and PortRange from 1024 to 65535.
AWS
Hint
Outbound rules have Egress set to True. Ephemeral ports range from 1024 to 65535.
4
Complete the NACL configuration with a deny all rule
Append two deny rules to nacl["Entries"]: one inbound with RuleNumber 200, Protocol -1 (all), RuleAction 'deny', Egress False, CidrBlock '0.0.0.0/0'; and one outbound with RuleNumber 200, Protocol -1, RuleAction 'deny', Egress True, CidrBlock '0.0.0.0/0'.
AWS
Hint
Deny all rules catch any traffic not explicitly allowed. Use Protocol -1 for all protocols.
Practice
(1/5)
1. What does it mean that Network ACLs (NACLs) are stateless in AWS?
easy
A. NACLs remember the state of connections to allow return traffic automatically
B. Each packet is checked independently without remembering previous packets
C. NACLs only filter traffic based on IP addresses, not ports
D. NACLs automatically block all inbound traffic by default
Solution
Step 1: Understand the meaning of stateless
Stateless means the system does not keep track of previous packets or connection states.
Step 2: Apply this to NACLs
NACLs evaluate each packet on its own, without remembering if it is part of an existing connection.
Final Answer:
Each packet is checked independently without remembering previous packets -> Option B
Quick Check:
Stateless means no memory of past packets = A [OK]
Hint: Stateless means no memory of past packets, check each separately [OK]
Common Mistakes:
Thinking NACLs remember connection states like security groups
Assuming NACLs allow return traffic automatically
Confusing stateless with blocking all traffic by default
2. Which of the following is the correct way to allow inbound HTTP traffic on port 80 using a NACL rule?
easy
A. Allow inbound traffic on port 80 with rule number 100, protocol TCP, action ALLOW
B. Allow inbound traffic on port 22 with rule number 100, protocol TCP, action ALLOW
C. Allow outbound traffic on port 80 with rule number 100, protocol TCP, action DENY
D. Allow inbound traffic on port 443 with rule number 100, protocol UDP, action ALLOW
Solution
Step 1: Identify the correct port and protocol for HTTP
HTTP uses TCP protocol on port 80.
Step 2: Confirm the rule direction and action
To allow inbound HTTP traffic, the rule must be inbound with action ALLOW.
Final Answer:
Allow inbound traffic on port 80 with rule number 100, protocol TCP, action ALLOW -> Option A
Quick Check:
Inbound TCP port 80 ALLOW = D [OK]
Hint: HTTP uses TCP port 80 inbound ALLOW rule [OK]
Common Mistakes:
Using wrong port number or protocol
Setting rule direction incorrectly
Using DENY action instead of ALLOW
3. Consider a NACL with the following rules: Inbound Rule 100: ALLOW TCP port 80 Outbound Rule 100: DENY all traffic What will happen when an instance in the subnet tries to send a response to an HTTP request?
medium
A. The response will be allowed because inbound is allowed
B. The response will be allowed because NACLs are stateful
C. The response will be blocked because outbound is denied
D. The response will be blocked because inbound denies it
Solution
Step 1: Analyze inbound rule
Inbound HTTP traffic on port 80 is allowed, so requests can reach the instance.
Step 2: Analyze outbound rule
Outbound rule denies all traffic, so responses from the instance are blocked.
Final Answer:
The response will be blocked because outbound is denied -> Option C
Quick Check:
Outbound DENY blocks response despite inbound ALLOW = B [OK]
Hint: Both inbound and outbound must allow traffic for two-way flow [OK]
Common Mistakes:
Assuming NACLs are stateful and allow return traffic automatically
Ignoring outbound rules when troubleshooting
Confusing inbound and outbound directions
4. You configured a NACL to allow inbound SSH (port 22) and outbound HTTP (port 80) traffic. However, SSH connections fail. What is the most likely cause?
medium
A. Outbound SSH traffic is not allowed in the NACL
B. Inbound HTTP traffic is not allowed in the NACL
C. NACLs are stateful and do not require outbound rules
D. Security groups block SSH traffic
Solution
Step 1: Review NACL rules for SSH
Inbound SSH (port 22) is allowed, but outbound SSH must also be allowed for return traffic.
Step 2: Understand stateless nature of NACLs
NACLs do not remember connection state, so both inbound and outbound rules must permit traffic.
Final Answer:
Outbound SSH traffic is not allowed in the NACL -> Option A
Quick Check:
Both directions must allow SSH for connection success = C [OK]
Hint: Allow both inbound and outbound for SSH due to stateless NACLs [OK]
Common Mistakes:
Assuming NACLs are stateful and outbound rules are unnecessary
Blaming security groups without checking NACLs
Ignoring outbound rules for return traffic
5. You want to allow a subnet to communicate with the internet using HTTP and HTTPS. Which NACL configuration correctly supports this stateless behavior?
hard
A. Allow all inbound and outbound traffic to simplify rules
B. Allow inbound TCP ports 80 and 443, allow outbound ephemeral ports 1024-65535
C. Allow inbound and outbound TCP ports 80 and 443 only
D. Allow inbound ephemeral ports 1024-65535, allow outbound TCP ports 80 and 443
Solution
Step 1: Understand HTTP/HTTPS traffic flow
Clients initiate outbound connections to ports 80 and 443; responses come back on ephemeral ports (1024-65535).
Step 2: Configure NACL rules for stateless behavior
Outbound rules must allow TCP ports 80 and 443; inbound rules must allow ephemeral ports for return traffic.
Final Answer:
Allow inbound ephemeral ports 1024-65535, allow outbound TCP ports 80 and 443 -> Option D
Quick Check:
Outbound to 80/443, inbound ephemeral ports for response = A [OK]
Hint: Allow outbound ports 80/443 and inbound ephemeral ports for return [OK]
Common Mistakes:
Allowing inbound ports 80/443 instead of ephemeral ports
Not allowing ephemeral ports inbound blocks responses