What is IPv4 Addressing and Subnetting

Hardware Addressing:
A hardware address uniquely identifies a host device within a local network and lies on the data link layer of the OSI model. The MAC address is 48 bits, comprising a 24-bit device address and a 24-bit manufacturer address called the OUI (Organizationally Unique Identifier). It is hardcoded on the device and cannot be changed. In a virtualization environment, hardware addresses can be randomly assigned.
MAC addresses are represented in hexadecimal format, such as:
00:43:F2:22:13
0043.ABF2.3213
Logical Addressing:
Logical addressing is a function of the network layer of the OSI model and provides a hierarchical structure to the network. Further, Logical addresses are not hardcoded and can be changed as needed. IP and IPX are the main protocols for logical addressing.
Logical addressing contains two main components:
- Network ID
- Host ID
Internet Protocol (IP):
In the 1970s, the Department of Defense developed the Transmission Control Protocol (TCP). Initially, TCP and IP worked together on the network and transport layers, but this approach has been deprecated. Now, TCP operates on the transport layer, and IP operates on the network layer.
IP provides two main features:
- Logical Addressing: Provides a unique logical address to a device, consisting of a network address and a host address.
- Routing: Determines the best path to reach the destination.
IP addresses are defined in RFC 760. The size of an IPv4 address is 32 bits, while the size of an IPv6 address is 128 bits. Due to the shortage of IPv4 addresses, IPv6 is increasingly being implemented in larger setups.
Also Learn: What is a network? What are the Types and Architectures
IPV4 Addressing:-
IPv4 addressing provides a logical address to a host. An IP address has a hierarchical structure, representing the Network ID for the device and the Host ID for the host. An IP address is represented in decimal format, such as:
158.80.164.3
An IP address consists of four octets, each 8 bits long, resulting in a 32-bit IP address. The smallest number is 0, and the largest number is 255.
Converting the above IP address into binary format looks as follows:
158.80.164.3
First octet: 10011110
Second octet: 01010000
Third octet: 10100100
Fourth octet: 00000011
Decimal to Binary Conversion
The simplest and easiest way to convert decimal to binary is by using the following table.
128 64 32 16 8 4 2 1
So, convert the decimal number 158 octet into binary
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 |
The value 158 is greater than 128, so 128 is set to 1. Next, 128 + 64 is greater than 158, so the value is set to 0. Similarly, 128 + 32 is greater than 158, so the value is set to 0. However, 128 + 16 is less than 158, so the value is set to 1. This process continues until the value equals 158.
Binary to Decimal Conversion
Converting the Binary to Decimal is even simple as we have convert decimal to binary value. Such as
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 |
In this case, add up all the 1s value and the result will be 241
What is the Subnet Mask?
1st part of the IP address shows the Network and the 2nd part of the IP address shows the Host address. This is distinguish comes from subnet mast.
Let’s suppose
158.80.164.3 255.255.0.0
The above 255.255.0.0 is the subnet mask of the given IP address, by using this subnet mask, we separate the network and host addresses.
IP Address: 10011110.01010000.10100100.00000011
Subnet Mask: 11111111.11111111.00000000.00000000
In subnet Mask, if the binary bit is 1s then the corresponding bit identify the network address. If the binary bit is 0s then the corresponding bit identify the host address.
The above IP address 158.80 is the network address and the 164.3 is the unique host address.
If the two hosts having identical network address can communicate with each other freely but when the two hosts having different network addresses cannot communicate with each without router.
IP Address Classes:
IP address are classified into several classes, in which the 1st octet of the address identify the class of the network.
Class | First Octet Range | Default Subnet Mask |
Class A | 1 – 127 | 255.0.0.0 |
Class B | 128 – 191 | 255.255.0.0 |
Class C | 192 – 223 | 255.255.255.0 |
Class D | 224 – 239 |
The IPV4 Header:

Pingback: Key Difference Between Classful Vs Classless Routing Protocols