Logical Addressing: IPv4
1. Fundamentals of IPv4 Addressing
An IPv4 Address is a 32-bit logical identifier that uniquely and universally defines the connection of a host or router interface to the global Internet.
- Address Space: Total possible addresses = ().
- Notations:
- Binary Notation: 32 bits divided into four 8-bit octets:
11000000.10101000.00000001.00000001 - Dotted-Decimal Notation: Each octet is converted to decimal () separated by dots:
192.168.1.1
- Binary Notation: 32 bits divided into four 8-bit octets:
2. Classful Addressing
Originally, the IPv4 address space was divided into 5 discrete classes (Classes A through E):
Detailed Breakdown of Classes:
| Class | Leading Bits | 1st Octet Range | Default Subnet Mask | Max Networks | Hosts per Network | Primary Use Case |
|---|---|---|---|---|---|---|
| A | 0... |
(/8) |
() | () | Massive global organizations | |
| B | 10... |
(/16) |
() | () | Universities & mid-size enterprises | |
| C | 110... |
(/24) |
() | () | Small businesses & home LANs | |
| D | 1110... |
None | — | — | Multicasting | |
| E | 1111... |
None | — | — | Experimental & Research |
3. Special-Purpose IPv4 Addresses
- Network Address (Network ID): Host bits all zeros (
0). Represents the entire subnet (e.g.,192.168.1.0/24). Cannot be assigned to any host. - Directed Broadcast Address: Host bits all ones (
1). Delivers a packet to all hosts in a specific subnet (e.g.,192.168.1.255). - Limited Broadcast Address:
255.255.255.255. Broadcasts to all local hosts on the immediate physical wire; never forwarded by routers. - Loopback Address:
127.0.0.0/8(typically127.0.0.1=localhost). Used to test local network stack software without generating physical network traffic. - Private IP Addresses (RFC 1918): Unroutable on the public Internet, reserved for internal intranets behind NAT:
- Class A:
10.0.0.0to10.255.255.255(10.0.0.0/8) - Class B:
172.16.0.0to172.31.255.255(172.16.0.0/12) - Class C:
192.168.0.0to192.168.255.255(192.168.0.0/16)
- Class A:
- APIPA (Automatic Private IP Addressing):
169.254.0.0/16. Auto-configured by Windows/Mac clients when a DHCP server cannot be reached.
4. Subnetting & CIDR (Classless Inter-Domain Routing)
Due to rapid exhaustion of Class A and B blocks, CIDR (Classless Inter-Domain Routing) replaced rigid classful boundaries in 1993:
- An arbitrary number of contiguous bits () define the Network Prefix (written as
/nslash notation). - Subnet Mask: A 32-bit number where the first bits are
1s and the remaining host bits are0s.
Fundamental Subnetting Formulas:
For a subnet borrowing bits from the host field with remaining host bits:
5. Solved Step-by-Step Subnetting Numerical
Problem:
Given the IP address 200.10.20.75 with subnet mask 255.255.255.224 (/27):
- Find the Network Address.
- Find the Directed Broadcast Address.
- Find the range of usable host addresses.
- Calculate the total number of usable hosts in this subnet.
Solution:
- Last octet of IP: .
- Last octet of Mask: (, remaining host bits ).
- Network Address: Perform bitwise AND between IP and Mask:
- Directed Broadcast Address: Set all 5 host bits to
1:
- Usable Host Range: From (Network ID ) to (Broadcast ):
- Usable Hosts:
Frequently Asked Questions
QWhy are 2 addresses subtracted when calculating usable hosts per subnet?
The first address (all host bits 0) is reserved as the Network ID, and the last address (all host bits 1) is reserved as the Directed Broadcast Address.
QWhat was the primary limitation of Classful Addressing?
Inflexible block sizes. An organization requiring 300 IP addresses was forced to obtain a Class B block ( addresses), wasting addresses ( wastage). CIDR resolved this by allowing custom prefix lengths (/23).
QWhat is the purpose of the 127.0.0.1 IP address?
It is the standard IPv4 Loopback address, redirecting transmitted packets back into the local operating system's protocol stack without touching the physical network.
QWhich IPv4 ranges are private (RFC 1918)?
10.0.0.0/8, 172.16.0.0/12 (172.16.0.0–172.31.255.255) and 192.168.0.0/16. They are not routable on the public Internet and are used behind NAT.