pktivo.Back to CCNA Learn
CCNA Learn · Focus course

Subnetting, one bit at a time

Networking glossary →

12 lessons from IPv4 basics to VLSM design, route summaries, wildcard masks and IPv6. Build the reasoning behind the answer, then challenge yourself with a scenario exam.

Reading progress · saved on this device0 / 12 lessons read

The subnetting course

1IPv4 and binaryBeginner

An IP address is a device’s address. A subnet is its neighborhood.

Four numbers, 32 bits

An IPv4 address has four octets, each from 0 to 255. Each octet is eight binary digits, giving 32 bits in total. The bit values are 128, 64, 32, 16, 8, 4, 2 and 1. Add the values of the bits that are 1: 11000000 is 128 + 64 = 192.

Network part and device part

A prefix separates the network bits from the host bits. With 192.168.1.42/24, the first 24 bits identify 192.168.1.0, while the last eight identify addresses inside that subnet. Devices in the same subnet normally reach one another directly; other subnets need a router.

Worked example

192.168.1.42 = 11000000.10101000.00000001.00101010

Remember: Eight bits per octet; 32 bits per IPv4 address.

2CIDR prefixes and masksBeginner

The slash tells you how much of the address names the neighborhood.

Read the slash

In /24, 24 bits are network bits and 8 are host bits. A subnet mask writes network bits as 1 and host bits as 0: /24 is 255.255.255.0. Increasing the prefix makes a smaller subnet: /25 has 128 addresses, /26 has 64, /27 has 32 and /28 has 16.

Prefixes can cross octets

/20 is 255.255.240.0: eight ones in each of the first two octets, four in the third, and none in the fourth. For a changing octet, subtract the mask value from 256 to find the block increment. A /20 advances by 16 in the third octet.

Worked example

/26 → 11111111.11111111.11111111.11000000 → 255.255.255.192

Remember: More network bits means fewer addresses in each subnet.

3Find the network and host rangeIntermediate

Find the block containing the address, then reserve its first and last addresses for an ordinary LAN.

Find the block

For 192.168.10.77/26, the block size is 64. Blocks start at .0, .64, .128 and .192. Address .77 is in .64–.127, so the network address is 192.168.10.64 and the broadcast address is 192.168.10.127. The usable range is .65–.126.

Count usable addresses

For ordinary /0–/30 IPv4 subnets, total addresses = 2 raised to the number of host bits, and usable hosts = total minus two. The network address identifies the subnet; the broadcast address reaches the subnet’s hosts. /31 point-to-point links and /32 host routes are exceptions, covered later.

Worked example

192.168.10.77/26 → network .64 · first .65 · last .126 · broadcast .127

Remember: For ordinary LANs, the network and broadcast addresses are not device addresses.

4Size a subnet and split a networkIntermediate

Choose the smallest neighborhood with enough room for every device.

Work backward from devices

A LAN needs 50 usable addresses. Five host bits give 32 total and 30 usable, which is too small. Six give 64 total and 62 usable, so choose /26. Include gateways, printers, management addresses and expected growth when counting required hosts.

Borrow bits

Splitting a /24 into /26 networks borrows two host bits. That creates 2² = four equal subnets, each with 62 ordinary usable addresses. Splitting into /27 borrows three bits, creating eight subnets with 30 usable addresses each. Keep subnet boundaries aligned.

Worked example

50 LAN hosts → 50 + 2 = 52 → next power of two is 64 → /26

Remember: Round up, not down, and count the gateway too.

5VLSM address planningAdvanced

Give large teams large blocks and small teams small blocks without overlapping.

Allocate largest first

Variable Length Subnet Masking uses different prefix lengths in one address plan. In 192.168.20.0/24, allocate a 100-host LAN as .0/25 (126 usable), a 50-host LAN as .128/26 (62 usable), and a 20-host LAN as .192/27 (30 usable). The .224/27 block remains free.

Check fit and overlap

Each network must start on a boundary for its block size. Do not start a /26 at .160: that address belongs to .128/26. Write every network, broadcast and usable range in a table. Verify each block stays inside the parent network and never overlaps another allocation.

Worked example

100 hosts: .0/25 · 50 hosts: .128/26 · 20 hosts: .192/27 · free: .224/27

Remember: Largest first, aligned boundaries, no overlaps.

6Special prefixes and CCNA checksAdvanced

Some addresses describe a link or one device instead of a normal LAN.

/31 and /32 exceptions

On a supported point-to-point link, /31 uses both addresses as endpoints under RFC 3021; there is no directed broadcast. A /32 describes exactly one address, commonly a loopback or host route, and has no broadcast address. Do not apply the ordinary minus-two rule to these prefixes.

