Packet Flipper
IPv4 Addressing

IPv4 Addressing

This is one of the most critical objectives on the entire exam. CompTIA will expect you to look at an IP address and instantly know if it’s public or private, what class it belongs to, and how to read its subnet mask.

Let’s break IPv4 network addressing down into simple, easy-to-understand concepts.

1. Public vs. Private IP Addresses

An IP address is like a phone number. However, the world is divided into two types of numbers: internal corporate extensions and global public numbers.

RFC 1918 (The Private IP Rules)

Because the world ran out of unique IPv4 addresses, a rule called RFC 1918 was created. It sets aside three specific blocks of IP addresses that anyone can use for free inside their own private home or corporate networks. These private addresses cannot route across the public internet.

You must memorize these three private blocks for the exam:

  • Class A Private Range: 10.0.0.0 to 10.255.255.255
  • Class B Private Range: 172.16.0.0 to 172.31.255.255
  • Class C Private Range: 192.168.0.0 to 192.168.255.255

Real-World Connection: Any IP address not in these ranges (or the special categories below) is a Public IP address, which is unique globally and routable on the internet.

APIPA (Automatic Private IP Addressing)

  • What it is: If your computer is set to obtain an IP address automatically from a DHCP server, but the DHCP server is down or broken, your computer will give up and assign itself an APIPA address.
  • The Range: Always starts with 169.254.X.X
  • What it means: If you see a device with a 169.254 IP, it means: “I can talk to other machines in my immediate room who also failed to find the DHCP server, but I cannot talk to the gateway or get on the internet.”

Loopback / Localhost

  • What it is: A special internal address that a computer uses to communicate with itself for testing purposes.
  • The Range: Always starts with 127.X.X.X (most commonly 127.0.0.1).
  • Simple Example: If you open a command prompt and type ping 127.0.0.1, you are testing your own computer’s network card. If the ping succeeds, your computer’s network software stack is working properly.

2. IPv4 Address Classes

Before modern subnetting, the internet was divided into five strict buckets, or “classes,” based on the first octet (the first block of numbers) of the IP address.

Here is the breakdown you need to memorize:

ClassFirst Octet RangePurpose / DesignDefault Subnet Mask
Class A1 to 126Designed for massive global organizations. Provides a few networks, each with millions of hosts.255.0.0.0 (/8)
Special127Reserved strictly for loopback/testing; cannot be assigned to hosts.N/A
Class B128 to 191Designed for medium-to-large-sized companies.255.255.0.0 (/16)
Class C192 to 223Designed for small businesses and home networks. Provides many networks, each with up to 254 hosts.255.255.255.0 (/24)
Class D224 to 239Multicast traffic (sending data to a group of subscribed devices simultaneously). No subnet masks are used here.N/A
Class E240 to 255Reserved strictly for experimental, research, and future testing purposes.N/A

3. Subnetting (Slicing the Pie)

Subnetting is the process of dividing a single large network block into smaller, isolated subnets to increase security and reduce broadcast traffic.

CIDR (Classless Inter-Domain Routing)

In the old days, if you had a Class C network, you were stuck with a default subnet mask of 255.255.255.0. CIDR got rid of strict classes and introduced an easier notation using a forward slash (/) followed by the number of bits turned “on” in the mask.

  • Instead of writing: 192.168.1.5 with a mask of 255.255.255.0
  • CIDR writes it as: 192.168.1.5/24

Every octet in an IP address consists of 8 bits (8 \times 4 = 32 total bits).

  • A /8 means the first 8 bits are locked (255.0.0.0)
  • A /16 means the first 16 bits are locked (255.255.0.0)
  • A /24 means the first 24 bits are locked (255.255.255.0)

VLSM (Variable Length Subnet Mask)

  • What it is: The advanced practice of subnetting a subnet. It allows an engineer to use different subnet masks across the same corporate network so that IP addresses aren’t wasted.
  • Simple Example: Imagine you have a pizza (a /24 network).
    • The Accounting department has 50 users, so you cut them a large slice (/26).
    • The Marketing department has 10 users, so you cut them a small slice (/28).
    • The WAN link connecting two routers only needs 2 usable IP addresses, so you cut a tiny sliver (/30).
    • Without VLSM, you would have to give every single department a huge /24 block, wasting thousands of available addresses.

Quick Math Formula for the Exam

When finding how many usable host IPs are available in any given subnet size, use this formula:

2^h – 2

Where h is the number of remaining “host bits” (32 minus your CIDR number). We subtract 2 because the first IP in a subnet is the Network ID, and the last IP is the Broadcast ID; neither can be assigned to a real device.

  • Example for a /28 network:
    • Remaining host bits: 32 – 28 = 4 bits.
    • 2^4 = 16.
    • 16 – 2 = \mathbf{14\text{ usable host IPs}}.

Checkpoint Quiz

Let’s make sure this clicked. Look at these three IP addresses. Are they Public, Private, or APIPA?

  1. 10.15.204.5
  2. 169.254.88.12
  3. 8.8.8.8