IP addressing — study guide

The concept's fragments, read in order.

The number that finds a machine

Every machine on a network needs a number that says where it is, or nothing could be delivered to it. That number is its IP address (Internet Protocol address): the network-layer identifier that gets a packet across the world to the right machine and no other. It is the thing the network reads to decide where a piece of data goes.

An IP address is not one flat number but a structured one, narrowing from the general to the specific like a postal address that narrows from the general to the specific, one part naming the neighborhood and another naming the single house on it. Part of it names a network, and the rest names one machine on that network — so the same address answers two questions at once, which network and which host.

There are two families of these addresses in use. IPv4 (version four) is the older and still the more common; IPv6 (version six) is the newer and far larger. They are separate numbering schemes that do the same job, and a single machine commonly carries an address from each family at the same time.

Thirty-two bits in four parts

an IPv4 address: 32 bits grouped into four 8-bit octets 1 1 0 0 0 0 0 0 . 1 0 1 0 1 0 0 0 . 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 1 192 168 0 1 one octet = 8 bits each octet becomes one decimal, 0 to 255 dotted decimal reads 192.168.0.1
One IPv4 address is 32 bits split into four 8-bit octets; each octet's bits form a decimal from 0 to 255, and the four decimals written with dots read 192.168.0.1.

An IPv4 address is 32 bits long, and those bits are split into four groups of eight called octets. You almost never see the bits directly. You see the address written in dotted decimal: each octet turned into an ordinary base-ten number, the four numbers joined by dots, like 192.168.0.1.

Because an octet is eight bits, the number it holds runs from 0 to 255 and no further — those are the smallest and largest values eight bits can spell. An octet of 255 is every bit set; an octet of 0 is every bit clear. So every IPv4 address you meet is four numbers, each somewhere in that range, and anything outside it is not a valid address.

Reading one is then just reading four small numbers in a row. But the split into octets is not cosmetic: the line between the part of an address that names a network and the part that names a machine falls on the bits underneath those dots.

Reading the bits behind the dots

eight bits, each column worth double the one to its right 128 64 32 16 8 4 2 1 1 0 1 0 1 0 0 0 128 + 32 + 8 = 168 add the columns holding a 1; the columns holding a 0 add nothing
One 8-bit octet: the columns are worth 128, 64, 32, 16, 8, 4, 2, 1; the bits set to 1 here are 128, 32, and 8, which sum to the decimal value 168.

A bit is a single digit that is either 1 or 0, on or off. An octet is a row of eight of them, and each position in the row is worth a fixed amount — double the position to its right like a row of on/off switches where each switch is worth double the one to its right, and the value is the total of the switches left on. Reading the eight positions from left to right, those amounts are 128, 64, 32, 16, 8, 4, 2, and 1. A position holding a 1 contributes its amount; a position holding a 0 contributes nothing.

To read an octet, add up the amounts of the positions that hold a 1. Set only the last two and you have 2 plus 1, which is 3. Set every one of the eight and you add 128, 64, 32, 16, 8, 4, 2, and 1, which comes to 255 — the largest value an octet can hold, and the reason the dotted-decimal numbers stop there. That is the whole of the bit arithmetic you need to read an address by hand: eight positions, fixed doubling amounts, summed wherever the bit is on.

Splitting an address into network and host

An IP address carries two things at once: which network a machine is on, and which machine it is on that network. A subnet mask is what draws the line between the two. The classic mask 255.255.255.0 says the first three octets of an address name the network, and the last octet names the host.

The mask does this bit by bit. Written out in bits, a mask is a run of 1s followed by a run of 0s: wherever the mask has a 1, that bit of the address belongs to the network part; wherever it has a 0, that bit belongs to the host part. 255.255.255.0 is twenty-four 1s and then eight 0s — every bit of the first three octets on, every bit of the last one off. Every machine sharing a network agrees on the network bits and differs in the host bits.

