NAT (Network Address Translation)
Why NAT exists
- Conserves IPv4 addresses by letting many private hosts share one public IP.
- Hides internal addressing; simplifies private network design (but adds complexity).
Types: SNAT, DNAT, PAT
- SNAT: source NAT; rewrite source IP for outbound traffic (private → public).
- DNAT: destination NAT; rewrite destination for inbound traffic (public → private host).
- PAT (port address translation): many internal connections share one public IP using different ports (“NAT overload”).
NAT in home vs cloud networks
- Home routers commonly do PAT for all devices behind them.
- In cloud, NAT often sits at subnet edge (NAT Gateway/instance) to enable private subnets to reach the Internet.
NAT gateways in AWS-style architectures
- Place NAT in a public subnet; private subnets route 0.0.0.0/0 to NAT.
- NAT needs an Internet route via Internet Gateway for outbound access.
- Watch scaling, cost, and per-AZ design (one NAT per AZ for resilience).