What is an IP Address and Why is it Divided into Classes?
An IP address (Internet Protocol address) is a unique numerical label that allows devices connected to the internet or a network to recognize and communicate with each other. Just like our home address in the postal system, IP addresses ensure that data packets reach the correct destination.
The main reason for dividing IP addresses into classes was that the growth potential of the internet was not fully anticipated in the early days, and to ensure more efficient use of addresses. Classes aimed to prevent address wastage by offering address ranges suitable for networks of different sizes.
Initially, IP addresses were divided into five classes: A, B, C, D, and E. However, nowadays, classes D and E are reserved for special purposes, and the commonly used classes are A, B, and C. These classes are determined by the value of the first octet (the first 8 bits) and define the length of the network and host (device) parts.
Important Point: The division of IP addresses into classes not only ensured more efficient use of addresses but also facilitated routing operations.
Class A IP Addresses: What are Their Features and Usage Areas?
Class A IP addresses are designed for large networks. The first octet ranges from 1 to 126 (inclusive). The first octet represents the network address, and the remaining three octets represent the host address. This means that Class A networks can host a large number of hosts (over 16 million).
Class A Address Range: 1.0.0.0 - 126.0.0.0
Example Class A IP Address: 10.0.0.1 (10 is a Class A network address)
Class A Subnet Mask (Default): 255.0.0.0
Usage Areas:
- Large companies
- Government agencies
- Universities
- Internet Service Providers (ISPs)
Advantages: Ability to host a large number of hosts.
Disadvantages: Limited number of network addresses (126) and the potential for address wastage for smaller networks because they are designed for large networks.
Real-Life Example: A large telecommunications company may use Class A IP addresses to manage its extensive network infrastructure and serve millions of users.
Technical Detail: In Class A addresses, the first bit is always 0. The remaining 7 bits represent the network address, and 24 bits represent the host address.
/* C code example: Checking a Class A IP address */
#include
#include
bool isClassA(int firstOctet) {
return (firstOctet >= 1 && firstOctet <= 126);
}
int main() {
int ipAddress[] = {10, 0, 0, 1};
if (isClassA(ipAddress[0])) {
printf("This is a Class A IP address.\n");
} else {
printf("This is not a Class A IP address.\n");
}
return 0;
}
Class B IP Addresses: What are Their Features and Usage Areas?
Class B IP addresses are designed for medium-sized networks. The first octet ranges from 128 to 191 (inclusive). The first two octets represent the network address, and the remaining two octets represent the host address. This means that Class B networks can host more than 65 thousand hosts.
Class B Address Range: 128.0.0.0 - 191.255.0.0
Example Class B IP Address: 172.16.0.1 (172.16 is a Class B network address)
Class B Subnet Mask (Default): 255.255.0.0
Usage Areas:
- Medium-sized companies
- University campuses
- Regional internet service providers
Advantages: Suitable number of hosts for medium-sized networks and a sufficient number of network addresses.
Disadvantages: Although there are more network addresses than Class A, it may be insufficient for some large networks.
Real-Life Example: A university campus can use Class B IP addresses for internet access for students and staff.
Technical Detail: In Class B addresses, the first two bits are 10. The remaining 14 bits represent the network address, and 16 bits represent the host address.
/* Python code example: Checking a Class B IP address */
def is_class_b(first_octet):
return 128 <= first_octet <= 191
ip_address = [172, 16, 0, 1]
if is_class_b(ip_address[0]):
print("This is a Class B IP address.")
else:
print("This is not a Class B IP address.")
Class C IP Addresses: What are Their Features and Usage Areas?
Class C IP addresses are designed for small networks. The first octet ranges from 192 to 223 (inclusive). The first three octets represent the network address, and the last octet represents the host address. This means that Class C networks can host 254 hosts.
Class C Address Range: 192.0.0.0 - 223.255.255.0
Example Class C IP Address: 192.168.1.1 (192.168.1 is a Class C network address)
Class C Subnet Mask (Default): 255.255.255.0
Usage Areas:
- Small offices
- Home networks
- Small businesses
Advantages: Ideal number of hosts for small networks and a large number of network addresses.
Disadvantages: Not suitable for large networks due to the limited number of hosts.
Real-Life Example: A home user can use Class C IP addresses to connect devices in their home to the internet.
Technical Detail: In Class C addresses, the first three bits are 110. The remaining 21 bits represent the network address, and 8 bits represent the host address.
// JavaScript code example: Checking a Class C IP address
function isClassC(firstOctet) {
return firstOctet >= 192 && firstOctet <= 223;
}
let ipAddress = [192, 168, 1, 1];
if (isClassC(ipAddress[0])) {
console.log("This is a Class C IP address.");
} else {
console.log("This is not a Class C IP address.");
}
Class D and E IP Addresses: What Are They Used For?
Class D and E IP addresses, unlike classes A, B, and C, are reserved for specific purposes and are not used on public networks.
Class D IP Addresses (224.0.0.0 - 239.255.255.255): Used as multicast addresses. Multicast allows data to be sent to multiple recipients simultaneously. For example, it is used in applications such as live video broadcasts or online games.
Class E IP Addresses (240.0.0.0 - 255.255.255.254): Reserved for future use and are currently used for research and development purposes. These addresses are not used on the public internet.
255.255.255.255 IP Address: This address is known as the limited broadcast address and is only used for broadcasting on the local network. Routers do not forward this address to external networks.
Comparison of IP Address Classes: Table
Class | Address Range (First Octet) | First Octet Bits | Default Subnet Mask | Number of Networks | Number of Hosts (Per Network) | Areas of Use |
---|---|---|---|---|---|---|
A | 1 - 126 | 0xxxxxxx | 255.0.0.0 | 126 | 16,777,214 | Large companies, government agencies |
B | 128 - 191 | 10xxxxxx | 255.255.0.0 | 16,384 | 65,534 | Medium-sized companies, universities |
C | 192 - 223 | 110xxxxx | 255.255.255.0 | 2,097,152 | 254 | Small offices, home networks |
D | 224 - 239 | 1110xxxx | None (Multicast) | - | - | Multicast applications |
E | 240 - 255 | 1111xxxx | None (Reserved) | - | - | Research and development |
IPv4 Address Exhaustion and CIDR (Classless Inter-Domain Routing)
Although the classification of IP addresses was initially intended to make more efficient use of addresses, it has led to the exhaustion of IPv4 addresses over time. This is because each class is designed for networks of a certain size, and therefore leads to address wastage for smaller networks.
To solve this problem, CIDR (Classless Inter-Domain Routing) was developed. Instead of dividing IP addresses into classes, CIDR specifies the length of the network address with the number of bits. For example, the address 192.168.1.0/24 indicates that the first 24 bits of the 192.168.1.0 network address represent the network address. This provides a more flexible addressing scheme and prevents address waste.
CIDR Notation: IP Address/Prefix Length (e.g., 192.168.1.0/24)
Advantages:
- More efficient address usage
- Reduction of routing tables
- Prevention of address waste
Private IP Addresses: What Ranges Do They Fall Into and Why Are They Used?
Private IP addresses are addresses used in local networks and are not directly routed on the internet. These addresses are used to increase network security and prevent the depletion of IPv4 addresses.
Private IP Address Ranges:
- 10.0.0.0 - 10.255.255.255 (Class A): Used for large private networks.
- 172.16.0.0 - 172.31.255.255 (Class B): Used for medium-sized private networks.
- 192.168.0.0 - 192.168.255.255 (Class C): Used for small private networks (home networks, small offices).
Usage Areas:
- Home networks (e.g., addresses assigned by a modem)
- Corporate internal networks
- Laboratory environments
Advantages:
- Increases network security (they are not directly accessible from the internet)
- Prevents the depletion of IPv4 addresses
- Prevents address conflicts (the same addresses can be used in different private networks)
NAT (Network Address Translation): NAT (Network Address Translation) technology is used to allow private IP addresses to access the internet. NAT provides internet access by converting private IP addresses to a single public IP address.
IP Address Classes and Subnetting
Subnetting is the process of dividing an IP network into smaller, more manageable subnets. This improves network performance, enhances security, and optimizes address usage.
Why Subnet?
- Improve Performance: Improves performance by reducing network traffic.
- Enhance Security: Enhances security by applying security policies between different subnets.
- Optimize Address Usage: Prevents address waste and provides more efficient address usage.
- Simplify Management: Makes network management easier and more organized.
Subnet Mask: The subnet mask determines which part of an IP address represents the network address and which part represents the host address. For example, the 255.255.255.0 subnet mask is the default mask for a Class C network and indicates that the first three octets represent the network address, and the last octet represents the host address.
Subnetting Steps:
- Determine the network size and the number of hosts.
- Calculate the required number of subnets and the number of hosts in each subnet.
- Select the appropriate subnet mask.
- Assign IP addresses to subnets.
Example: To divide a Class C network (192.168.1.0/24) into 4 subnets, we need to borrow 2 bits. The new subnet mask becomes 255.255.255.192 (/26). This provides 62 usable host addresses in each subnet.
Subnet | Address Range | Broadcast Address |
---|---|---|
192.168.1.0/26 | 192.168.1.1 - 192.168.1.62 | 192.168.1.63 |
192.168.1.64/26 | 192.168.1.65 - 192.168.1.126 | 192.168.1.127 |
192.168.1.128/26 | 192.168.1.129 - 192.168.1.190 | 192.168.1.191 |
192.168.1.192/26 | 192.168.1.193 - 192.168.1.254 | 192.168.1.255 |