NetworkingCCNANetwork+

IPv4 Subnetting Explained for CCNA and Network+

Subnetting is the skill that separates people who understand networking from people who just use it. Take a large block of IP addresses and divide it into smaller, isolated segments. Get this right and you control exactly which devices can talk to each other and how many hosts fit in each segment. The CCNA and Network+ exams both test subnetting heavily, and speed matters because you may have under two minutes per question. This guide gives you the math, the shortcuts, and the reasoning pattern that makes subnet questions mechanical rather than mysterious.

10 min
4 sections · 6 exam key points
6 practice questions

How IP addresses and subnet masks work together

An IPv4 address is 32 bits written as four decimal octets, like 192.168.10.50. The subnet mask tells you which bits are the network portion and which are the host portion. A /24 mask (255.255.255.0) means the first 24 bits identify the network and the last 8 bits identify the host within that network. Every device on the same subnet shares the same network bits.

Think of an IP address like a mailing address. The subnet mask defines how much of that address is the street and how much is the house number. Two houses on the same street share a network; two houses on different streets need a router to exchange mail.

CIDR notation (the slash number) tells you directly how many bits are in the network portion. /24 means 24 network bits. /28 means 28 network bits, leaving 4 bits for hosts. The more bits in the mask, the smaller the subnet.

Calculating subnets, hosts, and ranges

The number of usable hosts in a subnet is 2 to the power of the host bits, minus 2. You subtract 2 because the first address in every subnet is the network address (all host bits zero) and the last is the broadcast address (all host bits one). Neither can be assigned to a device. A /28 subnet has 4 host bits, so 2^4 minus 2 equals 14 usable hosts.

To find the network address of a subnet given an IP and mask, you AND the IP address against the mask bit by bit. For exam speed, the faster approach is to find the block size: 256 minus the interesting octet of the mask. A /26 mask has 192 (11000000) in the fourth octet, so 256 minus 192 equals 64. Subnets start at 0, 64, 128, and 192 in that octet. The IP 10.0.0.100 with a /26 mask falls in the 64 subnet (range 64 to 127), so the network address is 10.0.0.64 and the broadcast is 10.0.0.127.

The block size method works for any prefix length. /25 gives block size 128, /27 gives 32, /28 gives 16, /29 gives 8, /30 gives 4. Memorize these and subnet questions become arithmetic rather than binary conversion.

VLSM and address planning

Variable Length Subnet Masking (VLSM) lets you use different mask lengths for different subnets within the same larger network. Instead of forcing every segment to use the same block size, you size each subnet for its actual need. A point-to-point WAN link needs only two hosts, so give it a /30 (2 usable hosts) instead of wasting a /24. A large LAN segment with 100 hosts needs at least a /25 (126 usable hosts).

VLSM planning order: always subnet from largest requirement to smallest. Start with the segment needing the most hosts. Assign the smallest mask that fits, then work down. This prevents address overlap and makes efficient use of your address space.

How to choose the correct answer

Given an IP and mask, find the subnet: calculate block size (256 minus the mask octet), find which block the IP falls into, network address is the start of that block, broadcast is one before the next block.

Given a number of hosts needed, find the right mask: find the smallest power of 2 greater than hosts plus 2, the exponent is the number of host bits, subtract from 32 to get the prefix length.

Overlapping subnets: two IPs are in the same subnet if they share the same network address when ANDed with the mask. If they produce different network addresses, they are in different subnets.

For VLSM: subnet the largest requirement first, then carve the remaining space for smaller needs.

Common prefix lengths quick reference

PrefixMaskBlock sizeUsable hosts
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242

Key exam facts — CCNA / Network+

  • Usable hosts = 2^host bits minus 2 (subtract network and broadcast addresses).
  • Block size = 256 minus the interesting subnet mask octet.
  • Network address: first address in block (all host bits zero). Broadcast: last address (all host bits one).
  • /30 = 4 addresses, 2 usable. Common for point-to-point WAN links.
  • VLSM: different mask lengths on different subnets. Always plan largest to smallest.
  • CIDR: /24 = 24 network bits. More bits = smaller subnet.

Common exam traps

A /24 subnet can hold 256 hosts.

A /24 has 256 addresses, but 2 are reserved: the network address and the broadcast address. Usable hosts = 254.

The subnet mask and the prefix length are different things.

They express the same information in different formats. /24 and 255.255.255.0 both mean 24 network bits. CIDR notation is just the shorter way to write it.

Any IP address can be assigned to a device as long as it fits in the range.

The first address (network address) and last address (broadcast address) in any subnet cannot be assigned to hosts. Only the addresses between them are usable.

