IP address classes are part of the classful network architecture that was used before the introduction of CIDR (Classless Inter-Domain Routing). They categorize IP addresses into different classes based on their range and intended usage.
1.0.0.0
to 126.255.255.255
10.0.0.0
to 10.255.255.255
0.0.0.0/8
(Reserved for default network) and 127.0.0.0/8
(Loopback addresses).128.0.0.0
to 191.255.255.255
172.16.0.0
to 172.31.255.255
192.0.0.0
to 223.255.255.255
192.168.0.0
to 192.168.255.255
224.0.0.0
to 239.255.255.255
240.0.0.0
to 255.255.255.255
255.255.255.255
.Classless Inter-Domain Routing (CIDR) is a method for allocating IP addresses and routing IP packets. It provides a more flexible and efficient way to manage IP address allocation compared to the classful system.
CIDR notation consists of an IP address followed by a forward slash (/
) and a number indicating the prefix length. The prefix length specifies how many bits are used for the network portion of the address.
Format: IP_Address/Prefix_Length
Example: 192.168.1.0/24
To calculate the number of usable IP addresses in an IPv4 CIDR block, use the following formula:
Number of Hosts = 2(32 - Prefix_Length) - 2
In IPv4 subnetting, the first IP address in a subnet is reserved as the network address, which identifies the subnet itself. The last IP address is reserved as the broadcast address, used to send messages to all hosts within the subnet. Consequently, these two addresses cannot be assigned to individual devices, reducing the total number of usable IPs by two.
CIDR Block: 192.168.1.0/24
192.168.1.0
192.168.1.1
192.168.1.254
192.168.1.255
CIDR Notation | Subnet Mask | Total IPs | Usable IPs | IP Range |
---|---|---|---|---|
/0 |
N/A | 4,294,967,296 | 4,294,967,294 | 0.0.0.0 - 255.255.255.255 |
/8 |
255.0.0.0 | 16,777,216 | 16,777,214 | 10.0.0.0 - 10.255.255.255 |
/16 |
255.255.0.0 | 65,536 | 65,534 | 172.16.0.0 - 172.16.255.255 |
/20 |
255.255.240.0 | 4,096 | 4,094 | 172.16.0.0 - 172.16.15.255 |
/24 |
255.255.255.0 | 256 | 254 | 192.168.1.0 - 192.168.1.255 |
/28 |
255.255.255.240 | 16 | 14 | 192.0.2.0 - 192.0.2.15 |
/30 |
255.255.255.252 | 4 | 2 | 192.168.1.0 - 192.168.1.3 |
/32 |
255.255.255.255 | 1 | 1 | 203.0.113.5 |
IPv6 uses a fixed /64
prefix length for most subnets, providing 264 addresses per subnet. Unlike IPv4, IPv6 does not subtract addresses for network or broadcast purposes.
CIDR Block: 2001:0db8:85a3::/64
2001:0db8:85a3::
2001:0db8:85a3::1
2001:0db8:85a3::ffff:ffff:ffff:ffff
CIDR Notation | Prefix Length | Total IPs | Usable IPs | IP Range |
---|---|---|---|---|
/0 |
0 | 2128 | 2128 | :: - ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff |
/32 |
32 | 296 | 296 | 2001:0db8:: - 2001:0db8:ffff:ffff:ffff:ffff:ffff:ffff |
/48 |
48 | 280 | 280 | 2001:0db8:1234:: - 2001:0db8:1234:ffff:ffff:ffff:ffff:ffff |
/64 |
64 | 264 | 264 | 2001:0db8:85a3:: - 2001:0db8:85a3::ffff:ffff:ffff:ffff |
/128 |
128 | 1 | 1 | 2001:0db8:0000:0000:0000:ff00:0042:8329 |
/64
prefix for IPv6 subnets can cause compatibility and functionality issues.