CIDR stands for Classless Inter-Domain Routing. It is a method used for allocating and routing IP addresses on the Internet.
A /24 CIDR, such as 192.168.1.0/24, indicates that the first 24 bits are the network part of the address, leaving the remaining 8 bits for host addresses.
Traditionally, IP addresses were divided into different classes, such as Class A, Class B, and Class C, which had fixed boundaries and determined the network and host portions of an IP address.
CIDR notation is a standard syntax for writing IP addresses with a routing prefix. It appends a slash followed by the number of significant bits in the routing prefix to an IP address.
When you see an IP address followed by a slash and a number, such as 192.168.1.0/24, this is CIDR notation.
Let’s break down 192.168.1.0/24:
The IP address: 192.168.1.0
The number after the slash: 24
The 24 after the slash means that the first 24 bits of the IP address are used for the network prefix, and the remaining 8 bits (since an IPv4 address is 32 bits in total) are used for host addresses within that network.
This /24 CIDR notation often corresponds to a subnet mask of 255.255.255.0. This is because the first 24 bits of the subnet mask are set to 1 (which corresponds to 255 in each of the first three octets), indicating they are used for network identification.
A /24 network will accommodate 256 addresses in total. The network address (192.168.1.0) and the broadcast address (192.168.1.255) are typically not usable for host addresses, leaving 254 addresses (192.168.1.1 to 192.168.1.254) available for devices on the network.
Remember that this can depend on how your network is configured – some networks may be configured to use the .0 or .255 addresses for hosts, but traditionally they are reserved for network and broadcast addresses respectively.
Table of Contents
how to get the first ip and last ip address based on cidr
To find the first and last IP addresses for a given network in CIDR notation, you can perform the following steps.
Let’s assume a given network CIDR as 192.168.1.0/24.
Determine the subnet size: The number after the slash in the CIDR notation represents the number of bits in the network address. In this case, we have a /24, so our network has 24 bits. This leaves us with 8 bits for host addresses (since an IP address is 32 bits long).
Calculate the number of host addresses: The number of bits left for hosts determines the number of possible addresses on the subnet. For a /24 network, we have 2^8 = 256 addresses in total.
Find the first and last addresses:
The first address is the network address itself. So for 192.168.1.0/24, the first address is 192.168.1.0.
The last address is the broadcast address, which is the highest address in the subnet. With 256 total addresses, if the first address is 192.168.1.0, the last address would be 192.168.1.255.
Keep in mind that typically, the network address and broadcast address are not assigned to hosts (devices) on the network. So, for host devices, the usable IP addresses on 192.168.1.0/24 would usually start at 192.168.1.1 and end at 192.168.1.254.
You can use these steps for any CIDR block, adjusting for the network size as indicated by the number after the slash in the CIDR notation.
There are also online tools and calculators that can perform these calculations for you.
CIDR Conversion Table
|CIDR Length||Mask||# of Hosts|
|/31||255.255.255.254||Not usable (point-to-point)|
|CIDR Length||# of Networks|