Study Guide
Subnetting: Network, Broadcast and Usable Addresses
Work out any IPv4 subnet from first principles: binary AND, network and broadcast addresses, total and usable hosts, prefixes inside an octet, and the /31 and /32 exceptions.
Lesson 3.7 Networking Fundamentals
Given an IPv4 address and its prefix, you can work out everything about the network it belongs to: where it starts and ends, how many addresses it has, and which can be given to devices. This lesson builds the method one question at a time.
Stage: Think
A street of 256 houses
Think it through
A street has houses numbered 0 to 255. Number 0 is kept to name the street, and number 255 is kept for a noticeboard that reaches every house. How many houses can actually be lived in?
- Hint 1: How many numbers run from 0 to 255?
- Hint 2: How many of them are kept back?
Show what happens
254: 256 numbers, less the two kept back. A network reserves its first and last addresses in the same way.
Think it through
Show the answer
Answer: C. 64 to 127.
64 to 127: the blocks start at 0, 64, 128 and 192, and 77 falls in the second. That idea, the block size, is the quick method this lesson builds.
Stage: Explain
What we want to find
For any address and prefix, subnetting answers five questions:
- Network address: the first address, which names the network.
- Broadcast address: the last address, which reaches every device on the network.
- Total addresses: how many addresses the network contains.
- Usable host addresses: which addresses can actually be given to devices.
- Same subnet or not: whether two devices treat each other as on-link or need a router.
Stage: Predict
Step 1: find the network address with binary AND
The key operation is a bitwise AND of the address and the subnet mask. AND compares two bits and gives 1 only when both are 1.
| Address bit | Mask bit | Result |
|---|---|---|
| 1 | 1 | 1 |
| 1 | 0 | 0 |
| 0 | 1 | 0 |
| 0 | 0 | 0 |
Think it through
Look at the AND table. If you AND an address with a mask that has 1s for every network bit and 0s for every host bit, what happens to each part of the address?
- Hint 1: What does ANDing a bit with 1 give? And with 0?
Show what happens
The network bits come through unchanged, because ANDing with 1 keeps a bit as it is, and every host bit becomes 0, because ANDing with 0 always gives 0. What is left is the network address.
Because the mask is 1 in the network portion and 0 in the host portion, AND keeps the network bits exactly as they are and turns every host bit into 0. The result is the network address.
131.107.5.15 AND 255.255.255.0 gives 131.107.5.0. Each result bit is 1 only where both the address bit and the mask bit are 1, so the first 24 bits are kept and the remaining host bits become 0.
N Network bits: first 24 H Host bits: last 8. 1 AND 1 = 1; any other combination = 0.
Stage: Predict
Step 2: find the broadcast address
Think it through
If the network address is the address with every host bit set to 0, what would you expect the broadcast address to be?
- Hint 1: The network address is the first address. Which is the last?
Show what happens
The same network bits with every host bit set to 1: the last address in the network.
The broadcast address is the opposite end of the network: keep the network bits, and set every host bit to 1. For 131.107.5.15/24 the host bits are the whole last octet, and eight 1s make 255, so the broadcast address is 131.107.5.255.
Stage: Explain
Step 3: count the addresses
Each host bit doubles the number of addresses, so a network has 2 to the power of the number of host bits addresses in total. The first (network) and last (broadcast) are reserved, so the conventional number of usable host addresses is total − 2. For /24 that is 2⁸ − 2 = 254.
Check your understanding
Show the answer
Answer: C. 30 usable, out of 32 in total.
30: 2⁵ is 32 addresses in total, and the network and broadcast addresses are reserved.
- Address
- 131.107.5.15/24
- Subnet mask
- 255.255.255.0
- Network address
- 131.107.5.0
- Broadcast address
- 131.107.5.255
- Total addresses
- 256 (2^8)
- Usable host range
- 131.107.5.1 to 131.107.5.254
- Conventional usable hosts
- 254 (total − 2)
Stage: Explain
Prefixes on octet boundaries: /8, /16 and /24
When the prefix is a multiple of eight, the boundary falls between octets and the answers can be read straight off: network octets stay the same, host octets become 0 for the network address and 255 for the broadcast address.
- 10.20.30.40/8. One network octet, three host octets. Network: 10.0.0.0. Broadcast: 10.255.255.255. Host bits: 24, so 2²⁴ = 16,777,216 addresses and 16,777,214 usable.
- 172.16.45.9/16. Two network octets, two host octets. Network: 172.16.0.0. Broadcast: 172.16.255.255. Host bits: 16, so 65,536 addresses and 65,534 usable.
- 131.107.5.15/24. Three network octets, one host octet. Network: 131.107.5.0. Broadcast: 131.107.5.255. Host bits: 8, so 256 addresses and 254 usable.
- Address
- 10.20.30.40/8
- Subnet mask
- 255.0.0.0
- Network address
- 10.0.0.0
- Broadcast address
- 10.255.255.255
- Total addresses
- 16,777,216 (2^24)
- Usable host range
- 10.0.0.1 to 10.255.255.254
- Conventional usable hosts
- 16,777,214 (total − 2)
- Address
- 172.16.45.9/16
- Subnet mask
- 255.255.0.0
- Network address
- 172.16.0.0
- Broadcast address
- 172.16.255.255
- Total addresses
- 65,536 (2^16)
- Usable host range
- 172.16.0.1 to 172.16.255.254
- Conventional usable hosts
- 65,534 (total − 2)
Stage: Experiment
When the boundary falls inside an octet
Most real subnets do not end neatly between octets. When the prefix is not a multiple of eight, one octet is shared between network and host bits. Only that octet needs working out; every octet before it is kept, and every octet after it becomes 0 (network) or 255 (broadcast).
A quick method is the block size: the number of addresses each subnet covers in the shared octet. It equals 2 to the power of the host bits in that octet, which is also 256 minus the mask value for that octet. Networks start at multiples of the block size.
Worked example: 192.168.10.77/26
Think it through
Before the worked example: for 192.168.10.77/26 the fourth octet has 6 host bits. What is the block size, and which block is 77 in?
- Hint 1: Block size is 2 to the power of the host bits in that octet.
Show what happens
The block size is 2⁶ = 64, so the blocks start at 0, 64, 128 and 192, and 77 is in 64 to 127, just as house 77 was on the street. The example works through every step.
- Find the shared octet. /26 is 24 + 2: three whole network octets, then 2 network bits in the fourth octet.
- Find the mask. Two 1 bits in the fourth octet give
11000000= 192, so the mask is 255.255.255.192. - Find the block size. The fourth octet has 6 host bits: 2⁶ = 64 (also 256 − 192 = 64). Subnets start at 0, 64, 128 and 192.
- Place the address. 77 is at least 64 but less than 128, so it is in the block 64–127.
- Network address: 192.168.10.64. Broadcast address: 192.168.10.127.
- Count. 6 host bits in total, so 2⁶ = 64 addresses and 62 usable: 192.168.10.65 to 192.168.10.126.
A /26 prefix uses 2 network bits in the fourth octet, leaving 6 host bits, so that octet splits into 4 blocks of 64 (256 ÷ 64). The fourth octet of 192.168.10.77 is 77, which falls in the block 64–127.
- 0–63
- 64–127 ← 77 is here
- 128–191
- 192–255
The binary AND confirms step 5. In the fourth octet, 77 is 01001101 and the mask is 11000000; ANDing them keeps only the first two bits, 01000000, which is 64.
192.168.10.77 AND 255.255.255.192 gives 192.168.10.64. Each result bit is 1 only where both the address bit and the mask bit are 1, so the first 26 bits are kept and the remaining host bits become 0.
N Network bits: first 26 H Host bits: last 6. 1 AND 1 = 1; any other combination = 0.
- Address
- 192.168.10.77/26
- Subnet mask
- 255.255.255.192
- Network address
- 192.168.10.64
- Broadcast address
- 192.168.10.127
- Total addresses
- 64 (2^6)
- Usable host range
- 192.168.10.65 to 192.168.10.126
- Conventional usable hosts
- 62 (total − 2)
Worked example: 172.16.45.9/20
- Find the shared octet. /20 is 16 + 4: two whole network octets, then 4 network bits in the third octet.
- Find the mask. Four 1 bits in the third octet give
11110000= 240, so the mask is 255.255.240.0. - Find the block size. The third octet has 4 host bits: 2⁴ = 16 (also 256 − 240 = 16). Subnets start at 0, 16, 32, 48 and so on.
- Place the address. The third octet is 45, which is at least 32 but less than 48: block 32–47.
- Network address: 172.16.32.0, because the third octet becomes 32 and the fourth octet, all host bits, becomes 0.
- Broadcast address: 172.16.47.255, because the third octet is the top of its block (47) and the fourth octet is all 1s (255).
- Count. Host bits in total: 4 in the third octet plus 8 in the fourth = 12. That gives 2¹² = 4,096 addresses and 4,094 usable: 172.16.32.1 to 172.16.47.254.
A /20 prefix uses 4 network bits in the third octet, leaving 4 host bits, so that octet splits into 16 blocks of 16 (256 ÷ 16). The third octet of 172.16.45.9 is 45, which falls in the block 32–47.
- 0–15
- 16–31
- 32–47 ← 45 is here
- 48–63
- 64–79
- 80–95
- 96–111
- 112–127
- 128–143
- 144–159
- 160–175
- 176–191
- 192–207
- 208–223
- 224–239
- 240–255
172.16.45.9 AND 255.255.240.0 gives 172.16.32.0. Each result bit is 1 only where both the address bit and the mask bit are 1, so the first 20 bits are kept and the remaining host bits become 0.
N Network bits: first 20 H Host bits: last 12. 1 AND 1 = 1; any other combination = 0.
- Address
- 172.16.45.9/20
- Subnet mask
- 255.255.240.0
- Network address
- 172.16.32.0
- Broadcast address
- 172.16.47.255
- Total addresses
- 4,096 (2^12)
- Usable host range
- 172.16.32.1 to 172.16.47.254
- Conventional usable hosts
- 4,094 (total − 2)
Check your understanding
Show the answer
Answer: B. 10.5.192.0
10.5.192.0. A /20 has 4 host bits in the third octet, so blocks of 16; 200 falls in 192 to 207, and the fourth octet becomes 0.
Stage: Predict
How changing the prefix moves the boundary
Think it through
Show the answer
Answer: C. It halves, from 64 to 32 addresses.
It halves: each extra network bit is one fewer host bit. The table below follows the same address from /24 to /28.
The same address belongs to different networks depending on the prefix. Each extra network bit halves the size of the network:
Comparison table: scroll horizontally on narrow screens.
| Address and prefix | Mask | Network | Broadcast | Total | Usable |
|---|---|---|---|---|---|
| 192.168.10.77/24 | 255.255.255.0 | 192.168.10.0 | 192.168.10.255 | 256 | 254 |
| 192.168.10.77/25 | 255.255.255.128 | 192.168.10.0 | 192.168.10.127 | 128 | 126 |
| 192.168.10.77/26 | 255.255.255.192 | 192.168.10.64 | 192.168.10.127 | 64 | 62 |
| 192.168.10.77/27 | 255.255.255.224 | 192.168.10.64 | 192.168.10.95 | 32 | 30 |
| 192.168.10.77/28 | 255.255.255.240 | 192.168.10.64 | 192.168.10.79 | 16 | 14 |
Stage: Predict
Special cases: /31 and /32
Think it through
A link joins exactly two routers, and its network has only 2 addresses. By the usual rule, how many usable addresses would it have, and is that a problem?
- Hint 1: Apply total − 2 to a total of 2.
Show what happens
None, because 2 − 2 = 0, which would make the link impossible. So the rule has exceptions, described below.
The “total − 2” rule works because a normal subnet reserves its first and last addresses. Two prefixes are too small for that, and applying the rule to them gives the wrong answer.
- /31 has only two addresses. Reserving two would leave none, so /31 is used for point-to-point links, which join exactly two devices, usually two routers, where there is no need for a broadcast address. Both addresses are usable.
- /32 is a single address. It identifies one host, and appears in routing tables as a route to exactly one device. The VyOS routing table in Routing, default gateways and NAT/PAT includes
10.1.254.254/32on the router’s loopback interface.
- Address
- 203.0.113.10/31
- Subnet mask
- 255.255.255.254
- Network address
- 203.0.113.10
- Total addresses
- 2
- Usable addresses
- 203.0.113.10 and 203.0.113.11, both usable on a point-to-point link
- Broadcast address
- None: /31 point-to-point links do not reserve one
- Address
- 10.1.254.254/32
- Subnet mask
- 255.255.255.255
- Network address
- 10.1.254.254
- Total addresses
- 1
- Usable addresses
- 10.1.254.254 only: /32 identifies a single host
A wrong subnet mask is a common cause of “it can reach some devices but not others”. If a device has 192.168.10.77 with /24 while its neighbours use /26, it believes addresses from 192.168.10.0 to 192.168.10.255 are all local, and tries to reach devices in other /26 subnets directly instead of through the router. Working out both network addresses shows the mismatch immediately.
Stage: Apply
Apply it in a new situation
These questions use the lesson in situations it has not shown. For the strongest test of your understanding, come back to them on another day and answer each one at the first attempt.
Apply it
- Hint 1: Work out what range of addresses each prefix makes the device treat as local.
Apply it
Show the answer
Answer: A. 6 usable, out of 8.
6: a /29 leaves 3 host bits, so 2³ = 8 addresses, and the usual rule removes the network and broadcast addresses.
Stage: Check
Check your understanding
These questions come from the approved revision bank. Choose an answer and check it; the explanation and its sources follow.
Show answer
Answer: Broadcast 131.107.5.255; usable hosts 131.107.5.1 to 131.107.5.254 (254 addresses)
/24 leaves 8 host bits, which gives 2⁸ − 2 = 254 conventionally usable addresses: the network address has all host bits 0 (131.107.5.0) and the broadcast address has all host bits 1 (131.107.5.255), so the usable range lies between them, 131.107.5.1 to 131.107.5.254. Counting all 256 as usable ignores the two reserved addresses, and the 131.107.255.255 option uses the old Class B boundary. The minus-two rule is a convention for ordinary subnets: /31 and /32 are exceptions.
Revision sources: Study Buddy — 23 September 2026 (Study Buddy session (supplementary)) · Subnetting: Network, Broadcast and Usable Addresses (Supplementary Study Guide explanation)
Show answer
Answer: Network 172.16.8.64; broadcast 172.16.8.127
For a boundary inside an octet, start from the prefix. /26 is 24 + 2, so the fourth octet has 2 network bits and 6 host bits. The block size is 2⁶ = 64 (also 256 − 192), so subnets start at 0, 64, 128 and 192. 100 is at least 64 but less than 128, so the network is 172.16.8.64 and the broadcast, the last address in the block, is 172.16.8.127, leaving 62 usable addresses from 172.16.8.65 to 172.16.8.126. The .0 and .255 option assumes an octet boundary as with /24; .96 uses a block of 32, which is a /27; .128 starts the next block.
Revision sources: Subnetting: Network, Broadcast and Usable Addresses (Supplementary Study Guide explanation)
Show answer
Answer: A /31 point-to-point link uses both of its two addresses, and a /32 identifies a single address.
The conventional 2⁸ − 2 = 254 for a /24 reserves the network and broadcast addresses. There are exceptions: a /31 has only two addresses, and on point-to-point links both are used because no broadcast address is needed, while a /32 is a single address, such as a route to one host. Ordinary /24 and /26 subnets do reserve those two addresses, leaving 254 and 62, and calling /31 unusable applies the rule where it does not fit.
Revision sources: Study Buddy — 23 September 2026 (Study Buddy session (supplementary)) · Subnetting: Network, Broadcast and Usable Addresses (Supplementary Study Guide explanation)
Show answer
Answer: Applying each /24 mask gives 10.1.16.0 and 10.1.15.0, so they are on different networks and need a router.
Address classes are historical: modern networks use CIDR, so the configured /24 decides the boundary, not the Class A first octet. ANDing each address with 255.255.255.0 gives 10.1.16.0 for PC1 and 10.1.15.0 for PC2. The network portions differ in the third octet, so traffic between them needs a router. Different last octets are normal within one network, and sharing two octets is not enough when the prefix is /24.
Revision sources: Session 5: Networking Fundamentals — Part 1 (Classroom session record) · Study Buddy — 23 September 2026 (Study Buddy session (supplementary))
Study and revision
Practise through the Networking & Protocols topic: questions on the /24 host range, a /26 block, the /31 and /32 exceptions and the 23 September two-PC example, plus a flashcard on finding network and broadcast addresses. Every calculated answer is checked by an automated test. They are learning-only.
Stage: Consolidate
What to remember
- AND the address with the mask to find the network address; set every host bit to 1 for the broadcast address.
- A network has 2 to the power of its host bits addresses, and normally two fewer usable ones.
- When the boundary falls inside an octet, use the block size: 2 to the power of that octet’s host bits.
- Two devices share a subnet when their network addresses match under compatible prefixes.
- /31 has two usable addresses for point-to-point links, and /32 is a single host.
Key terms
- Network address
The first address of a subnet, with all host bits set to 0. It identifies the network itself rather than any one device.
- Broadcast address
The last address of an IPv4 subnet, with all host bits set to 1. Traffic sent to it reaches every device in that subnet.
Common misunderstandings
Only when the boundary falls on an octet. 192.168.10.77/26 has network .64 and broadcast .127.
It has 64 addresses in total. Removing the network and broadcast addresses leaves 62 usable.
The subtract-two rule does not apply to /31. On a point-to-point link, both addresses are usable.
Under CIDR only the configured prefix matters. 131.107.5.15/26 has network 131.107.5.0 and broadcast 131.107.5.63, whatever its historical class.
Lesson sources and acknowledgements
Sources and scope
- From the Study Buddy session on 23 September (see the entry): the 131.107.5.15/24 example, its network address 131.107.5.0, the bitwise AND, the 2⁸ − 2 = 254 host count, the two-PC 10.1.16.1/24 and 10.1.15.8/24 example, and the VyOS
10.1.254.254/32route. The session was supplementary to the course, not a numbered classroom session. - Supplementary explanation: the five questions, the broadcast and counting rules, the block-size method, the /8, /16, /26 and /20 worked examples, the prefix ladder, the same-subnet examples, the /31 and /32 explanations and the misunderstandings. Every figure has been checked by calculation, and the result boxes are computed directly from the address and prefix.
Guided version (published 1 November 2026, awaiting the site owner’s editorial review): the street opening questions, every question asked in the lesson with its feedback and hints, the calculation exercises and the closing summary are supplementary explanation written for the Study Guide. The settings are fictional. The questions in the lesson’s steps are not revision-bank items; those in “Check your understanding” are, unchanged.
A base-2 number system that uses only the digits 0 and 1. Each position is worth twice the position to its right: 1, 2, 4, 8 and so on.
Communication sent to every device in the relevant broadcast domain. Routers do not normally forward ordinary local broadcasts.
The last address of an IPv4 subnet, with all host bits set to 1. Traffic sent to it reaches every device in that subnet.
Classless addressing that writes the number of network bits after a slash, such as 192.168.1.0/24, instead of relying on historical Class A, B and C categories.
The next-hop router a device uses when no more specific route to a destination exists.
A control that allows or blocks network traffic according to configured rules.
An endpoint that sends or receives data on a network. Hosts are nodes, but not every node is an end host.
The first address of a subnet, with all host bits set to 0. It identifies the network itself rather than any one device.
A group of eight bits, which can hold a value from 0 to 255. An IPv4 address is made of four octets.
A device that forwards traffic between networks, for example between a private local network and the internet.
A device’s list of destination networks and how to reach each one: through a directly connected interface or via a next-hop router.
One network within a larger set of networks: a group of IP addresses that share the same network part, so that devices in it can reach each other directly without a router.
A 32-bit value that marks which bits of an IPv4 address belong to the network (1s) and which belong to the host (0s), such as 255.255.255.0.
Your progress on this lesson
Saved in this browser only. It is not sent anywhere, does not follow you to another device, and is lost if you clear this site’s data.
This browser is not allowing the site to save progress, so it will be forgotten when you leave the page.