Skip to Content

understanding network CIDR /24

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.

Get Your Free Linux training!

Join our free Linux training and discover the power of open-source technology. Enhance your skills and boost your career! Learn Linux for Free!

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.

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
/0 0.0.0.0 4,294,967,294
/1 128.0.0.0 2,147,483,646
/2 192.0.0.0 1,073,741,822
/3 224.0.0.0 536,870,910
/4 240.0.0.0 268,435,454
/5 248.0.0.0 134,217,726
/6 252.0.0.0 67,108,862
/7 254.0.0.0 33,554,430
/8 255.0.0.0 16,777,214
/9 255.128.0.0 8,388,606
/10 255.192.0.0 4,194,302
/11 255.224.0.0 2,097,150
/12 255.240.0.0 1,048,574
/13 255.248.0.0 524,286
/14 255.252.0.0 262,142
/15 255.254.0.0 131,070
/16 255.255.0.0 65,534
/17 255.255.128.0 32,766
/18 255.255.192.0 16,382
/19 255.255.224.0 8,190
/20 255.255.240.0 4,094
/21 255.255.248.0 2,046
/22 255.255.252.0 1,022
/23 255.255.254.0 510
/24 255.255.255.0 254
/25 255.255.255.128 126
/26 255.255.255.192 62
/27 255.255.255.224 30
/28 255.255.255.240 14
/29 255.255.255.248 6
/30 255.255.255.252 2
/31 255.255.255.254 Not usable (point-to-point)
/32 255.255.255.255 1

 

CIDR Length # of Networks
/1 128 A
/2 64 A
/3 32 A
/4 16 A
/5 8 A
/6 4 A
/7 2 A
/8 1 A
/9 128 B
/10 64 B
/11 32 B
/12 16 B
/13 8 B
/14 4 B
/15 2 B
/16 1 B
/17 128 C
/18 64 C
/19 32 C
/20 16 C
/21 8 C
/22 4 C
/23 2 C
/24 1 C
/25 2 subnets
/26 4 subnets
/27 8 subnets
/28 16 subnets
/29 32 subnets
/30 64 subnets
/31 none
/32 none

 

Den

Thursday 14th of March 2024

It is very clear and easier to understand. Thanks.

Charles

Thursday 11th of July 2024

@Den, thanks a lot! I've read bulky articles that couldn't explain it as well as you do.