Learning path

Full curriculum

Full curriculum

Unit content

Network address and port translation

Network Address Translation (NAT) rewrites network-layer addresses as packets cross a translating device. A common IPv4 form also translates transport ports, allowing many private hosts to share one public address.

Suppose internal host 10.0.0.7:51000 connects to a server. The translator might create a mapping:

10.0.0.7:51000 ↔ 198.51.100.4:62001

Outbound packets are rewritten to use the public endpoint; returning packets matching that mapping are rewritten back to the private endpoint.

This stateful mapping differs from ordinary routing: the packet headers themselves change.

NAT conserves public IPv4 addresses and creates practical boundaries, but it also weakens the original end-to-end addressing model. Unsolicited inbound connections require an existing mapping or explicit forwarding rule, and protocols that embed addresses can need special handling.