Summarize only compatible blocks

Adjacent networks can be summarized when they share the leading bits and align to the summary boundary. 192.168.0.0/24 and 192.168.1.0/24 fit 192.168.0.0/23. But 192.168.1.0/24 and 192.168.2.0/24 do not form one exact /23. Summaries that include extra addresses can route traffic somewhere unintended.

Worked example

/30: 2 ordinary hosts · /31: 2 point-to-point endpoints · /32: 1 address

Remember: Check boundaries and prefix exceptions before choosing an answer.

7Troubleshoot masks and gatewaysAdvanced

Two devices can disagree about which addresses are local when their masks are different.

Check both devices’ view

Host A is 192.168.10.65/26 and host B is 192.168.10.130/24. A belongs to .64–.127 and treats B as remote, so it needs a gateway. B belongs to .0–.255 and treats A as local, so it may try ARP directly. This disagreement can create asymmetric or failed communication. Do not assume that a shared first three octets means a shared subnet.

Validate the gateway and usable addresses

For an ordinary LAN, the gateway must be a reachable usable address on the local subnet. For 192.168.10.77/26, .65–.126 are usable; .64 is the network and .127 is the broadcast. A gateway of .1 is outside that subnet. Check the actual interface mask, gateway, VLAN and routing table before changing anything. Some operating systems support special on-link routes, so this is the ordinary LAN rule rather than every possible configuration.

Separate addressing from other causes

Correct address calculations do not prove the network works. Duplicate IP addresses, the wrong VLAN, an unplugged link, a blocked firewall or missing routes can all cause failure. Compare local configuration first, test the gateway next, then a remote IP and finally a DNS name. A name-only failure suggests DNS rather than subnet math.

Worked example

A: .65/26 → B .130 is remote. B: .130/24 → A .65 looks local. Correct the intended address plan before blaming DNS.

Remember: Calculate the subnet independently for each interface; validate gateway, VLAN and return path.

8Route summarization and longest-prefix matchAdvanced

A summary groups neighborhoods; a more specific route still wins for its own addresses.

Find the shared leading bits

10.20.8.0/24 through 10.20.11.0/24 are four adjacent networks. Their third octets are 00001000, 00001001, 00001010 and 00001011. They share the first six bits of that octet, so the exact summary is 10.20.8.0/22. Its range is 10.20.8.0–10.20.11.255. The start is aligned to a four-octet increment.

Notice extra coverage

10.20.9.0/24 and 10.20.10.0/24 do not form an exact /23 because a /23 starts on an even third octet. Their smallest covering prefix is 10.20.8.0/22, which also covers .8 and .11. Distinguish an exact summary from a covering summary. Advertising addresses you do not actually reach can blackhole traffic; design summary routes and discard routes deliberately.

Choose the most specific matching route

Suppose a routing table has 10.20.0.0/16, 10.20.8.0/22 and 10.20.9.0/24. A packet for 10.20.9.50 matches all three, but /24 is longest and therefore most specific. Route selection for forwarding uses longest-prefix match among installed routes. Administrative distance and metrics help determine which routes are installed; they do not make a less specific installed prefix beat a more specific one.

Worked example

Destination 10.20.9.50 → /16, /22 and /24 match → use 10.20.9.0/24.

Remember: Check shared bits, alignment and extra coverage; the longest matching installed prefix wins.

9Wildcard masks and address matchingAdvanced

A wildcard says which address bits matter and which can be ignored.

Invert a subnet mask

A contiguous wildcard mask is the inverse of the subnet mask: subtract each mask octet from 255. A /26 mask of 255.255.255.192 becomes 0.0.0.63. In a Cisco wildcard match, 0 means the bit must match and 1 means ignore it. This is the opposite role of subnet-mask bits.

Use an aligned base

The match 192.168.10.64 with wildcard 0.0.0.63 includes .64–.127. It includes the network and broadcast addresses too: matching addresses is not allocating host addresses. An all-zero wildcard matches exactly one address. An all-one wildcard ignores every address bit.

Do not assume every wildcard is a subnet

Cisco wildcard masks can be noncontiguous, such as 0.0.0.5, which ignores only selected bits. Such a pattern does not describe a single ordinary CIDR subnet. For contiguous masks in this course, invert the mask, use the aligned network address and check a boundary address to verify your match.

Worked example

/27: 255.255.255.224 → wildcard 0.0.0.31. Base .96 matches .96–.127.

Remember: Wildcard 0 = match; wildcard 1 = ignore. A wildcard match is not a host-capacity calculation.