That shared network part is what lets a machine tell local from distant. Two addresses with the same network bits sit on the same link and can talk directly; an address whose network bits differ is somewhere else, and reaching it is a job for something beyond the local network.

Counting the network bits with a slash

a /24 splits the 32 bits: 24 for the network, 8 for the host network: 24 bits host: 8 bits 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 /24 boundary 255 . 255 . 255 . 0 subnet mask 255.255.255.0 the mask's 1-bits mark the network, its 0-bits mark the host
A 32-bit address split at the /24 boundary: the first 24 bits are the network portion and the last 8 are the host portion, matching the subnet mask 255.255.255.0.

Writing a full mask like 255.255.255.0 next to every address gets tiring, so there is a shorthand: count the network bits and put the count after a slash. 192.168.0.0/24 means the first 24 bits are the network part, which is exactly what 255.255.255.0 says — the two notations are the same fact written two ways.

The prefix does more than name the split; it fixes how many addresses the subnet holds. A /24 leaves eight bits for the host part, which is 256 possible combinations, so a /24 is 256 addresses in total. Two of those are spoken for — one names the network itself and one is the broadcast address — leaving 254 usable for actual machines. Make the prefix longer and the subnet shrinks: a /30 keeps only two host bits, for 4 total addresses and just 2 usable, which is why the short links between two routers often use one.

The rule is simple once you see it: every bit you add to the prefix halves the host space, and every bit you take away doubles it. Read /24 and you already know the shape of the network — a couple hundred machines on one link — before you have looked at a single one of them.

Addresses the internet routes, and addresses it does not

Not every IP address is meant to be reachable from the open internet. Three ranges are set aside as private, to be used freely inside a home or office network and never routed across the public internet: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. If a device's address starts with 10. or 192.168., or falls in the 172.16 through 172.31 band, it is holding a private address.

These ranges are reusable precisely because they are private. The same 192.168.0.10 exists on countless home networks at once with no conflict, because each one is meaningful only inside its own network like apartment numbers that repeat in every building, meaningful only inside, while the building's street address is the single public one. Out on the public internet an address must be globally unique — no two machines may share one — and that is the whole difference between the two kinds of space.

What bridges them is a single public address that a whole private network hides behind, translated on the way out and back by a technique called NAT. The consequence for reading an address is immediate: a 192.168-something number is a machine's place on some local network, not its identity to the wider internet.

When 32 bits ran out

Thirty-two bits sounds like plenty of addresses until you count the machines. IPv4's 32-bit space, for all its size, ran short as the number of connected devices climbed past what it could ever number. IPv6 is the answer to that shortage, and it answers with room to spare.

An IPv6 address is 128 bits — four times the length of an IPv4 address. Because each added bit doubles the space, four times the length is an almost unimaginably larger pool of addresses, not merely four times as many. It is written differently to stay readable: eight groups of four hexadecimal digits, the groups separated by colons, rather than four decimal octets.

The practical effect is that the address scarcity which forces private ranges and address-sharing under IPv4 largely disappears under IPv6 — there is room to give every device its own unique address many times over. The two families run side by side today, and a machine commonly carries an address in each.

Reading your own address

The moment this stops being abstract is the first time you assign an address by hand. Set up a server on a home network — a homelab box, a game server, any machine you want to reach at the same address every time — and you will type an IPv4 address and a prefix yourself, and it has to fall inside the network your router already runs.

That is also where the notation earns its keep. A device sitting at 192.168.1.50 is telling you it is on a private network, inside the 192.168.0.0/16 range, behind a router. A /24 on the end tells you the network holds a couple hundred addresses and that everything sharing the first three octets is a neighbor it can reach directly. None of that needs a lookup once the notation reads as plainly as a street address.

Reading an address well is what turns a wall of numbers into information: which machines are local, which range is private, whether two devices can even see each other. It is the difference between copying a configuration on faith and knowing what it says.