Sub topic 12
NAT Limitations and Forwarding Versus Routing
Prerequisites
Assume you know IPv4 addresses, transport-layer ports, routers, and basic packet forwarding. You should also know that NAT maps one address and port combination to another.
NAT limitations and trade-offs
Network Address Translation (NAT) changes packet addresses as traffic crosses a router. It lets many private hosts share one public IPv4 address. Port Address Translation (PAT) also changes source ports, so the router can distinguish simultaneous connections.
NAT solves address exhaustion, but it changes the end-to-end model. Without NAT, a host can usually address another host directly. With NAT, an outside host sees the translator's public address, not the private host's address.
Common limitations include:
- An incoming connection cannot reach a private host unless the NAT device has a rule such as port forwarding.
- Some protocols carry IP addresses or port numbers inside their payloads. NAT must understand and rewrite those fields, or the protocol may fail.
- A translation table consumes memory and processing time. A large number of short-lived connections can exhaust available ports or table entries.
- NAT state can expire. A connection that remains idle may stop working when its mapping is removed.
- NAT complicates troubleshooting because logs may contain both the original private tuple and the translated public tuple. A tuple is the combination of source address, source port, destination address, and destination port.
- NAT is not a complete security boundary. It may block unsolicited traffic as a side effect of lacking a mapping, but a firewall is needed for explicit security policy.
- Applications that require direct peer-to-peer communication may need techniques such as hole punching, relays, or manual forwarding.
NAT preserves scarce IPv4 addresses and supports gradual network changes. Its costs are state, protocol complexity, and reduced transparency.
Forwarding versus routing
Routing and forwarding are related but different operations:
| Operation | Main question | Typical input |
|---|---|---|
| Routing | Which paths should the network use? | Topology, metrics, policies |
| Forwarding | Which interface should handle this packet now? | Destination address and forwarding table |
Routing is a control-plane activity. Routers exchange information using protocols such as RIP, OSPF, or BGP, then calculate routes. The result is installed in a forwarding table.
Forwarding is a data-plane activity. For each arriving packet, the router examines the destination address, applies longest-prefix match, decreases the IPv4 time-to-live value, and sends the packet through the selected interface. Forwarding must be fast because it happens for every packet.
A routing failure can leave a router with no usable entry. A forwarding failure can occur even when routes are correct, for example because an interface is down or the next-hop address cannot be resolved.
Exercise
A NAT router has one public address and 65,536 possible TCP port values. Why can it still support fewer than 65,536 simultaneous connections?
Show answer
Some ports are reserved or unavailable, and each connection also requires a distinct destination tuple and translation-table state. Resource limits can therefore be reached before the theoretical port count.