How IP Addresses Work: Network & Host IDs, Classes, and Subnetting
This article explains the fundamentals of IP addressing, detailing how network and host IDs identify devices, the classification of IP addresses into classes A through E, their binary prefixes and numeric ranges, and introduces subnetting concepts such as subnet masks and dividing networks into smaller segments.
Basic composition of IP address
In the network layer, data is transmitted to a destination using an IP address. To correctly deliver data, IP addresses follow rules that identify the host's location.
Network ID and Host ID
Each IP address consists of two parts: network ID and host ID. All hosts on the same physical network share the same network ID, while each host has a unique host ID.
Network ID: identifies the network; the number of bits determines how many networks can be allocated.
Host ID: identifies the host within the network; the number of bits determines the maximum number of hosts.
IP address classes and formats
Large networks contain many hosts, small networks contain few. Different scenarios require different numbers of hosts, so IP addresses must indicate which part is the network ID and which part is the host ID.
IPv4 addresses are 32‑bit, divided into four 8‑bit octets. They are traditionally grouped into three main classes.
Class definitions
Class A: first 8 bits are network ID, remaining 24 bits are host ID; used by government agencies.
Class B: first 16 bits are network ID, remaining 16 bits are host ID; used by medium‑size enterprises.
Class C: first 24 bits are network ID, last 8 bits are host ID; used by general users.
In addition, there are two hidden classes:
Class D: no network/host division; used for multicast.
Class E: no network/host division; reserved for experimental use.
Binary prefixes for each class
Class A: addresses start with 0.
Class B: addresses start with 10.
Class C: addresses start with 110.
Class D: addresses start with 1110.
Class E: addresses start with 11110.
Numeric ranges for each class
Class A: 0.0.0.0 – 127.255.255.255
Class B: 128.0.0.0 – 191.255.255.255
Class C: 192.0.0.0 – 223.255.255.255
Class D: 224.0.0.0 – 239.255.255.255
Class E: 240.0.0.0 – 255.255.255.254
Special IP addresses
Some IP ranges have special meanings and are not assigned to public hosts. Private address ranges include 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. Reserved addresses include 127.0.0.0/8 (loopback) and 169.254.0.0/16 (link‑local).
Subnetting
Data transmission relies on the network ID to route packets to the correct network, then the host ID to reach the destination host. In large networks with millions of hosts, routing directly to a host can be inefficient.
Subnetting divides the host ID portion into a subnet ID and a host ID, allowing the network to be split into smaller, more manageable sub‑networks. The subnet mask indicates how many bits belong to the subnet ID versus the host ID.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
