4.3.9 · D1Computer Networks

Foundations — Subnetting — subnet mask, network - host bits, VLSM

2,934 words13 min readBack to topic

This page assumes nothing. Before you touch subnetting, you must be able to look at any symbol in the parent note and know exactly what picture it stands for. We build them one at a time, each earning the next. Parent topic: Subnetting — Subnet Mask, Network/Host Bits, VLSM.


1. The bit — the atom of everything

Picture one light switch. It is either off (we write ) or on (we write ). That is the whole story of a bit. Every other symbol on this page is just many of these switches lined up in a row.

WHY the topic needs it: an IP address and a subnet mask are both just long rows of these switches. If you can't see the switches, the mask is meaningless.

Figure — Subnetting — subnet mask, network - host bits, VLSM
Figure s01 — two switches side by side: the left one OFF (labelled , grey), the right one ON (labelled , blue), with an orange "flip" arrow between them. It shows the bit's only two states and that the sole operation is flipping between them.


2. Place value — why a row of bits becomes a number

This is exactly how ordinary decimal works — in the is worth because it sits in the "hundreds" column. Binary is the same trick, but every column is worth twice the one to its right instead of ten times.

Figure — Subnetting — subnet mask, network - host bits, VLSM
Figure s02 — a row of 8 cells, each labelled above with its worth (); the first two cells are green (ON = ), the rest grey (OFF = ). Only the two green worths are added below to give , showing how the byte 11000000 becomes the decimal .

WHY the topic needs it: the parent note constantly jumps between 192 and 11000000, or between /26 and 255.255.255.192. That jump is place value. No place value, no mask reading.


3. The exponent — counting how many patterns fit

Why is it exactly ? Each of the switches independently chooses or . With switch: patterns. Add a switch and every existing pattern splits into two (new switch off / new switch on) — so patterns double each time you add a switch.

switches patterns

WHY the topic needs it: every subnetting count — hosts per subnet, number of subnets, block size — is secretly "how many patterns do these bits make?" That is and nothing else.


4. The octet and dotted-decimal — chunking 32 into 4×8

A 32-bit address is a lot of switches to stare at. So we chop the 32 switches into four groups of eight and write each group as a plain number with dots between:

The dots are pure human comfort — the machine sees one unbroken row of 32 bits.

WHY the topic needs it: the parent's "interesting octet" and "block size in the last octet" only make sense once you see that dotted-decimal is just 32 bits wearing a costume.


5. Block size — how far apart subnet boundaries sit

Picture the host addresses as a run of consecutive numbers. The first subnet starts at , and because every host pattern belongs to it, the next subnet cannot start until all patterns are used up. So consecutive subnet boundaries are spaced exactly apart — that spacing is the block size.

WHY the topic needs it: the parent's whole "find the subnet" drill (boundaries ; which block holds ) is block-size arithmetic. Without a definition of block size, those steps are magic numbers.


6. The 32-bit IP address — two answers hidden in one number

Think of a full postal address: Maple Street, House 12. One line, two answers. The network part is the street name (shared by neighbours); the host part is the house number (unique on that street). The genius — and the confusion — of IPv4 is that both are welded into one 32-bit number.

Figure — Subnetting — subnet mask, network - host bits, VLSM
Figure s03 — one row of 32 small cells (the address), coloured blue for the first 26 (network part, "which street") and orange for the last 6 (host part, "which house"), with double-headed brackets and labels and under each region. It shows the single number carrying two answers and where the mask's line divides them.

WHY the topic needs it: subnetting is literally the act of choosing where the street name ends and the house number begins. You cannot move a line you cannot see.


7. The subnet mask and the prefix /n — the movable line

The mask carries no address information — it only marks where the line sits. /26 means "the first 26 switches are the network, the last 6 are the host." Written out:

WHY the topic needs it: every formula — , hosts , block size — starts by reading off the mask. This is the central symbol of the whole topic.


8. Bitwise AND — the machine's line-reader

