0
0
Computer Networksknowledge~6 mins

IPv4 address structure in Computer Networks - Full Explanation

Choose your learning style9 modes available
Introduction
Imagine trying to send a letter to a friend without knowing their exact home address. Computers face a similar problem when they want to communicate over the internet. They need a unique address to find each other and send information correctly.
Explanation
IPv4 Address Format
An IPv4 address is made up of 32 bits divided into four groups called octets. Each octet contains 8 bits and is written as a decimal number between 0 and 255. These four numbers are separated by dots, forming the familiar format like 192.168.1.1.
An IPv4 address consists of four decimal numbers separated by dots, each representing 8 bits.
Network and Host Parts
The IPv4 address is split into two parts: the network part and the host part. The network part identifies the specific network, while the host part identifies a device within that network. The size of each part depends on the subnet mask used.
IPv4 addresses have a network part and a host part to locate devices within networks.
Subnet Mask
A subnet mask is a 32-bit number that helps separate the network and host parts of an IPv4 address. It uses ones (1s) to mark the network bits and zeros (0s) for the host bits. For example, 255.255.255.0 means the first three octets are the network part.
Subnet masks define which bits in an IPv4 address belong to the network and which belong to the host.
Address Classes
IPv4 addresses are grouped into classes (A, B, C, D, E) based on their first few bits. Classes A, B, and C are used for regular networks with different sizes, while D is for multicast and E is reserved. This classification helps organize address allocation.
IPv4 address classes organize networks by size and purpose using the first bits of the address.
Real World Analogy

Think of an IPv4 address like a street address. The network part is like the city name, and the host part is like the house number on a street. The subnet mask is like a rule that tells you how much of the address is the city and how much is the house number.

IPv4 Address Format → The full street address with city and house number separated by commas
Network and Host Parts → City name (network) and house number (host) parts of the address
Subnet Mask → The rule that tells which part of the address is city and which is house number
Address Classes → Different types of cities with varying sizes and purposes
Diagram
Diagram
┌───────────────┬───────────────┬───────────────┬───────────────┐
│   Octet 1     │   Octet 2     │   Octet 3     │   Octet 4     │
│ (8 bits)      │ (8 bits)      │ (8 bits)      │ (8 bits)      │
├───────────────┼───────────────┼───────────────┼───────────────┤
│ Network Part  │ Network/Host  │ Host Part     │ Host Part     │
│ (depends on   │ (depends on   │               │               │
│ subnet mask)  │ subnet mask)  │               │               │
└───────────────┴───────────────┴───────────────┴───────────────┘
This diagram shows the four octets of an IPv4 address and how the network and host parts are divided depending on the subnet mask.
Key Facts
IPv4 AddressA 32-bit number written as four decimal octets separated by dots.
OctetA group of 8 bits in an IPv4 address, represented as a decimal number from 0 to 255.
Subnet MaskA 32-bit number that separates the network and host parts of an IPv4 address.
Network PartThe portion of an IPv4 address that identifies the network.
Host PartThe portion of an IPv4 address that identifies a device within the network.
Address ClassesCategories of IPv4 addresses (A, B, C, D, E) based on the first bits to organize networks.
Common Confusions
Believing all four parts of an IPv4 address always represent the network.
Believing all four parts of an IPv4 address always represent the network. Only the bits marked by the subnet mask belong to the network; the rest identify the host.
Thinking the decimal numbers in IPv4 addresses are random.
Thinking the decimal numbers in IPv4 addresses are random. Each decimal number represents 8 bits of the 32-bit binary address, not random values.
Summary
IPv4 addresses are 32-bit numbers split into four decimal parts called octets.
Subnet masks define which part of the address is the network and which is the host.
Address classes help organize IPv4 addresses by network size and purpose.