A home or office can contain many devices with private addresses while presenting one public IPv4 address to the internet. NAT and ports make this work, but they solve different parts of the problem.
Public and Private Addressing
Private IPv4 ranges are used inside networks and are not routed across the public internet. Common examples begin with 10., 172.16 through 172.31, or 192.168. A laptop might be 192.168.1.20 inside a home while the router has a public-facing address supplied by the ISP.
A small local network
Laptop 192.168.1.20Phone 192.168.1.21Camera 192.168.1.22Gateway 192.168.1.1Public side 49.36.100.20How NAT Tracks Outbound Traffic
For a typical outbound IPv4 connection, the router replaces the private source address and port with its public address and another port. It stores translation state so returning packets can be mapped to the correct internal flow.
192.168.1.20:53124 -> NAT -> 49.36.100.20:62001 -> Internet -> Server:443
A second device can contact the same server through that public address because its translated source port differs. NAT maintains state associating each external flow with an internal endpoint.
What a Port Identifies
An IP address gets traffic to an endpoint. A port lets the operating system deliver transport traffic to the correct listening service. One server can expose HTTPS on TCP 443, SSH on TCP 22, and DNS on UDP or TCP 53.
How Network Ports Select Services
- 80 / 443
- Conventional HTTP and HTTPS ports.
- 22
- Common SSH administration port.
- 53
- DNS over UDP or TCP.
- 5432
- Common PostgreSQL port; normally kept private.
- 6379
- Common Redis port; normally kept inside a trusted network.
Source and Destination Ports
A browser normally chooses a temporary source port while connecting to a known destination port. A flow might run from 192.168.1.20:53124 to 93.184.216.34:443. Replies reverse those endpoints, letting operating systems and stateful devices associate packets with the correct conversation.
Opening a firewall port does not create a service. A process must be listening, a route must exist, and every policy along the path must allow the traffic. Unexpected inbound traffic behind NAT may also require port forwarding, a tunnel, or a public intermediary.
Useful shorthand
The IP identifies the endpoint, the port identifies the transport service, and NAT rewrites and tracks endpoint information across address boundaries.
Series
How Internet Requests Actually WorkAn eight-part beginner series tracing internet communication from an HTTP request through DNS, IP, ports, transport protocols, packets, network devices, server infrastructure, security, and troubleshooting.
HTTP Requests: Methods, URLs, Headers, and Bodies
Start at the application layer and understand what a browser or API client is actually asking for.
DNS, Domain Names, and IP Addresses
Follow the lookup that turns a human-friendly hostname into a network destination.
Public IP, Private IP, NAT, and Ports
See how local devices reach the internet and how operating systems identify each service and flow.
TCP vs UDP
Compare reliable byte streams with simpler datagrams and understand where each transport fits.
Packets, Network Layers, Switches, and Routers
Learn how data is encapsulated and moved across local links and routed networks.
The Complete Website Request Journey
Put the layers together from the browser to production infrastructure and back again.
HTTPS, TLS, and HTTP Status Codes
Understand secure transport, certificate checks, and the response codes used during debugging.
Troubleshooting, Localhost, Cloud, and Containers
Apply the model with diagnostic tools and carry it into cloud and container environments.
Nikhlesh Yadav is a Technical Lead and Solution Architect with 12+ years of experience across cloud-native systems, distributed platforms, AI integrations, Web3, and cyber security.
Read full profile