No history yet

IP Address Basics

The Internet's Address System

Every device connected to the internet needs a unique address, just like every house on a street needs a unique number. In the world of computer networks, this is called an Internet Protocol (IP) address. It’s how devices find and communicate with each other across the globe.

The most common format you'll see is IPv4, which looks like this: 192.168.1.1. It consists of four numbers separated by dots. Each number is called an octet and can range from 0 to 255. Under the hood, these numbers are actually 8-bit binary numbers, meaning an IPv4 address is a 32-bit number in total.

For example, the IP address 172.16.254.1 in binary is 10101100.00010000.11111110.00000001.

Lesson image

Network and Host Portions

An IP address isn't just one long, random number. It's split into two distinct parts: the network portion and the host portion.

Think of the street address analogy again. If your address is 123 Main Street, "Main Street" is the network, and "123" is the specific house, or host, on that street. Similarly, the network portion of an IP address identifies the specific network a device is on, while the host portion identifies the individual device on that network.

Devices on the same network can talk to each other directly. But to communicate with a device on a different network, they need a router to forward the message.

But how does a device know which part is which? That’s where the subnet mask comes in.

The Role of the Subnet Mask

A subnet mask is a 32-bit number that looks like an IP address (e.g., 255.255.255.0). Its only job is to tell a computer which part of an IP address is the network portion and which is the host portion.

Here's how it works in binary:

  • The 1s in the subnet mask correspond to the network portion.
  • The 0s in the subnet mask correspond to the host portion.

Let’s take the subnet mask 255.255.255.0. In binary, it's: 11111111.11111111.11111111.00000000

When you apply this mask to an IP address like 192.168.1.100, the first 24 bits (the first three octets) are identified as the network portion, and the last 8 bits (the final octet) are the host portion.

  • Network Portion: 192.168.1
  • Host Portion: 100

The Old Way: Classful Addressing

In the early days of the internet, IP addresses were grouped into categories called classes. This system, known as classful addressing, used the first few bits of an IP address to determine its class (A, B, or C). Each class had a fixed, default subnet mask.

This meant the network and host portions were predetermined.

ClassFirst Octet RangeDefault Subnet MaskNetwork/Host Bits
Class A1 - 126255.0.0.08 network / 24 host
Class B128 - 191255.255.0.016 network / 16 host
Class C192 - 223255.255.255.024 network / 8 host

Classful addressing was simple, but incredibly wasteful. For example, if an organization needed 300 IP addresses, it couldn't use a Class C network, which only offered 254 usable host addresses. It would have to be assigned a Class B network, which provided over 65,000 host addresses. This left tens of thousands of IP addresses unused and wasted.

This rigidity and inefficiency became a major problem as the internet grew. A more flexible system was needed to allocate IP addresses more precisely, which led to the development of a new standard.