Why Subnetting Matters for CCNA 200-301
Subnetting is the process of dividing an IP network into smaller logical networks. It is an essential CCNA skill because routers, switches, access control lists and routing protocols all depend on correct IP addressing.
A network engineer must be able to determine:
- The subnet mask for a prefix length
- The network address
- The broadcast address
- The first and last usable host addresses
- The number of available subnets and hosts
- Whether two devices belong to the same subnet
- The correct prefix for a host requirement
- A valid Variable Length Subnet Masking plan
Subnetting questions may appear as direct calculations or inside routing, VLAN and troubleshooting scenarios. Fast calculation helps, but understanding why the answer is correct is more important than memorising shortcuts.
IPv4 Addresses and Subnet Masks
An IPv4 address contains 32 bits divided into four octets. Each octet has eight bits and can represent a decimal value from 0 to 255.
For example, the address 192.168.10.25 in binary is:
192 168 10 25
11000000 10101000 00001010 00011001A subnet mask identifies which bits belong to the network and which bits belong to hosts. A binary 1 represents a network bit, while a binary 0 represents a host bit.
The following formats mean the same thing:
255.255.255.0
/24
11111111.11111111.11111111.00000000The /24 notation is called Classless Inter-Domain Routing, or CIDR, prefix notation. It means that the first 24 bits are network bits and the remaining eight bits are host bits.
Subnet Mask Reference Table
The following prefixes are especially useful for CCNA subnetting calculations.
| Prefix | Subnet mask | Addresses per subnet | Usable hosts |
|---|---|---|---|
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
| /31 | 255.255.255.254 | 2 | Point-to-point use |
| /32 | 255.255.255.255 | 1 | Single host route |
For traditional IPv4 subnets, two addresses cannot be assigned to hosts:
- The network address identifies the subnet.
- The broadcast address reaches all hosts in that subnet.
Therefore, the standard usable-host formula is:
Usable hosts = 2^h - 2Here, h is the number of host bits. A /27 has five host bits, so it provides 2^5 - 2 = 30 usable host addresses.
The /31 prefix is a special case. It can be used on supported point-to-point links under RFC 3021 because a broadcast address is unnecessary on that type of link. In basic subnetting exercises, /30 is still commonly used for links requiring two conventional host addresses.
Understanding Binary Place Values
Each bit in an octet has a decimal place value.
| Bit position | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| Decimal value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Consider /27. The final mask octet has three network bits:
11100000 = 128 + 64 + 32 = 224The mask is therefore 255.255.255.224.
For /20, the first 16 bits and four bits in the third octet are network bits:
11111111.11111111.11110000.00000000
255.255.240.0You do not need to convert every address completely into binary. Binary knowledge explains subnetting, while the block-size method makes most exam calculations faster.
The Block-Size Method
The block size, sometimes called the magic number, shows where each subnet starts. Find the interesting octet: the octet in the mask that is neither 255 nor 0. Then use:
Block size = 256 - mask value in the interesting octetFor a /27 mask, the interesting octet is 224:
256 - 224 = 32The subnet ranges in the final octet therefore begin at:
0, 32, 64, 96, 128, 160, 192, 224Each range contains 32 addresses. For example, the subnet beginning at 64 ends immediately before the next subnet at 96.
Network address: 192.168.10.64
First usable host: 192.168.10.65
Last usable host: 192.168.10.94
Broadcast address: 192.168.10.95Practical Example 1: Creating Equal-Sized Subnets
Suppose 192.168.10.0/24 must be divided into at least six equal-sized subnets.
A /24 initially has eight host bits. Borrow enough host bits to create six or more subnets:
2^2 = 4 subnets, which is not enough
2^3 = 8 subnets, which is enoughBorrowing three bits changes /24 to /27. Each /27 has 32 total addresses and 30 usable host addresses.
| Subnet | Network | Usable host range | Broadcast |
|---|---|---|---|
| 1 | 192.168.10.0/27 | 192.168.10.1–192.168.10.30 | 192.168.10.31 |
| 2 | 192.168.10.32/27 | 192.168.10.33–192.168.10.62 | 192.168.10.63 |
| 3 | 192.168.10.64/27 | 192.168.10.65–192.168.10.94 | 192.168.10.95 |
| 4 | 192.168.10.96/27 | 192.168.10.97–192.168.10.126 | 192.168.10.127 |
| 5 | 192.168.10.128/27 | 192.168.10.129–192.168.10.158 | 192.168.10.159 |
| 6 | 192.168.10.160/27 | 192.168.10.161–192.168.10.190 | 192.168.10.191 |
| 7 | 192.168.10.192/27 | 192.168.10.193–192.168.10.222 | 192.168.10.223 |
| 8 | 192.168.10.224/27 | 192.168.10.225–192.168.10.254 | 192.168.10.255 |
The zero subnet and all-ones subnet are valid in modern IP networks. Do not remove them when answering current Cisco subnetting questions.
Practical Example 2: Finding the Subnet of an IP Address
Find the subnet details for 172.16.35.77/20.
A /20 mask is 255.255.240.0. The third octet is the interesting octet, and its block size is:
256 - 240 = 16The third-octet subnet boundaries are 0, 16, 32, 48, 64 and so on. The value 35 falls between 32 and 47.
Therefore:
Network address: 172.16.32.0/20
First usable host: 172.16.32.1
Last usable host: 172.16.47.254
Broadcast address: 172.16.47.255A common mistake is to work only with the fourth octet. With prefixes such as /20, /21 or /22, the subnet boundary is in the third octet.
Practical Example 3: Selecting a Prefix for Hosts
Assume a Chennai office LAN needs addresses for 50 devices. Choose the smallest suitable prefix.
Test the available host bits:
5 host bits: 2^5 - 2 = 30 hosts
6 host bits: 2^6 - 2 = 62 hostsSix host bits are required. Since an IPv4 address has 32 bits, the prefix is:
32 - 6 = /26A /26 subnet mask is 255.255.255.192 and supports 62 usable host addresses. A /25 would also work, but it would allocate more addresses than necessary.
When a requirement gives a number of devices, remember to include router interfaces, management interfaces, servers, printers, wireless access points and expected growth where the design scenario requires them.
Practical Example 4: VLSM Address Planning
Variable Length Subnet Masking allows subnets of different sizes to use the same address block efficiently. Consider 192.168.50.0/24 with these requirements:
- Engineering VLAN: 100 hosts
- Sales VLAN: 50 hosts
- Management VLAN: 20 hosts
- Router link: 2 hosts
Always allocate the largest requirement first.
| Requirement | Chosen prefix | Allocation | Usable range | Broadcast |
|---|---|---|---|---|
| 100 hosts | /25 | 192.168.50.0/25 | .1–.126 | .127 |
| 50 hosts | /26 | 192.168.50.128/26 | .129–.190 | .191 |
| 20 hosts | /27 | 192.168.50.192/27 | .193–.222 | .223 |
| 2 hosts | /30 | 192.168.50.224/30 | .225–.226 | .227 |
Addresses from 192.168.50.228 through 192.168.50.255 remain unallocated. They can later be divided into valid CIDR-aligned subnets.
If smaller networks are assigned first without planning, the free space may become fragmented. You may then have enough total addresses but no correctly aligned block large enough for the biggest subnet.
Checking Whether Two Hosts Share a Subnet
Consider these devices:
Host A: 192.168.1.62/26
Host B: 192.168.1.65/26A /26 has a block size of 64. Its boundaries are 0, 64, 128 and 192.
- Host A belongs to
192.168.1.0/26, with broadcast192.168.1.63. - Host B belongs to
192.168.1.64/26, with broadcast192.168.1.127.
They are in different subnets and require a router or Layer 3 switch to communicate. Being numerically close does not mean that two IP addresses are in the same network.
Configuring and Verifying a Subnet on Cisco IOS
The following example assigns the first usable address in 192.168.10.64/27 to a router interface:
configure terminal
interface GigabitEthernet0/0
description User LAN
ip address 192.168.10.65 255.255.255.224
no shutdown
endA host in this LAN could use:
IP address: 192.168.10.66
Subnet mask: 255.255.255.224
Default gateway: 192.168.10.65Useful ambiguity between an incorrect mask and a routing problem can be removed by checking the interface and connected route:
show ip interface brief
show ip interface GigabitEthernet0/0
show ip route connected
ping 192.168.10.66The connected route should appear as 192.168.10.64/27. If the router and host use different masks, each device may make a different decision about whether a destination is local or must be sent to the default gateway.
Wildcard Masks and Subnetting
CCNA learners also encounter wildcard masks in access control lists and some routing protocol configurations. A wildcard mask is the inverse of a subnet mask.
Subtract each mask octet from 255:
Subnet mask: 255.255.255.224
Wildcard mask: 0.0.0.31For example, this standard ACL statement matches the entire 192.168.10.64/27 subnet:
access-list 10 permit 192.168.10.64 0.0.0.31In a wildcard mask, a 0 bit must match, while a 1 bit is ignored. Do not configure a subnet mask directly where Cisco IOS syntax expects a wildcard mask.
Common CCNA Subnetting Mistakes
Avoid these frequent errors:
- Treating the network or broadcast address as a host address
- Using
2^hinstead of2^h - 2for conventional usable-host calculations - Calculating only in the fourth octet when the prefix boundary is earlier
- Forgetting that block sizes must begin at valid boundaries
- Choosing a subnet that meets the host count but overlaps another subnet
- Assigning VLSM networks from smallest to largest
- Confusing subnet masks with wildcard masks
- Assuming two addresses are in the same subnet because their first three octets match
- Forgetting to verify the configured mask on both ends
A Reliable Exam Calculation Process
Use the following sequence for each IPv4 subnetting problem:
- Convert the prefix to a subnet mask.
- Identify the interesting octet.
- Calculate the block size using
256 - mask value. - List the nearest subnet boundaries.
- Find the network containing the given address.
- Set all host bits to zero for the network address.
- Set all host bits to one for the broadcast address.
- Add one to the network address for the first host.
- Subtract one from the broadcast address for the last host.
- Confirm that the subnets do not overlap.
Practise without a calculator once the method is clear. In real network jobs in Chennai, Bangalore and elsewhere, engineers can use tools for validation, but they still need to recognise invalid masks, overlapping routes and incorrect gateway assignments quickly.
Final Preparation Tips
Memorise the common prefixes from /24 to /30, including their masks, block sizes and usable-host counts. Then practise examples in which the interesting octet changes from the fourth octet to the third or second octet.
Build small labs using Cisco Packet Tracer or physical Cisco equipment. Configure router interfaces, assign host addresses, test pings and inspect connected routes. Practical troubleshooting turns subnetting from an exam calculation into a network-engineering skill that supports VLAN design, static routing, OSPF, ACLs, DHCP and cloud networking.
