Progress pill
IPv4 addressing

Using IPv4

In this section, we will go deeper and look at how IPv4 addresses are actually implemented in a real-world network. We'll break down their format, the logic behind them, and how they connect with other key network elements like DNS names, MAC addresses, subnetworks and translation techniques.
An IP address is a unique numerical identifier assigned to each network Interface on a device. It makes it possible to locate this device within a network and reach it to transmit data. For example, a router, server, workstation, network printer or even a surveillance camera has at least one IP address of its own. The IP address makes routing possible, i.e. moving packets from point A to point B, even if they are physically far apart.
IP addresses can be assigned in two main ways:
  • Static: Manually set on the device.
  • Dynamic: Automatically assigned on-demand by a DHCP (Dynamic Host Configuration Protocol) server. DHCP simplifies network management, eliminating the need for manual configuration while enabling precise control through reservations and lease durations.
IPv4 addresses are written in a 32-bit format split into four bytes. Each byte contains 8 bits and represent a decimal number from 0 to 255. The 4 bytes are separated by dots to form a clear, legible notation.
example: address 172.16.254.1_
Each bit in a byte has a value (or "weight"): the left-hand bit (the most significant bit) is worth 128, the next 64, then 32, 16, 8, 4, 2 and 1 for the right-hand bit (the least significant bit). In this way, binary writing is converted to decimal by the simple addition of the set weights.
The table below illustrates this correspondence:
Binary CodeActivated Bit ValuesDecimal Value
0000000000
0000000111
000000111 + 23
000001111 + 2 + 47
000011111 + 2 + 4 + 815
000111111 + 2 + 4 + 8 + 1631
001111111 + 2 + 4 + 8 + 16 + 3263
011111111 + 2 + 4 + 8 + 16 + 32 + 64127
111111111 + 2 + 4 + 8 + 16 + 32 + 64 + 128255
To convert binary to decimal, add the weights of the bits that are set to 1.
BinaryDecimal Value
10101100172
0001000016
11111110254
000000011
An IP address identifies a single network interface, not the whole device. A multi-port router or firewall has multiple interfaces, each with its own IP address. One interface can even have several IP addresses (for example, to serve multiple virtual networks or services).
Every IP packet contains two IP addresses in its header:
  • The source address (sender)
  • The destination address (receiver) Routers read these addresses to figure out the best path to send the packet until it reaches the destination. Without strict addressing rules, network traffic couldn't be routed correctly and global interconnection of networks would be impossible.
An IPv4 address has two parts:
  • NetID: identifies the network
  • HostID: identifies a device within that network The subnet mask determines where the NetID ends and the HostID begins, specifying how many bits belong to each portion. The longer the NetID, the greater the number of possible subnets, but the number of hosts per subnet decreases accordingly.
Originally, IPv4 networks were divided into five classes: (A, B, C, D and E). Each class corresponds to a specific NetID range and defines a fixed granularity:
  • Class A: very large networks with a large number of hosts
  • Class B: medium-sized networks
  • Class C: small networks
  • Class D: addresses reserved for multicasting (multicast)
  • Class E: experimental addresses, not used for conventional addressing
ClassLeading BitsFirst Byte RangeDefault Subnet MaskPurpose
A00 – 127255.0.0.0Very large networks
B10128 – 191255.255.0.0Medium-sized networks
C110192 – 223255.255.255.0Small networks
D1110224 – 239N/AMulticast addresses
E1111240 – 255N/AExperimental (not publicly used)
Special Addresses:
  • Network address: Identifies the network itself (used in routing tables).
  • Broadcast address: Sends data to all devices in the subnet at once (all HostID bits set to 1).
The following ranges are reserved for internal use:
  • 10.0.0.0/8 (Private Class A)
  • 127.0.0.0/8 (local loopback or loopback)
  • 172.16.0.0 to 172.31.255.255 (private Class B)
  • 192.168.0.0 to 192.168.255.255 (private Class C)
The addresses 127.0.0.1 and, more generally, the entire 127.0.0.0/8 range is used for internal testing: any request sent to it never leaves the machine. This is useful for checking that a local network service is working without involving the wider network.
To make better use of the address space, administrators often split networks into subnets using subnet masks or CIDR notation (Classless Inter-Domain Routing). CIDR allows more precise management and helps avoid wasting addresses. Today, CIDR is essential for fine-tuning IP ranges and reducing the size of routing tables.
In modern networks, IP addressing is usually paired with other identifiers:
  • domain name registered in a DNS (Domain Name System): It associates a numeric IP address with a human-friendly name.
  • MAC address: a physical identifier engraved in the network card, used for local transport (Ethernet). When an IP packet needs to be physically transmitted, the ARP table matches the IP address with the MAC address of the destination.
To deal with IPv4 address shortages and to add a layer of security, networks often use address translation (NAT). NAT allows many private devices to share a single public IP address when accessing the Internet.
Note: Online and built-in OS tools, such as the Grenoble CRIC calculator, make subnet and mask calculations much easier. These utilities help to plan network splitting efficiently.
In conclusion, the broadcast address remains a practical function for sending the same message to all devices connected to a segment: this is achieved by setting all bits in the HostID portion to 1 so all hosts are targeted.
Quiz
Quiz1/5
What is the main role of an IPv4 address in a computer network?