Turning Point Academy · Network Essentials

Binary Practice Workbook


Companion to Binary: The Language of Addresses (Module 4). Work with pencil and paper — no calculator. Fluency here is what makes every subnetting problem in this module fast instead of painful.

The method: 128 · 64 · 32 · 16 · 8 · 4 · 2 · 1

An IPv4 address is 32 bits shown as four octets (groups of 8 bits), each written as a decimal number from 0 to 255. Every bit position in an octet has a fixed value. Memorize this header row — it is the only thing to memorize:

128   64   32   16   8   4   2   1

Binary → decimal: write the 8 bits under the header and add the values that sit above each 1. That is the whole trick.

Decimal → binary: walk the header left to right. At each position ask "does this value fit into what I have left?" If yes, write 1 and subtract it; if no, write 0 and move on. A correct conversion always ends with 0 left over.

Instant self-checks: all eight 1s = 255; all 0s = 0; every answer must land between the two. An odd number always ends in 1; an even number always ends in 0.

Worked examples

Example 1 — binary → decimal: 10100110

128   64   32   16   8   4   2   1
 1     0    1    0   0   1   1   0

Add the values above the 1s: 128 + 32 + 4 + 2 = 166.

Example 2 — decimal → binary: 172

AskFits?BitLeft over
128 into 172?yes144
64 into 44?no044
32 into 44?yes112
16 into 12?no012
8 into 12?yes14
4 into 4?yes10
2 into 0?no00
1 into 0?no00

Result: 10101100. (That 172 opens the private block 172.16.0.0/12 — you will meet it again in this module.)

Example 3 — a mask octet: /26

A subnet mask is always unbroken 1s followed by unbroken 0s. A /26 mask has 26 ones: three full octets (24 bits) plus two more at the start of the fourth:

11000000  →  128 + 64  =  192      so /26 = 255.255.255.192

Because the 1s never have gaps, only nine values can ever appear in a mask octet: 0, 128, 192, 224, 240, 248, 252, 254, 255. If you compute anything else, a bit slipped.

Before Set C: hexadecimal in four lines

Hex has sixteen digits: 0–9, then A=10, B=11, C=12, D=13, E=14, F=15. One hex digit is exactly 4 bits, so two hex digits are one octet. Two-digit hex → decimal: (first digit × 16) + second digit. MAC addresses are twelve hex digits (3C:52:82:1B:04:9F) and IPv6 groups are four (2001:0db8:…) — same bits, shorter spelling.

Exercises

Finish a whole set before opening the key. Write all 8 bits, leading zeros included — routers do.

Set A — binary → decimal

A1. 00000101 · A2. 00001111 · A3. 00100000 · A4. 01010101 · A5. 10000001 A6. 10101010 · A7. 11000000 · A8. 11001000 · A9. 11100100 · A10. 11111101

Set B — decimal → binary

B1. 7 · B2. 12 · B3. 25 · B4. 63 · B5. 100 B6. 130 · B7. 168 · B8. 192 · B9. 224 · B10. 249

Set C — mixed (hex joins in)

C1. Binary → decimal: 10111111 C2. Decimal → binary: 254 C3. Hex → decimal: 1A C4. Hex → decimal: C8 C5. Decimal → hex: 61 C6. Decimal → hex: 240 C7. Hex → binary (8 bits): 2F C8. Binary → hex: 11010110 C9. A mask octet has 5 network bits and 3 host bits. Write it in binary and in decimal. C10. A MAC address begins with the octet 3C. Give it in decimal and in binary.

Answer key

Set A

#AnswerThe sum
A154+1
A2158+4+2+1
A33232
A48564+16+4+1
A5129128+1
A6170128+32+8+2
A7192128+64
A8200128+64+8
A9228128+64+32+4
A10253128+64+32+16+8+4+1

Set B

#AnswerCheck (add it back)
B1000001114+2+1 = 7
B2000011008+4 = 12
B30001100116+8+1 = 25
B40011111132+16+8+4+2+1 = 63
B50110010064+32+4 = 100
B610000010128+2 = 130
B710101000128+32+8 = 168
B811000000128+64 = 192
B911100000128+64+32 = 224
B1011111001128+64+32+16+8+1 = 249

Set C


Network Essentials · Module 4 · Turning Point Academy — backbone: Al-Doori, Network Essentials, Ch. 6.