// Lesson 8 of 49 · IPv4 addressing and subnetting
Binary and the IPv4 address
An IPv4 address is a 32-bit number. We write it as four decimal octets (8 bits each) separated by dots — 192.168.10.25 — because 32 ones and zeros are hard to read. Subnetting is simply working with those bits, so binary comes first.
The octet table
Each bit in an octet has a value. Memorise this row — everything in subnetting uses it:
| Bit | 1st | 2nd | 3rd | 4th | 5th | 6th | 7th | 8th |
|---|---|---|---|---|---|---|---|---|
| Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Decimal → binary
Convert 172: go left to right, take each value if it fits.
- 128 fits (172 − 128 = 44) → 1
- 64 does not fit → 0
- 32 fits (44 − 32 = 12) → 1
- 16 does not → 0
- 8 fits (12 − 8 = 4) → 1
- 4 fits (4 − 4 = 0) → 1
- 2, 1 → 0 0
172 = 10101100
Binary → decimal
11000000 = 128 + 64 = 192. Add the values where the bit is 1.
Values worth knowing by heart
These appear in every subnet mask: 128, 192, 224, 240, 248, 252, 254, 255 — each is the previous one plus the next bit value (128, 128+64, 192+32, …).
Network part and host part
Every address has a network portion (shared by all devices in the subnet) and a host portion (unique to the device). The subnet mask — next lesson — says where the boundary is.
Historical classes
Before CIDR, the first octet decided the network size. You still hear the terms:
| Class | First octet | Default mask |
|---|---|---|
| A | 1–126 | 255.0.0.0 (/8) |
| B | 128–191 | 255.255.0.0 (/16) |
| C | 192–223 | 255.255.255.0 (/24) |
| D | 224–239 | Multicast |
| E | 240–255 | Reserved |
127.0.0.0/8 is reserved for loopback (127.0.0.1 is "this host").
Private addresses (RFC 1918)
These ranges are not routed on the internet and can be reused inside any organisation. NAT translates them to public addresses at the edge.
| Range | Prefix |
|---|---|
| 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 |
| 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 |
| 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 |
Other special addresses
- 169.254.0.0/16 — APIPA / link-local. A Windows PC that cannot reach a DHCP server gives itself one of these. Seeing 169.254.x.x is a strong hint that DHCP failed.
- 0.0.0.0 — "this network" / "any"; used in default routes (
0.0.0.0/0). - 255.255.255.255 — limited broadcast.
- 100.64.0.0/10 — carrier-grade NAT shared space, used by some ISPs.
Key points
- IPv4 = 32 bits = 4 octets; bit values 128 64 32 16 8 4 2 1.
- Know the mask values 128, 192, 224, 240, 248, 252, 254, 255.
- Private ranges: 10/8, 172.16/12, 192.168/16.
- 169.254.x.x on a client means DHCP did not work.
Sign in to save your lesson progress across devices. You can read every published lesson without an account.