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?

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

The street is split into four equal blocks of 64 numbers. Which block is house 77 in?
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:

  1. Network address: the first address, which names the network.
  2. Broadcast address: the last address, which reaches every device on the network.
  3. Total addresses: how many addresses the network contains.
  4. Usable host addresses: which addresses can actually be given to devices.
  5. 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 bitMask bitResult
111
100
010
000

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?

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.

Worked example: 131.107.5.15 AND 255.255.255.0 = 131.107.5.0

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?

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

A network has 5 host bits. Which statement is right, by the usual rule?
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.

131.107.5.15/24 worked out
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.

  1. 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.
  2. 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.
  3. 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.
10.20.30.40/8 worked out
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)
172.16.45.9/16 worked out
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?

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.

  1. Find the shared octet. /26 is 24 + 2: three whole network octets, then 2 network bits in the fourth octet.
  2. Find the mask. Two 1 bits in the fourth octet give 11000000 = 192, so the mask is 255.255.255.192.
  3. 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.
  4. Place the address. 77 is at least 64 but less than 128, so it is in the block 64–127.
  5. Network address: 192.168.10.64. Broadcast address: 192.168.10.127.
  6. Count. 6 host bits in total, so 2⁶ = 64 addresses and 62 usable: 192.168.10.65 to 192.168.10.126.
/26 divides the fourth octet into blocks of 64

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.

  1. 0–63
  2. 64–127 ← 77 is here
  3. 128–191
  4. 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 = 192.168.10.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.

192.168.10.77/26 worked out
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

  1. Find the shared octet. /20 is 16 + 4: two whole network octets, then 4 network bits in the third octet.
  2. Find the mask. Four 1 bits in the third octet give 11110000 = 240, so the mask is 255.255.240.0.
  3. 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.
  4. Place the address. The third octet is 45, which is at least 32 but less than 48: block 32–47.
  5. Network address: 172.16.32.0, because the third octet becomes 32 and the fourth octet, all host bits, becomes 0.
  6. 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).
  7. 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.
/20 divides the third octet into blocks of 16

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.

  1. 0–15
  2. 16–31
  3. 32–47 ← 45 is here
  4. 48–63
  5. 64–79
  6. 80–95
  7. 96–111
  8. 112–127
  9. 128–143
  10. 144–159
  11. 160–175
  12. 176–191
  13. 192–207
  14. 208–223
  15. 224–239
  16. 240–255
172.16.45.9 AND 255.255.240.0 = 172.16.32.0

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.

172.16.45.9/20 worked out
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

What is the network address of 10.5.200.9/20?
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

The prefix of 192.168.10.77 changes from /26 to /27. What happens to the size of its network?
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 prefixMaskNetworkBroadcastTotalUsable
192.168.10.77/24255.255.255.0192.168.10.0192.168.10.255256254
192.168.10.77/25255.255.255.128192.168.10.0192.168.10.127128126
192.168.10.77/26255.255.255.192192.168.10.64192.168.10.1276462
192.168.10.77/27255.255.255.224192.168.10.64192.168.10.953230
192.168.10.77/28255.255.255.240192.168.10.64192.168.10.791614

Stage: Check

Do two devices share a subnet?

To check whether two devices share a subnet, work out the network address of each with its configured prefix and compare them. If the network addresses match, and both devices use compatible subnet settings, each treats the other as on-link: it sends traffic straight to the other device rather than to its default gateway, the router that leads out of the local network. A matching network address is not a guarantee of communication. The two devices must also be connected to the same local network, and nothing, such as a firewall on either device, must be blocking the traffic.

  1. 192.168.10.77/26 and 192.168.10.100/26. Both fourth octets fall in the block 64–127, so both networks are 192.168.10.64. Same subnet: each treats the other as on-link, so traffic goes directly rather than through a router.
  2. 192.168.10.77/26 and 192.168.10.130/26. 77 is in 64–127 but 130 is in 128–191: networks 192.168.10.64 and 192.168.10.128. Different subnets: traffic between them needs a router.
  3. 172.16.40.1/20 and 172.16.45.9/20. Both third octets, 40 and 45, fall in the block 32–47, so both networks are 172.16.32.0. Same subnet, even though the third octets differ.
  4. A two-PC example: 10.1.16.1/24 and 10.1.15.8/24. The networks are 10.1.16.0 and 10.1.15.0. Different subnets, which is why a router is needed between them. Routing follows that traffic.

Check your understanding

Are 10.0.8.5/21 and 10.0.13.200/21 on the same subnet?
Show the answer

Answer: B. Yes: 8 and 13 share the block 8–15.

Yes. A /21 leaves 3 host bits in the third octet, so blocks of 8; 8 and 13 both fall in 8 to 15, giving the network 10.0.8.0.

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?

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/32 on the router’s loopback interface.
203.0.113.10/31: a point-to-point link
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
10.1.254.254/32: a single host
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

A device has 192.168.10.77 with /24, while its neighbours use /26. It can reach some devices but not others. Why?
Show the answer

Answer: C. It treats some other subnets as local.

With /24 it believes every address from 192.168.10.0 to 192.168.10.255 is local, so it tries to reach devices on other /26 subnets directly instead of through the router.

Apply it

How many usable addresses does 203.0.113.0/29 have?
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.

  1. For 131.107.5.15/24, which option gives the conventional broadcast address and usable host range?

    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)

  2. A fictional device is configured with 172.16.8.100/26. What are its network and broadcast addresses?

    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)

  3. A colleague says every subnet has 2ⁿ − 2 usable addresses, where n is the number of host bits. Which statement shows why that is a convention rather than a universal rule?

    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)

  4. PC1 is 10.1.16.1/24 and PC2 is 10.1.15.8/24. A learner argues that both are Class A addresses because their first octet is 10, so they share the network 10.0.0.0 and can reach each other directly. What is the correct assessment?

    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/32 route. 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.