APIPA — Why You Get a 169.254 Address and How to Fix It
A 169.254.x.x address means DHCP failed and Windows self-assigned an APIPA address. Here is how APIPA works, what…
Everything you need on one page: CIDR prefix, subnet mask, block size, usable hosts and wildcard mask. If you are learning the method rather than looking up a value, start with subnetting explained.
| Memorise | Value |
|---|---|
| Bit values in an octet | 128, 64, 32, 16, 8, 4, 2, 1 |
| Valid mask octets | 0, 128, 192, 224, 240, 248, 252, 254, 255 |
| Block size (magic number) | 256 − mask octet |
| Usable hosts | 2host bits − 2 |
A mask octet that is not in that second row is invalid. Mask bits are contiguous from the left, so 100, 200 and 255.255.255.100 can never be correct.
| CIDR | Subnet mask | Wildcard mask | Block size | Total addresses | Usable hosts |
|---|---|---|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 | — | 16,777,216 | 16,777,214 |
| /9 | 255.128.0.0 | 0.127.255.255 | 128 (2nd) | 8,388,608 | 8,388,606 |
| /10 | 255.192.0.0 | 0.63.255.255 | 64 (2nd) | 4,194,304 | 4,194,302 |
| /11 | 255.224.0.0 | 0.31.255.255 | 32 (2nd) | 2,097,152 | 2,097,150 |
| /12 | 255.240.0.0 | 0.15.255.255 | 16 (2nd) | 1,048,576 | 1,048,574 |
| /13 | 255.248.0.0 | 0.7.255.255 | 8 (2nd) | 524,288 | 524,286 |
| /14 | 255.252.0.0 | 0.3.255.255 | 4 (2nd) | 262,144 | 262,142 |
| /15 | 255.254.0.0 | 0.1.255.255 | 2 (2nd) | 131,072 | 131,070 |
| /16 | 255.255.0.0 | 0.0.255.255 | — | 65,536 | 65,534 |
| /17 | 255.255.128.0 | 0.0.127.255 | 128 (3rd) | 32,768 | 32,766 |
| /18 | 255.255.192.0 | 0.0.63.255 | 64 (3rd) | 16,384 | 16,382 |
| /19 | 255.255.224.0 | 0.0.31.255 | 32 (3rd) | 8,192 | 8,190 |
| /20 | 255.255.240.0 | 0.0.15.255 | 16 (3rd) | 4,096 | 4,094 |
| /21 | 255.255.248.0 | 0.0.7.255 | 8 (3rd) | 2,048 | 2,046 |
| /22 | 255.255.252.0 | 0.0.3.255 | 4 (3rd) | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 0.0.1.255 | 2 (3rd) | 512 | 510 |
| /24 | 255.255.255.0 | 0.0.0.255 | — | 256 | 254 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 128 | 126 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 64 | 62 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 32 | 30 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 16 | 14 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 8 | 6 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 4 | 2 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 | 2 (RFC 3021) |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 | 1 |
Bolded rows are the ones that appear most often in exams and in real designs.
| Decimal | Binary | Bits set |
|---|---|---|
| 0 | 00000000 | 0 |
| 128 | 10000000 | 1 |
| 192 | 11000000 | 2 |
| 224 | 11100000 | 3 |
| 240 | 11110000 | 4 |
| 248 | 11111000 | 5 |
| 252 | 11111100 | 6 |
| 254 | 11111110 | 7 |
| 255 | 11111111 | 8 |
Converting a full address is covered in decimal to binary conversion.
A wildcard mask is the inverse of a subnet mask — subtract each octet from 255. Used by ACLs and OSPF network statements, where 0 means “must match” and 1 means “ignore”.
Subnet mask: 255.255.255.192
255-255 . 255-255 . 255-255 . 255-192
Wildcard: 0 . 0 . 0 . 63
access-list 101 permit ip 192.168.1.0 0.0.0.63 any
router ospf 1
network 192.168.1.0 0.0.0.63 area 0| Range | CIDR | Addresses | Typically used by |
|---|---|---|---|
| 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 | 16,777,216 | Enterprises, cloud VPCs |
| 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 | 1,048,576 | Medium networks, Docker |
| 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 | 65,536 | Home and small office |
The 172 range is 172.16 to 172.31 only — not all of 172. Full detail in IPv4 addressing.
| Range | Meaning |
|---|---|
| 127.0.0.0/8 | Loopback |
| 169.254.0.0/16 | APIPA — DHCP failed |
| 100.64.0.0/10 | Carrier-grade NAT |
| 224.0.0.0/4 | Multicast |
| 255.255.255.255 | Limited broadcast |
| 0.0.0.0/0 | Default route |
| You need | Use | You get |
|---|---|---|
| 1–2 hosts | /30 | 2 |
| 3–6 | /29 | 6 |
| 7–14 | /28 | 14 |
| 15–30 | /27 | 30 |
| 31–62 | /26 | 62 |
| 63–126 | /25 | 126 |
| 127–254 | /24 | 254 |
| 255–510 | /23 | 510 |
| 511–1022 | /22 | 1,022 |
Round up — always. Needing 65 hosts means a /25, not a /26.
Given: 192.168.5.100/27
1. Block size = 256 - 224 = 32
2. Blocks = 0, 32, 64, 96, 128, 160, 192, 224
100 falls in the 96 block
3. Network = 192.168.5.96
Broadcast = 96 + 32 - 1 = 192.168.5.127
Usable = 192.168.5.97 - 192.168.5.126Check any answer instantly with the subnet calculator, then test yourself against the practice questions. For unequal subnet sizes in one network, see VLSM.
256 minus the interesting mask octet. It is the increment between consecutive subnet addresses — for a /28 (mask 240) the block size is 16, so subnets start at 0, 16, 32, 48 and so on.
Count the 1 bits. 255.255.255.192 is 8 + 8 + 8 + 2 = /26. The bits-set column in the binary table above gives the count for each octet value.
ACLs and OSPF network statements. It is the inverse of the subnet mask — subtract each octet from 255. A /26 mask of 255.255.255.192 becomes wildcard 0.0.0.63.
It has 4 total addresses, and two are always consumed by the network and broadcast addresses. That leaves exactly 2, which is why /30 is the standard for point-to-point WAN links.
Yes, on point-to-point links. RFC 3021 removes the network and broadcast addresses for that case, giving 2 usable addresses from 2 total. Most modern router platforms support it.
10.0.0.0/8 gives 16,777,214 usable addresses — the largest of the three RFC 1918 ranges.