IP Addressing & Classes

RoadmapsCore CS

Scenario

You want to mail a letter, but instead of '123 Main St, New York', you only have 'House 123'. Without the city and street, the post office has no idea where to send it. IP addresses solve this same problem for the internet.

Overview

IP addressing is the system that assigns unique numeric identifiers to devices on a network.

It is essential for devices to locate and communicate with each other across the global internet.

Where used: Networking, System Administration, Web Development

Why learn this

Mental model

An IP address is a postal address for a computer, with classes acting as different sized zip codes.

Every device on a network needs a unique identifier to send and receive data. An IP address provides this identity, split into a 'network' portion (the city/zip code) and a 'host' portion (the specific house). Historically, 'Classes' determined exactly where the line between network and house was drawn, allocating big chunks of addresses to massive corporations and smaller chunks to local networks.

Explanation

An IP (Internet Protocol) address is a numerical label assigned to every device connected to a computer network. In IPv4, this address is 32 bits long, typically written as four decimal numbers separated by dots (like 192.168.1.5). This simple set of numbers is the fundamental building block of internet communication, allowing data packets to find their way from a server across the world straight to your specific smartphone.

To make routing efficient, an IP address is logically divided into two parts: a Network ID and a Host ID. The Network ID identifies the specific network (like a neighborhood), and the Host ID identifies the exact device on that network (like a house). When a router receives a packet, it first looks only at the Network ID to forward the packet to the correct general area. Only when the packet reaches the destination network does the final router use the Host ID to deliver it to the specific computer.

In the early days of the internet, this division was rigidly structured into 'Classes'. The creators realized that some organizations (like massive universities or corporations) would need millions of host addresses, while others (like a small office) would only need a few hundred. To accommodate this, they defined Class A, B, C, D, and E based on the first few bits of the IP address.

Class A networks used the first 8 bits for the network and 24 bits for the hosts, allowing for over 16 million devices per network—perfect for tech giants but highly wasteful. Class B split it evenly, 16 bits for network and 16 for hosts. Class C used 24 bits for the network and only 8 bits for hosts, allowing just 254 devices. This rigid system, known as Classful Addressing, eventually proved too inflexible and wasteful because an organization needing 300 addresses had to be given a Class B network (wasting 65,000 addresses).

While Classful Addressing has largely been replaced by more flexible systems like CIDR today, understanding it is critical. It forms the historical foundation of how routers were originally designed to read addresses, and the concepts of 'network' versus 'host' portions remain universally true. Private IP ranges (like your home's 192.168.x.x) are still directly derived from this class-based history.

Key points

Common mistakes

Glossary

IP addressing
The system of giving every single device on a network a unique digital 'home address' so data knows exactly where to go.
IPv4
The older, classic version of internet addresses that uses four numbers separated by dots (like 192.168.1.1).
routing
The process of finding the best and fastest path through the internet''s maze of wires to send data from its source to its destination.

Recall questions

Questions & answers

Given the IP address 192.168.1.50, what class does this belong to, and is it a public or private address?

It belongs to Class C and is a private IP address.

Approach: The first octet '192' falls in the Class C range (192-223). The specific block 192.168.x.x is designated as a private IP space, meaning it is non-routable on the public internet.

An organization needs a network that can support 1,000 devices. Under strict classful addressing, which class of network must they be assigned, and how many addresses are wasted?

They must be assigned a Class B network. About 64,534 addresses are wasted.

Approach: Class C only supports 254 devices, which is too small. Class B supports 65,534 devices. Assigning a Class B network for 1,000 devices wastes exactly 65,534 - 1,000 = 64,534 addresses, highlighting the inefficiency of classful routing.

Continue learning

Next: Subnetting & CIDR

Next: IPv4 vs IPv6

Return to Core CS Roadmap