Ko-fiSupport
Guides2026-11-08•10 min read

IPv4 Addressing, Binary Octet Math & CIDR Prefix Notation Explained for CCNA

B

BrainyTools Editor

Tech Contributor at BrainyTools

IPv4 Addressing, Binary Octet Math & CIDR Prefix Notation Explained for CCNA

On the Cisco CCNA exam, you do not get a calculator—which means fast binary-to-decimal mental math and a 30-second scratchpad CIDR chart are your greatest exam-day advantages.


Every IPv4 address defined by IETF RFC 791 is a 32-bit binary number divided into four 8-bit bytes called octets and written in dotted-decimal notation (for example, 192.168.10.100).

To routers and hosts, however, dotted-decimal numbers do not exist—devices evaluate network boundaries using 32-bit binary masks (Classless Inter-Domain Routing / CIDR, standardized in IETF RFC 4632).

In this guide, we break down the positional binary math of an 8-bit octet, how CIDR prefix lengths (/8 through /32) divide network bits from host bits, the exact formulas for usable hosts and wildcard masks, and how to verify your calculations with our IPv4 Subnet Calculator, Number Base Converter, and Web Packet Tracer.


1. The 8-Bit Binary Octet & Subnet Mask Values

Each of the four octets in an IPv4 address contains 8 bits, giving $2^8 = 256$ possible values (0 through 255). Each bit position represents a power of 2 from $2^7$ (128) down to $2^0$ (1):

Bit Position $2^7$ $2^6$ $2^5$ $2^4$ $2^3$ $2^2$ $2^1$ $2^0$
Positional Value 128 64 32 16 8 4 2 1

Why Only 9 Octet Values Can Ever Appear in a Valid Subnet Mask

Per RFC 4632, a valid IPv4 subnet mask always consists of a contiguous sequence of binary 1s (representing the Network / Prefix portion) followed by a contiguous sequence of binary 0s (representing the Host portion) from left to right.

Because the 1s must be contiguous starting from the leftmost bit ($128$), an octet in a valid subnet mask can only take one of 9 possible decimal values:

Contiguous 1 Bits in Octet Binary Octet Decimal Mask Value Block Size (Increment = $256 - \text{Mask}$) Wildcard Octet ($255 - \text{Mask}$)
0 bits 00000000 0 — 255
1 bit 10000000 128 128 127
2 bits 11000000 192 ($128+64$) 64 63
3 bits 11100000 224 ($192+32$) 32 31
4 bits 11110000 240 ($224+16$) 16 15
5 bits 11111000 248 ($240+8$) 8 7
6 bits 11111100 252 ($248+4$) 4 3
7 bits 11111110 254 ($252+2$) 2 1
8 bits 11111111 255 ($254+1$) 1 0

(If you attempt to configure a non-contiguous mask such as 255.255.255.200 on a Cisco router interface in Web Packet Tracer, IOS rejects it with % Bad mask!)


2. CIDR Prefix Cheat Sheet (/24 to /32)

Given a CIDR prefix length /P (where $P$ is the number of network bits out of 32), the number of remaining host bits is $h = 32 - P$:

  • Total IPv4 Addresses in Subnet: $2^h$
  • Usable Host IPv4 Addresses (for /1 to /30): $2^h - 2$
    • First address (all host bits = 0): Reserved as the Network ID.
    • Last address (all host bits = 1): Reserved as the Directed Broadcast Address.
CIDR Prefix Dotted-Decimal Subnet Mask Wildcard Mask Host Bits ($h$) Total IPs ($2^h$) Usable Hosts ($2^h - 2$) Common CCNA Use Case
/24 255.255.255.0 0.0.0.255 8 256 254 Standard LAN / VLAN subnet
/25 255.255.255.128 0.0.0.127 7 128 126 Medium floor / department LAN
/26 255.255.255.192 0.0.0.63 6 64 62 Small branch office LAN
/27 255.255.255.224 0.0.0.31 5 32 30 Server / management subnet
/28 255.255.255.240 0.0.0.15 4 16 14 Small DMZ or printer VLAN
/29 255.255.255.248 0.0.0.7 3 8 6 WAN edge with FHRP (HSRP/VRRP)
/30 255.255.255.252 0.0.0.3 2 4 2 Point-to-point router link
/31 255.255.255.254 0.0.0.1 1 2 2 (RFC 3021 P2P only) Point-to-point link without broadcast
/32 255.255.255.255 0.0.0.0 0 1 1 (Host route) Loopback interface / Host route

