Overview
IPv4 addressing and subnetting underpin every CCNA troubleshooting scenario. This guide covers classful history, private ranges, CIDR, VLSM context, wildcard masks, and hex math for MAC/IPv6 work.
IPv4 fundamentals
An IPv4 address is a 32-bit number written as four decimal octets separated by dots. Each octet ranges from 0 to 255 (8 bits). Example: 192.168.10.45 = 11000000.10101000.00001010.00101101 in binary.
Every routed interface needs a unique IP address within its subnet. The combination of IP address + subnet mask (or prefix length) defines which network the host belongs to and which bits identify the host portion.
Subnet mask bits set to 1 = network portion. Bits set to 0 = host portion. A /24 mask (255.255.255.0) means the first 24 bits are network, last 8 bits are host — 254 usable hosts per subnet.
Classful addressing — historical context
Before CIDR (1993), IPv4 used classful addressing. The first bits of the address determined the class and default mask. CCNA still tests this because legacy terminology persists in documentation and older routing protocols.
| Class | First bits | Default mask | Network range | Networks | Hosts per network |
|---|---|---|---|---|---|
| A | 0 | /8 (255.0.0.0) | 1.0.0.0 – 126.0.0.0 | 126 | ~16.7 million |
| B | 10 | /16 (255.255.0.0) | 128.0.0.0 – 191.255.0.0 | 16,384 | 65,534 |
| C | 110 | /24 (255.255.255.0) | 192.0.0.0 – 223.255.0.0 | ~2.1 million | 254 |
| D | 1110 | None (multicast) | 224.0.0.0 – 239.255.255.255 | — | — |
| E | 1111 | None (reserved) | 240.0.0.0 – 255.255.255.255 | — | — |
Reserved within Class A:
0.0.0.0/8— "this network" (not valid host addresses)127.0.0.0/8— loopback (127.0.0.1 is localhost)
Classful boundaries still matter for RIP auto-summary and historical questions. Modern networks use CIDR — never assume a /24 just because the address "looks Class C."
RFC 1918 private address ranges
Private addresses are not routable on the public Internet. Organizations reuse them internally and translate at the edge with NAT.
| Class | Private range | CIDR notation |
|---|---|---|
| A | 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 |
| B | 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 |
| C | 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 |
Other special-use ranges (know for CCNA):
| Range | Purpose |
|---|---|
| 127.0.0.0/8 | Loopback |
| 169.254.0.0/16 | Link-local (APIPA — no DHCP) |
| 224.0.0.0 – 239.255.255.255 | IPv4 multicast (Class D) |
| 255.255.255.255 | Limited broadcast |
CIDR and VLSM
CIDR (Classless Inter-Domain Routing) replaced rigid class boundaries. The prefix length (/n) tells you exactly how many bits are the network portion.
Examples:
192.168.1.0/24— 256 addresses, 254 usable hosts192.168.1.0/25— 128 addresses, 126 usable hosts192.168.1.0/26— 64 addresses, 62 usable hosts192.168.1.0/30— 4 addresses, 2 usable hosts (common for point-to-point links)
VLSM (Variable Length Subnet Masking) means different subnets in the same network can use different prefix lengths. A /24 can be split into two /25s, four /26s, etc. — design subnets to match actual host counts.
Worked example — /27 subnet
Network: 192.168.1.128/27 (mask 255.255.255.224)
- Subnet size: 32 addresses (2^5 host bits)
- Network address: 192.168.1.128
- First usable host: 192.168.1.129
- Last usable host: 192.168.1.158
- Broadcast: 192.168.1.159
Host 192.168.1.130/27 falls in this range — valid host.
Use the on-site Subnetting trainer for timed drills. Jeremy's IT Lab Subnetting Mastery playlist pairs well with repetition until /24 through /30 calculations are automatic.
Prefix notation quick reference
| Prefix | Subnet mask | Hosts per subnet | Typical use |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 | Large enterprise (10/8) |
| /16 | 255.255.0.0 | 65,534 | Campus |
| /24 | 255.255.255.0 | 254 | Department VLAN |
| /25 | 255.255.255.128 | 126 | Split /24 |
| /26 | 255.255.255.192 | 62 | Small department |
| /27 | 255.255.255.224 | 30 | Small team |
| /28 | 255.255.255.240 | 14 | Point services |
| /30 | 255.255.255.252 | 2 | Router-to-router WAN |
| /32 | 255.255.255.255 | 1 | Host route / loopback |
Binary math — the subnetting foundation
To subnet quickly, convert between decimal, binary, and (for MAC/IPv6) hexadecimal.
Example: Is 10.50.1.100 in the same subnet as 10.50.1.200 with mask /25?
- /25 = 255.255.255.128 — the split is in the fourth octet
- 100 = 01100100 → network bit is 0 → subnet .0
- 200 = 11001000 → network bit is 1 → subnet .128
- Different subnets — they need a router to communicate
Four questions every subnetting problem asks:
- What is the network address?
- What is the broadcast address?
- What is the range of valid hosts?
- What is the subnet mask?
Hexadecimal for networking
Hexadecimal (base 16) uses digits 0–9 and letters A–F. One hex digit represents 4 bits (one nibble). Two hex digits = one byte (8 bits).
| Decimal | Binary | Hex |
|---|---|---|
| 0 | 0000 | 0 |
| 10 | 1010 | A |
| 15 | 1111 | F |
| 16 | 0001 0000 | 10 |
| 255 | 1111 1111 | FF |
Conversion shortcut: Decimal → Binary → group binary into 4-bit nibbles → Hex.
IPv4 in hex
10.1.1.1 → 0A.01.01.01
- 10 decimal = 00001010 binary = 0A hex
- 1 decimal = 00000001 binary = 01 hex
224.1.2.3 → E0.01.02.03
MAC addresses
MAC addresses are 48 bits, written as six hex octets separated by colons or dashes:
00:1A:2B:3C:4D:5E
- First 3 octets (OUI) = manufacturer
- Last 3 octets = device-specific
- Unicast: last bit of first octet = 0
- Multicast: last bit of first octet = 1
IPv6 addresses
IPv6 uses 128 bits written as eight groups of four hex digits:
2001:0DB8:0000:0000:0000:0000:0000:0001
Shortening rules:
- Leading zeros in each group can be dropped:
2001:DB8:0:0:0:0:0:1 - One consecutive run of all-zero groups can be replaced with
::(once per address):2001:DB8::1
You will not configure IPv6 from scratch on every CCNA question, but you must read MAC addresses, recognize IPv6 shortened notation, and convert simple decimal octets to hex when troubleshooting.
Subnet design workflow
Designing subnets for a site with Sales (40 hosts), Engineering (80 hosts), and Guest Wi-Fi (200 clients):
- Size each subnet — add growth margin, round up to power of 2
- Sales: 40 → need 64 (/26)
- Engineering: 80 → need 128 (/25)
- Guest: 200 → need 256 (/24)
- Assign from a parent block — e.g., 10.10.0.0/16
- Sales: 10.10.10.0/26
- Engineering: 10.10.20.0/25
- Guest: 10.10.30.0/24
- Document network, first host, last host, broadcast for each
- Assign gateway — typically .1 on each subnet
Commands to verify addressing
show ip interface brief show running-config interface GigabitEthernet0/0 show ip route connected
! Windows ipconfig /all
! Linux / macOS ip addr show
Troubleshooting addressing issues
| Symptom | Likely cause |
|---|---|
| 169.254.x.x (APIPA) | DHCP failure — check server, relay, VLAN |
| Duplicate IP detected | Two hosts with same address |
| Can reach local, not remote | Wrong mask, missing gateway, or routing issue |
| VPN tunnel fails | Overlapping private ranges on both sides |
Exam checklist
- List RFC 1918 ranges in both dotted-decimal and CIDR form
- Explain classful vs classless addressing
- Calculate network, broadcast, and host range for any /24–/30
- Convert decimal octets to hex (for MAC and IPv6 context)
- Read and shorten IPv6 addresses
- Complete 10 timed problems on the subnetting trainer