What is CIDR ?
CIDR (Classless Inter-Domain Routing) is a method of representing IP networks that tells you how much of an IP address identifies the network and how much identifies the host (device).
CIDR (Classless Inter-Domain Routing) is a method of representing IP networks that tells you how much of an IP address identifies the network and how much identifies the host (device).
The format is:
IP_Address/Prefix_Length
For example:
192.168.1.0/24
192.168.1.0= Network address/24= The first 24 bits are the network portion.
How CIDR works
An IPv4 address has 32 bits, divided into four octets (8 bits each).
Example:
192.168.1.10
Binary:
11000000.10101000.00000001.00001010
If the CIDR is /24, it means:
Network bits Host bits
11111111.11111111.11111111.00000000
^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^
24 bits 8 bits
The first 24 bits identify the network, and the remaining 8 bits identify individual devices.
CIDR and subnet mask
Each CIDR prefix corresponds to a subnet mask.
| CIDR | Subnet Mask | Total IPs | Usable Hosts |
|---|---|---|---|
/8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
/16 | 255.255.0.0 | 65,536 | 65,534 |
/24 | 255.255.255.0 | 256 | 254 |
/25 | 255.255.255.128 | 128 | 126 |
/26 | 255.255.255.192 | 64 | 62 |
/27 | 255.255.255.224 | 32 | 30 |
/28 | 255.255.255.240 | 16 | 14 |
/29 | 255.255.255.248 | 8 | 6 |
/30 | 255.255.255.252 | 4 | 2 |
/32 | 255.255.255.255 | 1 | 1 (single IP) |
Example 1: /24
Network: 192.168.1.0/24
Network Address : 192.168.1.0
First Host : 192.168.1.1
Last Host : 192.168.1.254
Broadcast : 192.168.1.255
Example 2: /26
A /24 network can be divided into four /26 subnets:
192.168.1.0/26 → Hosts: .1 - .62
192.168.1.64/26 → Hosts: .65 - .126
192.168.1.128/26 → Hosts: .129 - .190
192.168.1.192/26 → Hosts: .193 - .254
Each /26 subnet contains:
64 total IP addresses
62 usable host addresses
Why use CIDR?
CIDR replaced the older "classful" addressing system because it allows more efficient use of IP addresses.
For example:
A small office might need only 30 addresses, so it can use a
/27network instead of a full/24.A cloud provider can assign exactly the number of addresses a customer needs, reducing waste.
Easy way to remember
Think of the number after the slash as "how many bits belong to the network."
Larger prefix (e.g.
/30) → smaller network, fewer host addresses.Smaller prefix (e.g.
/16) → larger network, more host addresses.
A quick memory trick:
/24→ 256 total IPs/25→ 128 total IPs/26→ 64 total IPs/27→ 32 total IPs/28→ 16 total IPs
Each time the prefix increases by 1, the size of the network is cut roughly in half.
Comments
Post a Comment