3. Step-by-Step Example: Solving Any Subnet Problem in 30 Seconds

Suppose a CCNA exam question asks:

"A host is assigned the IPv4 address 172.16.35.140/26. What are the Network ID, First Usable Host, Last Usable Host, and Broadcast Address of this subnet?"

  1. Find the "Interesting Octet":
    • /26 has $26$ network bits: 8 + 8 + 8 + 2 = 26.
    • The first three octets (172.16.35) are all 255 (11111111), so they remain unchanged: 172.16.35.x.
    • The 4th octet has 2 network bits (11000000 = 192).
  2. Calculate the Block Size (Increment):
    • $\text{Block Size} = 256 - 192 = \mathbf{64}$ (or $2^{8-2} = 2^6 = 64$).
  3. List the Multiples of the Block Size up to 140:
    • The /26 subnets in the 4th octet start at multiples of 64:
      0, 64, 128, 192
    • Because 140 falls between 128 and 192, this host belongs to the .128 subnet, and the next subnet starts at .192.
  4. Write Down All Four Attributes Immediately:
    • Network ID: 172.16.35.128
    • First Usable Host ($\text{Network} + 1$): 172.16.35.129
    • Broadcast Address ($\text{Next Subnet} - 1$): 172.16.35.191
    • Last Usable Host ($\text{Broadcast} - 1$): 172.16.35.190

Check this exact calculation in the BrainyTools IPv4 Subnet Calculator by entering 172.16.35.140 and selecting /26!


4. RFC 1918 Private IPv4 Ranges vs. Special Reserved Blocks

Not all IPv4 addresses are publicly routable on the global internet. Every CCNA candidate must memorize the RFC 1918 Private IPv4 address blocks alongside key special-purpose ranges (RFC 6890):

Address Block (CIDR) Address Range RFC Standard Purpose
10.0.0.0/8 10.0.0.0 – 10.255.255.255 RFC 1918 Private Class A block (1 single /8 block)
172.16.0.0/12 172.16.0.0 – 172.31.255.255 RFC 1918 Private Class B block (16 contiguous /16 blocks)
192.168.0.0/16 192.168.0.0 – 192.255.255.255 RFC 1918 Private Class C block (256 contiguous /24 blocks)
127.0.0.0/8 127.0.0.0 – 127.255.255.255 RFC 1122 Loopback testing (127.0.0.1 local TCP/IP stack check)
169.254.0.0/16 169.254.0.0 – 169.254.255.255 RFC 3927 Link-Local / APIPA (auto-assigned when DHCP fails)

You can compare how public IPv4 blocks resolve to Autonomous System Numbers (ASNs) and ISP locations versus private RFC 1918 addresses using our IP Address Lookup & Geolocation Visualizer.


5. Legitimate Sources & Standards References

  • IETF RFC 791: Internet Protocol — DARPA Internet Program Protocol Specification (September 1981).
  • IETF RFC 1918: Address Allocation for Private Internets (Y. Rekhter et al., February 1996).
  • IETF RFC 4632: Classless Inter-domain Routing (CIDR): The Internet Address Assignment and Aggregation Plan (V. Fuller, T. Li, August 2006).
  • IETF RFC 3927: Dynamic Configuration of IPv4 Link-Local Addresses (May 2005).
  • Cisco CCNA 200-301 Exam Topics (v1.1): Domain 1.0 Network Fundamentals (1.6 Configure and verify IPv4 addressing and subnetting; 1.7 Describe the need for private IPv4 addressing).

6. CCNA 200-301 Exam Prep: Questions & Detailed Answers