Practice questions — IPv4 Subnetting

These questions are representative of what you will see on CCNA, Network+ exams. The correct answer and explanation are shown immediately below each question.

Q1.A host has the IP address 192.168.10.100 with a subnet mask of 255.255.255.192. What is the network address of the subnet this host belongs to?

A.192.168.10.0
B.192.168.10.64
C.192.168.10.128
D.192.168.10.96

Explanation: The /26 mask (255.255.255.192) has a block size of 64 (256 - 192). Subnets are at .0, .64, .128, .192. The host .100 falls in the .64 subnet (.64 to .127). The network address is 192.168.10.64.

Q2.How many usable host addresses are available in a /28 subnet?

A.16
B.14
C.30
D.12

Explanation: A /28 subnet has 4 host bits. 2^4 = 16 total addresses. Subtract 2 for the network address and broadcast address. Usable hosts = 14.

Q3.A network engineer needs to connect two routers with a point-to-point link and waste as few addresses as possible. Which subnet mask should be used?

A./29
B./30
C./28
D./31

Explanation: A /30 gives 4 addresses, 2 usable — exactly enough for one address per router end. A /29 wastes 6 usable addresses. /31 (2 addresses, no host/broadcast) is valid for point-to-point per RFC 3021 but /30 is the traditional exam answer for CCNA/Network+ unless /31 is explicitly mentioned.

Q4.Using VLSM, a network administrator must subnet 10.0.0.0/24 to support: Site A = 50 hosts, Site B = 25 hosts, Site C = 10 hosts. In what order should subnets be assigned?

A.Smallest to largest: Site C first, then B, then A
B.Largest to smallest: Site A first, then B, then C
C.Alphabetical order
D.Randomly, since VLSM allows any order

Explanation: VLSM planning always starts with the largest requirement to ensure the space is available before carving smaller subnets. Assign the largest block first (Site A needs /26 for 62 hosts), then Site B (/27 for 30 hosts), then Site C (/28 for 14 hosts).

Q5.What is the broadcast address for the subnet 172.16.5.64/26?

A.172.16.5.127
B.172.16.5.128
C.172.16.5.126
D.172.16.5.255

Explanation: A /26 mask has block size 64. The subnet 172.16.5.64 spans .64 to .127. The broadcast address is the last address in the block: 172.16.5.127. The next subnet starts at .128.

Q6.A network administrator has the address 10.1.1.0/24 and needs to create subnets for 6 departments, each with no more than 30 hosts. Which prefix length meets this requirement?

A./26
B./27
C./28
D./29

Explanation: A /27 provides 32 addresses with 30 usable hosts — exactly meeting the 30-host requirement. A /28 only provides 14 usable hosts. A /26 gives 62 hosts (more than needed). /27 is the most efficient choice.

Frequently asked questions — IPv4 Subnetting

What is the fastest way to calculate subnets on the CCNA exam?

Use the block size method: block size = 256 minus the interesting octet of the subnet mask. Subnets start at 0 and increment by the block size. To find which subnet an IP belongs to, find the largest multiple of the block size that doesn't exceed the host portion. This is faster than binary conversion for most exam questions.

What is the difference between a network address and a broadcast address?

The network address is the first address in a subnet (all host bits are 0) and identifies the subnet itself. The broadcast address is the last address (all host bits are 1) and sends a message to all hosts in the subnet. Neither can be assigned to a host device. The usable host range is every address between them.

Is /24 the same as 255.255.255.0?

Yes. /24 (CIDR notation) and 255.255.255.0 (dotted decimal notation) express the same subnet mask — 24 consecutive 1-bits followed by 8 zero bits. Both notations appear on CCNA and Network+ exams and are interchangeable.

What is VLSM and why does it matter?

Variable Length Subnet Masking (VLSM) allows different subnets within the same network to use different mask lengths. This avoids wasting address space by sizing each subnet to its actual need. A WAN link needs a /30 (2 hosts); a large office segment might need a /25 (126 hosts). Without VLSM, you'd waste most addresses by making every subnet the same size.

How is subnetting tested on CCNA vs Network+?

Both exams test subnet calculation, but CCNA goes deeper — including VLSM, troubleshooting overlapping subnets, and route summarization. Network+ focuses on identifying network/broadcast addresses, calculating usable hosts, and determining whether two hosts are in the same subnet. Speed matters on both; practice mental block-size calculation until it's automatic.

Practice this topic

Test yourself on IPv4 Subnetting

JT Exams routes you to questions in your exact weak areas — automatically, after every session.

No credit card · Cancel anytime

Related certification topics