10VLSM design lab: a small officeProfessional

Build the whole address plan and prove that every team fits.

Collect complete requirements

Use 10.40.0.0/24 for Operations (100 total usable addresses), Sales (50), Guests (20) and two traditional /30 router links. The counts already include gateways and management devices. Operations needs /25, Sales /26, Guests /27, and each link /30. Their block sizes are 128 + 64 + 32 + 4 + 4 = 232 addresses, so they can fit inside the 256-address parent when aligned.

Allocate and document

Allocate Operations at 10.40.0.0/25 with usable .1–.126; Sales at .128/26 with usable .129–.190; Guests at .192/27 with usable .193–.222. Router link 1 is .224/30 with endpoints .225 and .226. Link 2 is .228/30 with endpoints .229 and .230. Their broadcast addresses are .127, .191, .223, .227 and .231 respectively.

Evaluate remaining space and growth

The remaining interval .232–.255 has 24 addresses, but is not a single aligned CIDR block. It can be written as .232/29 and .240/28. If Operations grows to 150 total usable addresses it needs /24, which consumes the entire parent; the existing plan cannot accommodate that requirement without another allocation or redesign. Free address count alone is not enough: block size, contiguity and alignment matter.

Worked example

.0/25 → .128/26 → .192/27 → .224/30 → .228/30. Free: .232/29 and .240/28.

Remember: Count infrastructure and growth, allocate largest first, then check every interval and boundary.

11IPv6 prefixes and subnet IDsAdvanced

IPv6 keeps the prefix idea, but uses much longer addresses and different local-delivery rules.

Read and shorten an IPv6 address

IPv6 has eight 16-bit groups, written in hexadecimal. Leading zeros inside a group can be omitted. One consecutive run of zero groups can be compressed with ::, but :: can appear only once in an address. 2001:0db8:1200:000a:0000:0000:0000:0001 can be written 2001:db8:1200:a::1. Each hex digit represents four bits.

Divide an allocation into /64 LANs

Ordinary IPv6 LANs commonly use /64, especially with SLAAC. A /48 allocation provides 16 subnet bits before the /64 boundary, giving 65,536 /64 subnets. A /56 provides 8 subnet bits, giving 256 /64 subnets. In 2001:db8:1200::/48, the fourth group acts as a /64 subnet ID: 2001:db8:1200:a::/64 is one LAN.

Avoid IPv4 shortcuts

IPv6 has no broadcast address and does not use ARP; Neighbor Discovery uses ICMPv6 and multicast. Do not subtract two to obtain an IPv6 LAN host count or infer a gateway by picking a broadcast-adjacent address. Router links may use /127 and loopbacks /128, which are distinct from the ordinary /64 LAN pattern. The documentation prefix 2001:db8::/32 is for examples, not production addressing.

Worked example

/56 → /64 borrows 8 bits → 2^8 = 256 LAN subnets. No IPv4-style broadcast.

Remember: Count subnet bits in hexadecimal; /64 is the normal SLAAC LAN boundary, not a universal prefix rule.

12Multi-step checks under exam pressureProfessional

Slow down enough to spot the question’s trap, then use a repeatable method.

Separate the requested quantities

A /27 contains 32 addresses, 30 ordinary usable host addresses, and creates eight equal subnets when carved from a /24. These are three different answers. Underline whether a question asks for total addresses, usable hosts, number of subnets, prefix, network, broadcast or an exact summary. Requirements in this course explicitly say whether infrastructure is already counted.

Use a five-step audit

1: Convert the prefix to host bits and block size. 2: Find the aligned block containing the address. 3: Write network and end address. 4: Apply ordinary host exclusions or the /31 and /32 exceptions. 5: Verify that the answer satisfies the requirement. For VLSM, repeat this for every allocation, checking containment and overlap as well as capacity.

Practice reasoning, not recognition

After answering, explain why the adjacent prefix or boundary fails. For a 60-host LAN with 20% growth and one extra gateway, ceil(60 × 1.2) + 1 = 73 usable addresses, requiring /25. /26 provides only 62. A practice score measures these exercises, not readiness for the entire CCNA exam. Review missed topics and confirm important claims in official documentation.

Worked example

60 clients × 1.2 → 72; add gateway → 73; /26 too small → /25.

Remember: Check wording, rounding, exceptions and boundaries; explain why the tempting alternative is wrong.

Pktivo · “packet-ee-vo”

Independent study material, not affiliated with Cisco. CCNA is a Cisco trademark; this course does not guarantee exam readiness.

Pktivo on GitHub
Report bug/Give feedback