Question 1

A network administrator configures a router interface with ip address 10.20.30.100 255.255.255.224. Wait—when a PC on that LAN is configured with IP 10.20.30.95/27 and Default Gateway 10.20.30.100, the PC cannot reach the gateway. Why?

  • A. 10.20.30.100 is the broadcast address of the /27 subnet.
  • B. 10.20.30.95/27 and 10.20.30.100/27 are in two different /27 subnets!
  • C. 255.255.255.224 is not a valid subnet mask.
  • D. 10.20.30.0/24 cannot be subnetted with a /27 mask.

Correct Answer: B
Explanation: A /27 mask (255.255.255.224) has a block size of $256 - 224 = 32$. The /27 subnets in the 4th octet start at .0, .32, .64, .96, .128.

  • The .64/27 subnet runs from .64 (Network ID) to .95 (Broadcast Address)! Not only is 10.20.30.95 in the .64/27 subnet (while 10.20.30.100 is in the .96/27 subnet, range .97–.126), .95 is also the broadcast address of the .64/27 block. To communicate with gateway 10.20.30.100/27, the PC must be assigned a usable host IP between 10.20.30.97 and 10.20.30.126.

Question 2

Which CIDR prefix length and dotted-decimal subnet mask provide the most efficient addressing for a point-to-point serial or Ethernet WAN link between two routers that requires exactly 2 usable host IPv4 addresses (excluding RFC 3021 /31)?

  • A. /28 (255.255.255.240)
  • B. /29 (255.255.255.248)
  • C. /30 (255.255.255.252)
  • D. /32 (255.255.255.255)

Correct Answer: C
Explanation: A /30 prefix (255.255.255.252) leaves $32 - 30 = 2$ host bits. That provides $2^2 = 4$ total addresses and $2^2 - 2 = \mathbf{2}$ usable host addresses—one for each router interface on the point-to-point link, wasting zero host addresses.


Question 3

Which of the following IPv4 addresses is a valid RFC 1918 Private IPv4 address?

  • A. 172.32.10.1
  • B. 172.31.255.1
  • C. 192.169.1.1
  • D. 169.254.10.20

Correct Answer: B
Explanation: The RFC 1918 Class B private range is 172.16.0.0/12, which covers 172.16.0.0 through 172.31.255.255. Therefore, 172.31.255.1 (Option B) is inside the RFC 1918 private block, whereas 172.32.10.1 (Option A) is a public IPv4 address! 169.254.10.20 (Option D) is an RFC 3927 APIPA link-local address, not an RFC 1918 address.


Question 4

What is the Cisco IOS wildcard mask that corresponds to the subnet mask 255.255.252.0 (/22)?

  • A. 0.0.3.255
  • B. 0.0.2.255
  • C. 0.0.4.255
  • D. 0.0.252.255

Correct Answer: A
Explanation: To calculate the inverse (wildcard) mask from a subnet mask, subtract each octet from 255:

  • 255 - 255 = 0
  • 255 - 255 = 0
  • 255 - 252 = 3
  • 255 - 0 = 255
    Result: 0.0.3.255.

Question 5

How many total /26 subnets can be created by subnetting a single /24 network block (such as 192.168.1.0/24), and how many usable hosts exist per /26 subnet?

  • A. 2 subnets, 126 usable hosts each
  • B. 4 subnets, 62 usable hosts each
  • C. 4 subnets, 64 usable hosts each
  • D. 8 subnets, 30 usable hosts each

Correct Answer: B
Explanation: Moving from /24 to /26 borrows $s = 26 - 24 = 2$ subnet bits, creating $2^2 = \mathbf{4}$ subnets (.0/26, .64/26, .128/26, and .192/26). Each /26 has $h = 32 - 26 = 6$ host bits, giving $2^6 - 2 = 64 - 2 = \mathbf{62}$ usable hosts per subnet.

Related Videos

Enjoyed this article?

Check out our suite of free online developer tools to boost your productivity even further. 100% Privacy Focused.

Explore Tools