IPv4 addressing, subnetting, and private address space

Cisco CCNA Preparation · lesson 5 of 36 · 25 min

IPv4 Address Structure

An IPv4 address is a 32-bit number written as four octets in dotted-decimal notation (e.g. 192.168.1.10). Each octet is 8 bits (0–255). Every IP address has two parts: the network portion (identifies the network) and the host portion (identifies the device on that network). The subnet mask defines where the split is.

Private address ranges (RFC 1918)

10.0.0.0/8 · 172.16.0.0/12 · 192.168.0.0/16 — not routable on the public internet; used inside LANs.

Subnet Mask and CIDR

A subnet mask uses 1s to mark the network bits and 0s for host bits. CIDR notation (Classless Inter-Domain Routing) expresses this as a prefix length — the number of 1 bits. /24 = 255.255.255.0 = 24 network bits, 8 host bits.

Usable hosts formula

Usable hosts = 2ⁿ − 2 where n = number of host bits. Subtract 2 for the network address (all host bits 0) and broadcast address (all host bits 1).

Subnetting Worked Example

Problem: You have the network 192.168.10.0/24 and need 4 subnets. What prefix do you use?

Step 1: You need at least 4 subnets → borrow 2 bits (2² = 4). New prefix = /24 + 2 = /26.

Step 2: Host bits remaining = 32 − 26 = 6. Usable hosts = 2⁶ − 2 = 62 per subnet.

Step 3: Block size = 256 − 192 = 64. Subnets:

Special Addresses

Flashcard Drill

/24 subnet mask 255.255.255.0 — 8 host bits — 254 usable hosts. /26 subnet mask 255.255.255.192 — 6 host bits — 62 usable hosts. /30 subnet mask 255.255.255.252 — 2 host bits — 2 usable hosts (point-to-point links). Usable hosts formula 2ⁿ − 2 where n = host bits. Subtract 2 for network and broadcast. 127.0.0.1 Loopback address — tests local TCP/IP stack. APIPA 169.254.x.x — auto-assigned when DHCP fails. RFC 1918 private ranges 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 — not routable on the internet. CIDR Classless Inter-Domain Routing — expresses subnet mask as prefix length (/24, /26, etc.). Network address First address in a subnet — all host bits are 0. Cannot be assigned to a host. Broadcast address Last address in a subnet — all host bits are 1. Cannot be assigned to a host.

Knowledge Check

IPv4 & Subnetting — 10 Questions

How many usable host addresses does a /26 subnet provide?

  • 64
  • 62
  • 30
  • 126

Answer: 62
/26 has 6 host bits. 2⁶ − 2 = 62 usable hosts.

What is the subnet mask for /27?

  • 255.255.255.192
  • 255.255.255.224
  • 255.255.255.240
  • 255.255.255.248

Answer: 255.255.255.224
/27 = 27 network bits. Last octet: 11100000 = 224. Mask = 255.255.255.224.

192.168.1.0 is a valid host address in the 192.168.1.0/24 subnet.

  • True
  • False

Answer: False
192.168.1.0 is the network address (all host bits = 0) — it cannot be assigned to a host.

The loopback address used to test the local TCP/IP stack is _____.

Answer: 127.0.0.1
127.0.0.1 is the loopback address — traffic never leaves the device.

Which address range is assigned automatically when DHCP fails?

  • 10.0.0.0/8
  • 172.16.0.0/12
  • 169.254.0.0/16
  • 192.168.0.0/16

Answer: 169.254.0.0/16
APIPA (Automatic Private IP Addressing) assigns 169.254.x.x when DHCP is unavailable.

You need a subnet for a point-to-point WAN link (2 hosts only). Which prefix is most efficient?

  • /28
  • /29
  • /30
  • /31

Answer: /30
/30 provides exactly 2 usable host addresses — perfect for point-to-point links.

Which class of IPv4 address has a default mask of /8?

  • Class A
  • Class B
  • Class C
  • Class D

Answer: Class A
Class A (1–126) has a default /8 mask (255.0.0.0).

The network 192.168.5.0/24 is divided into /26 subnets. How many subnets are created?

  • 2
  • 4
  • 6
  • 8

Answer: 4
Borrowing 2 bits from /24 to get /26 creates 2² = 4 subnets.

10.0.0.0/8 is a private address range not routable on the public internet.

  • True
  • False

Answer: True
10.0.0.0/8 is one of three RFC 1918 private ranges — not routable on the internet.

The formula for usable hosts in a subnet is 2ⁿ − _____ where n is the number of host bits.

Answer: 2
Subtract 2 for the network address and broadcast address.


Previous lesson: Ethernet fundamentals: CSMA/CD, MAC addresses, frame format, duplex, speed
Back to Cisco CCNA Preparation
Next lesson: IPv6 addressing, prefix notation, and address types (unicast, anycast, multicast, EUI-64)