Subnets on sight
Hosts in a /26, the network address of 192.168.10.77/26, the mask of a /20, same subnet or not: IPv4 subnetting, exact, in your head.
How it plays
An IPv4 address is 32 bits; a /n prefix keeps the first n as the network and leaves 32 − n for hosts. A /26 has 6 host bits: 64 addresses, 62 usable once the network and broadcast addresses are taken out.
Levels go from hosts per prefix to the mask, the network address and broadcast address of a given interface, whether two addresses share a subnet, and the longest prefix that holds a number of hosts. The prefixes widen as you climb.
Every answer is computed exactly. Addresses come from the private ranges. /31 and /32 follow other rules and are never asked. The wrong options are the real slips: the −2 forgotten, the prefix rounded to a whole octet, the broadcast given for the network, the next block over.
Keys
Space starts and skips ahead · 1–9 pick · Enter submits · Esc stops. On a phone, tap.
What it trains
This makes IPv4 subnet arithmetic quicker and surer. It claims nothing wider.
Learn
How to get better at subnets on sight: the method, the techniques, what each new level asks of you, and the traps the wrong answers are made of.
Your approach to each question
- Find the octet the prefix cuts. /8, /16 and /24 end on a dot; anything else cuts the next octet. /26 cuts the fourth (24 + 2), /20 the third (16 + 4), /13 the second (8 + 5).
- Work out the block size in that octet: 2 to the power of the host bits left in it. /26 leaves 6 of the fourth octet’s 8 bits, so blocks go in steps of 64.
- Octets to the left of the cut are copied unchanged. Octets to the right are all 0 in the network address and all 255 in the broadcast. Only the cut octet needs arithmetic.
- Answer from there: round the cut octet down to a multiple of the block for the network, add block − 1 for the broadcast, and compare the rounded octets for “Same subnet?”.
Techniques and tricks
The eight mask values
A cut octet with 1 to 8 network bits is 128, 192, 224, 240, 248, 252, 254 or 255. Each adds the next half: 128 + 64 = 192, + 32 = 224, and so on. Learn the row and a mask is one lookup.
e.g. /20 = 255.255.240.0 (4 bits into the third octet); /13 = 255.248.0.0
Block size is 256 minus the mask
In the cut octet, the block size and the mask value always add to 256. A mask of 240 means steps of 16; 192 means steps of 64; 252 means steps of 4.
Round down to the block
For the network address, take the cut octet and round it down to the nearest multiple of the block size. Zero every octet after it.
e.g. 192.168.10.77/26: block 64; 77 → 64, so 192.168.10.64
Broadcast is the next block minus one
Add block − 1 to the network value in the cut octet, and set every octet after it to 255. It is the last address before the next block starts.
e.g. 10.5.77.9/20: block 16 in the third octet; 77 → 64; broadcast 64 + 15 = 79, so 10.5.79.255
Usable hosts: two to the host bits, minus two
A /n has 32 − n host bits and 2^(32 − n) addresses. Take out the network address and the broadcast, and the rest are usable.
e.g. /26: 2⁶ = 64 addresses, 62 usable; /20: 2¹² = 4,096, so 4,094
Same subnet: compare the rounded octets
Two addresses with the same prefix share a subnet when every octet before the cut matches and the cut octets round down to the same multiple of the block. The octets after the cut do not matter at all.
e.g. /23 (block 2 in the third octet): 172.20.8.x and 172.20.9.x share 172.20.8.0; 172.20.10.x does not
Fit: add two, then the next power of two
For h hosts you need h + 2 addresses. Find the first power of two at least that big; its exponent is the host bits, and the prefix is 32 minus that.
e.g. 62 hosts: 64 addresses, 6 bits, /26; 63 hosts: 65 addresses, 7 bits, /25
As the levels climb
- The kinds unlock in this order: hosts in a prefix; then the mask and the network address; then the broadcast address and “Same subnet?”; then the smallest prefix that fits. Four in ten questions come from the newest kind.
- The prefixes widen as you climb. Hosts start at /20 to /30, the address questions at /22 to /30, and masks at /16 to /30; each step reaches two bits shorter, four steps in all — down to /12, /14 and /8. Short prefixes cut the second or third octet, so the octets after the cut — 0 or 255 — become the easy part.
- The clock does not tighten here; it loosens. Each step of size adds 8% to the time, up to twelve steps. Spend it on the cut octet, and fill in the rest from the 0-or-255 rule.
Traps to avoid
- The −2 forgotten: 64 given for the hosts in a /26. That is the number of addresses; the network and broadcast take two, so 62 are usable. In the fit questions the same slip gives a prefix one too long.
- The prefix rounded to a whole octet: treating /26 like /24 and giving 192.168.10.0. Only /8, /16 and /24 end on a dot; any other prefix cuts an octet, and that octet needs rounding to its block.
- The broadcast given for the network, or the other way: the network has every host bit 0 (the bottom of the block), the broadcast every host bit 1 (the top). Read the question twice.
- The next block over: rounding up, or off by one block. The network address is never above the interface address — round the cut octet down, never to the nearest.
- The wildcard for the mask: 0.0.0.63 is the inverse of 255.255.255.192, not the mask. A mask always starts with 255s and runs down.
How to practise
- In “Kinds of question”, tick only “Prefix to mask” until the eight mask values come without counting bits — every other kind leans on them.
- Switch “Answer by” to “Typing the answer”. With options, the octets after the cut often give the answer away; typing the full dotted quad makes you do every octet.
- Raise “Options shown” towards 8 so the network, the broadcast, the next block and the octet-rounded slip all appear at once.
- Drill “Same subnet?” on its own in “Kinds of question”: it has only two answers, so speed comes from finding the cut octet and the block at once.
Levels
It is untimed unless you turn the clock on. There is no last level: at least one dial turns without end. Your level is judged on your last ten answers, every ten: 90% moves you up, below 80% moves you down, which holds most people near four in five right.
All of it is in the settings beside Start — how many answers a judgement looks at and how often it recalibrates, the thresholds, the time, which questions, how many options, and whether you see each verdict at once or review them together at the judgement. You can also jump to any level.
More computing
All games →Binary and hex
Binary to decimal, decimal to hex, hex to binary — convert between the bases a computer is written in, at a width that keeps growing.Bitwise
AND, OR, XOR, NOT, shifts, x AND (x − 1) and two's complement, worked bit by bit at a width that keeps growing.Powers of two
2ⁿ and back, GiB to MiB, and how many bits a number of values needs — the powers of two a programmer should have at hand.Big O by inspection
A few lines of loops or recursion: say how the work grows — O(n), O(n log n), O(n²), O(2ⁿ) — by reading the shape, not running it.Latency numbers
How many memory reads fit in a disk seek? Feel the gaps between cache, memory, disk and network, to the nearest power of ten.Data structures by hand
Push, pop, insert, probe: trace a stack, a queue, a search tree, a heap and a hash table by hand, and say what comes out or what the array holds.