What is NAT and what problems does it cause?
Network Address Translation rewrites IP addresses and often ports as packets cross between a private network and the public Internet. It exists mainly because IPv4 addresses are scarce.
A home router has one public address and gives private addresses such as 192.168.1.x to devices. When an inside host opens a connection, the router replaces the source address and port with its public address and a chosen port, and records the mapping. Replies matching that mapping are translated back.
10.0.0.5:52000 -> 203.0.113.7:40001 -> server
mapping table keeps the reverse path
Types include static NAT, dynamic NAT and PAT or masquerading, which multiplexes many hosts over one address. NAT conserves addresses and hides internal topology, but it breaks end-to-end connectivity, complicates peer-to-peer and burdens the device with state. It also motivates STUN, TURN and hole punching. IPv6 removes the need.