Networking interview question · Most asked
Security groups versus network ACLs: how do they differ and how would you use them together?
Summary
Security groups attach to network interfaces, are stateful, allow-only and can reference other security groups. Network ACLs attach to subnets, are stateless, evaluated in rule-number order and support deny. Use security groups for application-level least privilege; keep NACLs simple (allow-all plus a few deny rules as guardrails).
Longer Answer
Restrictive NACLs must allow return traffic on ephemeral ports in both directions, and are easy to get wrong. Security group references (app-sg -> db-sg) keep working as instances scale and are tighter than CIDR rules.
Key Points
- SG: stateful, ENI-level, allow-only.
- NACL: stateless, subnet-level, ordered, allow/deny.
- SG references for tiers.
- NACLs as coarse guardrails.
Deep dive: Networking Tutorial: Security Groups and Network ACLs
Explanation
What interviewers look for
Clear differences and a sensible operating model.
More most-asked Networking questions
- How does NAT work, and what are its limits?
- What's the difference between TCP and UDP, and when would you choose UDP?
- What do 502, 503 and 504 errors from a load balancer usually mean?
- What is CIDR notation? How many usable addresses are in a /26, and in an AWS /26 subnet?
- How does DNS resolution work, and what does a record's TTL control?
- What does TLS provide, and how does certificate validation work?
- What happens, at the network level, when you type a URL into a browser and press Enter?
- What's the difference between stateful and stateless firewalls? Give cloud examples.