Chapter 4 of 27
IPv4 Addressing and Subnetting Mastery
Turn IPv4 from a source of anxiety into a strength by drilling address classes, subnetting, and host calculations until they feel automatic.
IPv4 Addressing and Subnetting Mastery
Why IPv4 Subnetting Matters
IPv4 addressing and subnetting show up everywhere in CCNA and real networks. This module turns them from memorized facts into tools you can think with and apply.
Four Big Questions
You will learn: the structure of an IPv4 address; how Class A, B, C and default masks work; how to compute subnets and hosts from a prefix; and how to design a small addressing plan.
Active Practice Mindset
Treat each example as a mini‑lab: pause, compute the answer yourself, then compare. Repetition here makes exam subnet questions feel routine instead of stressful.
Step 1: IPv4 Address Structure and Notation
IPv4 = 32 Bits
An IPv4 address is a 32‑bit number, usually shown as dotted decimal like `192.168.10.25`. Internally it is four 8‑bit octets, each 0–255.
Binary Representation
`192.168.10.25` in binary is `11000000 10101000 00001010 00011001`. Each octet is an 8‑bit binary number converted to decimal.
Network vs Host Portions
Every IPv4 address has a network portion and a host portion. The subnet mask or prefix length (like `255.255.255.0` or `/24`) defines where the split occurs.
Masks and Prefixes
`255.255.255.0` and `/24` both mean the first 24 bits are network bits and the last 8 bits are host bits. The address itself does not change, only how you interpret its bits.
Step 2: IPv4 Unicast Address Classes and Default Masks
Why Classes Still Matter
Modern networks use CIDR, but CCNA still tests your knowledge of Class A, Class B, and Class C IPv4 unicast address ranges and their default masks.
Class A
Class A: first octet 1–126, default mask `255.0.0.0` or `/8`. Format: Network.Host.Host.Host. Example: `10.5.3.7` is Class A, default `/8`.
Class B
Class B: first octet 128–191, default mask `255.255.0.0` or `/16`. Format: Network.Network.Host.Host. Example: `172.16.99.200` is Class B, default `/16`.
Class C
Class C: first octet 192–223, default mask `255.255.255.0` or `/24`. Format: Network.Network.Network.Host. Example: `192.168.1.20` is Class C, default `/24`.
Step 3: Subnet Masks, Prefix Lengths, and the AND Operation
Mask = Network vs Host Bits
A subnet mask is 1s for network bits followed by 0s for host bits. `/24` is `255.255.255.0`, `/26` is `255.255.255.192`. Prefix length = number of 1s.
Bitwise AND Concept
To find a network address, you bitwise AND the IP with the mask. Only where both bits are 1 does the result bit become 1; otherwise it is 0.
Worked Example `/25`
`192.168.10.130/25`: mask is `255.255.255.128`. Last octet: 130 AND 128 in binary gives 128, so the network address is `192.168.10.128`.
Step 4: Finding Network, Broadcast, and Usable Range
What You Need to Find
Given an IP/prefix, you must quickly find: network address, broadcast address, and first and last usable host addresses in that subnet.
Example 1: /26 on Class C
`192.168.10.77/26`: `/26` → mask 255.255.255.192, block size 64. 77 is in 64–127, so network 192.168.10.64, broadcast 192.168.10.127, usable 65–126.
Example 2: /20 on Class A
`10.1.130.5/20`: mask 255.255.240.0, block size 16 in the third octet. 130 is in 128–143, so network 10.1.128.0, broadcast 10.1.143.255, usable 10.1.128.1–143.254.
Step 5: Calculating Number of Subnets and Hosts
Host Bits and Hosts
Host bits = 32 − prefix length. Hosts per subnet = `2^(host bits) − 2` (subtract 2 for network and broadcast addresses).
Host Count Examples
`/24` → 8 host bits → 254 hosts. `/30` → 2 host bits → 2 hosts. `/29` → 3 host bits → 6 hosts. These sizes appear often on CCNA.
Subnets from Borrowed Bits
Borrowed bits = new prefix − default classful prefix. Subnets = `2^(borrowed bits)`. Example: `/24` to `/26` borrows 2 bits → 4 subnets.
Class C /26 Example
192.168.10.0/24 subnetted as /26: 4 subnets, each with 6 host bits → 62 usable hosts per subnet. Watch whether the exam asks for hosts or subnets.
Step 6: Mental Math Drills for Prefixes and Hosts
Drill 1: /19 Network
Q: For `10.0.0.0/19`, how many host bits and usable hosts? Try: host bits = 32 − 19. Then compute `2^(host bits) − 2`. Check the solution after guessing.
Drill 2: /28 from Class C
Q: 192.168.5.0/24 subnetted as /28. How many subnets and hosts per subnet? Think: borrowed bits = 28 − 24; host bits = 32 − 28.
Drill 3: At Least 50 Hosts
Q: You need at least 50 hosts in a subnet. Which smallest prefix length works? Test `/27`, `/26`, etc., using `2^(host bits) − 2` until you reach ≥ 50.
Quiz 1: Classes, Masks, and Hosts
Check your understanding of classes, masks, and host counts.
You are given the network 172.16.0.0/20. Which statement is TRUE?
- It is a Class C network with 2,046 usable hosts per subnet.
- It is a Class B network, and each /20 subnet has 4,094 usable hosts.
- It is a Class B network, and each /20 subnet has 4,094 subnets inside the Class B block.
- It is a Class A network with 4,094 usable hosts per subnet.
Show Answer
Answer: B) It is a Class B network, and each /20 subnet has 4,094 usable hosts.
172.16.0.0 is Class B (first octet 172, default /16). A /20 has 32 − 20 = 12 host bits, so hosts per subnet = 2^12 − 2 = 4,094. Option 2 correctly states that it is Class B and gives the correct host count. Option 1 is wrong class and host count; option 3 confuses subnets with hosts; option 4 is wrong class.
Step 7: Designing Subnets for a Small Enterprise
Scenario Overview
You have 192.168.10.0/24 and need subnets for VLAN 10 (50 users), VLAN 20 (20), VLAN 30 (10), plus a point‑to‑point link (2 IPs), with minimal waste.
Choose Subnet Sizes
Required sizes: 50 → `/26` (62 hosts); 20 → `/27` (30 hosts); 10 → `/28` (14 hosts); 2 → `/30` (2 hosts). Always map host needs to the smallest suitable prefix.
Allocate from the Start
Start at 192.168.10.0. VLAN 10: 192.168.10.0/26 (usable .1–.62). VLAN 20: 192.168.10.64/27 (usable .65–.94). VLAN 30: 192.168.10.96/28 (usable .97–.110).
Point-to-Point and Leftover
Point‑to‑point: 192.168.10.112/30 (usable .113–.114). Space after .115 remains free for future subnets. Allocate largest subnets first to avoid fragmentation.
Quiz 2: Network, Broadcast, and Range
Test your ability to quickly find network and broadcast addresses.
Which of the following correctly gives the network and broadcast address for the host 10.2.35.200/21?
- Network 10.2.32.0, broadcast 10.2.39.255
- Network 10.2.35.0, broadcast 10.2.35.255
- Network 10.2.0.0, broadcast 10.2.7.255
- Network 10.2.32.0, broadcast 10.2.47.255
Show Answer
Answer: A) Network 10.2.32.0, broadcast 10.2.39.255
/21 → mask 255.255.248.0. The interesting octet is the third: block size = 256 − 248 = 8. The third octet is 35, which is in the 32–39 block (since 32,40,...). So network = 10.2.32.0, broadcast = 10.2.39.255. Option 0 is correct; the others use incorrect ranges.
Step 8: Key IPv4 and Subnetting Flashcards
Flip through these cards to reinforce core IPv4 and subnetting facts that CCNA loves to test.
- How many bits are in an IPv4 address, and how are they usually written?
- IPv4 uses 32 bits. They are usually written in dotted‑decimal notation as four 8‑bit octets, each 0–255, for example 192.168.1.10.
- What is the default mask and prefix length for a Class A IPv4 unicast address?
- Default mask 255.0.0.0, which is prefix length /8.
- What is the default mask and prefix length for a Class B IPv4 unicast address?
- Default mask 255.255.0.0, which is prefix length /16.
- What is the default mask and prefix length for a Class C IPv4 unicast address?
- Default mask 255.255.255.0, which is prefix length /24.
- Formula for usable hosts per IPv4 subnet?
- Usable hosts per subnet = 2^(number of host bits) − 2.
- How do you compute the number of subnets when subnetting a classful network?
- Borrowed bits = new prefix − default classful prefix. Number of subnets = 2^(borrowed bits).
- Quick host counts: /24, /25, /26, /27
- /24 → 254 hosts; /25 → 126 hosts; /26 → 62 hosts; /27 → 30 hosts.
- What is the network address?
- The network address is the address where all host bits are 0. It identifies the subnet itself and is not assigned to a host.
- What is the broadcast address?
- The broadcast address is the address where all host bits are 1. Frames sent to this address are delivered to all hosts on that subnet.
- Given 192.168.1.130/25, what is the network and broadcast address?
- Mask /25 → 255.255.255.128, block size 128. 130 is in 128–255, so network 192.168.1.128, broadcast 192.168.1.255.
Step 9: Design Your Own Addressing Plan
Your Design Challenge
You have 10.10.0.0/24 and need subnets for: User (80 hosts), Management (40), Guest (20), and a WAN link (2 IPs). Design prefixes and ranges.
Plan Prefix Lengths
Decide smallest prefixes that meet each need. Hint: 80 → `/25`, 40 → `/26`, 20 → `/27`, 2 → `/30`. Then allocate from the start without overlaps.
Compare with a Sample Solution
Sample: User 10.10.0.0/25; Management 10.10.0.128/26; Guest 10.10.0.192/27; WAN 10.10.0.224/30. Check your design for correctness and efficiency.
Step 10: Common Exam Traps and Next Practice Steps
Trap 1: Subnets vs Hosts
Use host bits and `2^(host bits) − 2` for hosts per subnet. Use borrowed bits and `2^(borrowed bits)` for number of subnets. Do not mix them up.
Trap 2: Default vs Actual Prefix
Even if a network is "Class C", always calculate using the actual prefix given (like /27), not the default /24, unless the question explicitly says to.
Trap 3: Off‑By‑One Errors
First usable = network + 1; last usable = broadcast − 1. Network and broadcast addresses cannot be assigned to hosts.
Your Next Practice Steps
Expect subnetting items in your next Skarp mock exam. The gap guide and spaced review queue will focus on the mask sizes and patterns you find hardest.
Key Terms
- CIDR
- Classless Inter-Domain Routing, a method of allocating and routing IP addresses using variable-length prefixes instead of fixed address classes.
- octet
- An 8-bit section of an IPv4 address or mask; there are four octets in a 32-bit IPv4 address.
- Class A
- An IPv4 unicast address class with first octet values from 1 to 126 and a default mask of 255.0.0.0 (/8).
- Class B
- An IPv4 unicast address class with first octet values from 128 to 191 and a default mask of 255.255.0.0 (/16).
- Class C
- An IPv4 unicast address class with first octet values from 192 to 223 and a default mask of 255.255.255.0 (/24).
- host bits
- The bits in an IPv4 address that identify individual hosts within a subnet; they are the 0 bits in the subnet mask.
- block size
- In subnetting, the increment between consecutive network addresses in the interesting octet, calculated as 256 minus the mask value in that octet.
- subnet mask
- A 32-bit value that separates the network and host portions of an IPv4 address by using 1 bits for network and 0 bits for host.
- IPv4 address
- A 32-bit logical address used to identify a network interface in an IPv4 network, usually written as four decimal octets (0–255) separated by dots.
- borrowed bits
- Bits taken from the host portion of a classful network to create additional subnets, increasing the prefix length.
- prefix length
- A compact notation for a subnet mask that specifies the number of 1 bits in the mask, written after a slash (for example /24).
- network address
- The first address in an IPv4 subnet, where all host bits are 0; it identifies the subnet itself and is not assigned to a host.
- broadcast address
- The last address in an IPv4 subnet, where all host bits are 1; packets sent to this address are delivered to all hosts on the subnet.
- usable host range
- The set of IPv4 addresses in a subnet that can be assigned to interfaces, from network+1 to broadcast−1.