The truth table has just four rows:

A B A AND B
0 0 0
0 1 0
1 0 0
1 1 1

Now notice the magic: a mask bit of copies the address bit through (), and a mask bit of erases it to (). So

keeps every network bit and wipes every host bit to zero — giving the "all-0 host" pattern that names the subnet. See Network and Broadcast Addresses.

Figure — Subnetting — subnet mask, network - host bits, VLSM
Figure s04 — three stacked 8-cell rows for the last octet: the IP , the mask , and the AND result (its surviving highlighted green). It shows column-by-column that a survives only where both rows are , producing the subnet octet .

WHY the topic needs it: AND is how a real router turns an address + mask into a network. Every "find the subnet" drill is one AND.


9. The two reserved patterns — where the comes from

Out of the host patterns, these two are booked. That is the entire reason usable hosts is , never .

WHY the topic needs it: the single most common exam mistake is forgetting the . It comes from these two patterns and nowhere else.


10. The two exceptions — /31 and /32 break the rule

The formula is almost universal, but there are exactly two masks where it would give a silly or negative answer. You must know both, because the parent's smallest allocation (/30, hosts) sits right next to them.

WHY the topic needs it: Routing Tables and Longest Prefix Match and Default Gateway and ARP lean on /32 host routes and /31 links constantly. Applying blindly there gives or and confuses beginners.


11. VLSM — one word, one idea

Everything above was a fixed line. VLSM just says: you're allowed to put the line in a different spot for each subnet. A 2-host router link gets a /30, a single loopback gets a /32, a 100-host LAN gets a /25. Same block, different lines. That's it — the depth is in the parent note; here you only need the vocabulary. Related: CIDR and Supernetting.


How these foundations feed the topic

Read the map below bottom-up as a dependency chain: the bit is the atom; stacking bits with place value turns a row into a number; powers of two count the patterns those bits make; a byte-sized chunk is the octet, and four octets make the 32-bit IP. The mask//n draws the network–host line on that address; bitwise AND applies the line to extract the network + broadcast pair; those two reserved patterns plus powers of two give the host-count formula and the block size; and finally VLSM picks a different line per subnet. Every arrow means "you must understand the lower box before the higher one makes sense," and all roads lead to subnetting mastery.

Bit 0 or 1

Place value 128 64 32 ...

Octet 0 to 255

Powers 2 to the k

32 bit IP address

Subnet mask and slash n

Bitwise AND

Network and Broadcast

Host count formula

Block size 2 to the h

VLSM sizing

Subnetting mastery


Equipment checklist

Test yourself — reveal only after you've answered aloud.

What is a bit, and how many values can it hold?
A single switch holding exactly one of two values, or .
In the byte 11000000, what decimal value do the ON switches add to?
.
What question does answer?
How many distinct ON/OFF patterns switches can make.
Why does one octet run to ?
bits make patterns, numbered through .
What is , and how do you get it from the prefix?
is the number of host bits; .
What is block size and its formula?
The total addresses a subnet spans; (also in the last octet).
What are the two "answers" hidden inside one 32-bit IP address?
Which network (street) and which host (house).
What does the prefix /n tell you about the mask?
The leftmost bits are network (1s), the remaining are host (0s).
Why must the mask's 1-bits be contiguous on the left?
So a bitwise AND cleanly keeps the network bits and erases the host bits.
What is the result of x AND 1 and x AND 0?
(copy through); (erase).
Which two host-bit patterns are reserved, and what do they name?
All-0 → network address; all-1 → broadcast address.
Why is usable hosts and not ?
Two of the patterns (network + broadcast) can't be assigned to machines.
How many usable hosts does a /31 give, and why is it special?
— a point-to-point link (RFC 3021) keeps both addresses, reserving neither.
What does a /32 represent?
A single-address host route (e.g. a loopback), with address and no host range.
In one plain sentence, what is VLSM?
Using different prefix lengths per subnet so each is sized to its real need.