Course contentsShow
← Security
Lesson 1824 of 3,05237. Cloud Security - Network ArchitectureFree lesson

Ephemeral Ports and Stateless Filtering Challenges

Understanding ephemeral port ranges, why NACLs require return traffic rules, and common misconfigurations with client responses.

Ephemeral Ports and Stateless Filtering Challenges

What you'll learn: Why Network ACLs require careful configuration for return traffic, and how ephemeral ports complicate stateless filtering.

The Ephemeral Port Problem

When a client initiates a connection to a server (say, your browser connecting to a web server on port 443), the server doesn't respond back to port 443 on your machine. Instead, your operating system assigns a random ephemeral port (typically in the range 1024-65535) for the return traffic. The server sends responses back to that temporary port.

This creates a challenge for stateless filters like Network ACLs, which don't remember connection state. Unlike Security Groups that automatically allow return traffic for established connections, NACLs require explicit rules in both directions.

The NACL Configuration Challenge

Imagine you have a web server in a subnet protected by a NACL. You allow inbound traffic on port 443. But that's only half the story:

  • Inbound rule: Allow port 443 from the internet ✓
  • Outbound rule: Must allow ports 1024-65535 back to clients ✗ (often forgotten!)

If you forget the outbound ephemeral port rule, clients can reach your server, but never receive responses—connections timeout mysteriously.

Common Misconfigurations

Most frequent mistake: Allowing only specific outbound ports (80, 443) and forgetting the ephemeral range for client responses. The symptom? One-way communication failures that are difficult to diagnose.

Operating system differences: Linux uses 32768-60999 by default, while Windows uses 1025-5000. If your infrastructure is mixed, you may need the full 1024-65535 range open for reliable communication.

Key Takeaway: Network ACLs are stateless and require explicit rules for both request AND response traffic—including the full ephemeral port range (1024-65535) for return packets, making them more complex and error-prone than stateful Security Groups.