IP, subnets and NAT: how the internet finds you

Every device needs an address so data knows where to go. Subnets bring order, and NAT lets your whole network reach the internet through a single public IP. All of it happens without you noticing.

Every time you open a page, your device and a server on the other side of the world exchange data that has to know where to go. That only works because every point on the network has an address. Behind that simple idea sit three pieces —the IP address, the subnet and NAT— that almost no one sees but that decide, quite literally, how the internet finds you.

What an IP address is

Let's start with the basics: no address, no delivery. An IP plays the same role for data that a postal address plays for a letter.

Key concept

An IP address is the unique identifier of a device within a network: it lets data know where to go and where it came from. Without it, a packet has no destination.

IPv4 is 32 bits: four numbers from 0 to 255 separated by dots, like 192.168.1.10. They ran out —the world has more devices than addresses— which is why IPv6 exists, at 128 bits, with vastly more available combinations.

There's a distinction worth fixing right away: not all IPs are equal. A public address is the one the internet sees —unique and routable across the entire global network—. A private address only makes sense inside your own local network and never travels outward. We'll come back to this, because it's where the single most common confusion is born.

Subnets: divide to organize

A large pool of addresses with no division would be chaos: all traffic mixed together, with no borders and no control. The subnet is the tool that brings order.

Key concept

A subnet groups a range of addresses that share the same network section. The mask —or its short form, CIDR notation like /24— defines how many addresses fit in that range and where the network ends and the host begins.

A /24, for example, reserves the first 24 bits for the network and leaves the rest for devices: around 254 usable addresses in that block.

Why bother segmenting? For three reasons that reinforce each other:

Private IPs and NAT

This is where the trick that holds up everyday internet fits in. Because IPv4 ran out, there are private ranges10.x, 172.16–31.x and 192.168.x— reserved for internal use and reused across millions of different networks at once. Your 192.168.1.10 and your neighbor's are the same address on two networks that never cross.

But if those addresses repeat everywhere, they can't travel across the internet as-is: they wouldn't be unique. That's where NAT comes in.

  1. Your device has a private IP assigned within your local network (for example, 192.168.1.10).
  2. As it goes out to the internet, the router applies NAT and replaces your private IP with the network's public IP —the only one the internet can see and route—.
  3. The router remembers that translation so that, when the response arrives, it returns it to the correct device inside your network.

The effect is direct: your entire home or office —dozens of devices— reaches the internet through a single shared public IP. The internet doesn't see your phone, your laptop and your TV separately; it sees one door, your router's, and NAT takes care of sorting out what comes in and goes out on the inside.

The default gateway

One piece is missing to close the circuit: how does a device decide whether the destination is inside its network or outside it? That's where the default gateway steps in.

Key concept

The default gateway is your network's way out. When a packet's destination is not in your subnet, your device doesn't know how to reach it directly, so it hands it to the gateway —usually the router—, which routes it outward.

The logic is simple: if the destination falls inside your subnet, traffic is delivered directly between neighboring devices. If it falls outside, it's sent to the gateway and it decides the next hop. It's the boundary between "I'll handle this myself" and "this leaves the network".

Common mistakes

Common mistake

"My IP is 192.168.1.5." That's your private IP, the one you have inside your local network. What the internet sees is your router's public IP, shared by every device in your home. Look it up with a simple "what is my IP" and you'll see it looks nothing alike.

The banking angle

In banking, addressing isn't an infrastructure detail: it's a security decision. How IPs are handed out and how subnets are drawn determines which system can even attempt to talk to which.

In banking, who can talk to whom is decided in the addressing, not afterward. The subnet, the static IP and the allow-list are the first border —the one drawn before the first packet arrives—, and that's why network design weighs as much as the code running on top of it.

Jorel del Portal

Jorel del Portal

Systems engineer specialized in enterprise software architecture and high-availability platforms in banking and finance.