====== CIDR Notation ======
**CIDR (Classless Inter-Domain Routing)** is a compact way of describing an IP network.
Instead of using a subnet mask, CIDR specifies how many bits belong to the **network portion** of an IP address.
Example:
192.168.1.25/24
Here:
* `192.168.1.25` is the IP address.
* `/24` is the CIDR prefix length.
-----
===== Why Was CIDR Introduced? =====
Originally, IPv4 used fixed address classes (Class A, B, and C).
This approach wasted many IP addresses and made routing inefficient.
CIDR was introduced to:
* Improve address allocation
* Reduce routing table size
* Replace classful addressing
* Support flexible subnet sizes
Today, CIDR is the standard method for describing IP networks.
-----
===== Understanding the Prefix Length =====
The number after the slash indicates how many bits belong to the network.
Example:
192.168.1.25/24
means:
* First 24 bits → Network
* Remaining 8 bits → Host
Visually:
IP Address
192.168.1.25
↓
11000000.10101000.00000001.00011001
Network Bits
11111111.11111111.11111111
Host Bits
00000000
-----
===== CIDR and Subnet Masks =====
CIDR notation and subnet masks describe exactly the same thing.
^ CIDR ^ Subnet Mask ^
| /8 | 255.0.0.0 |
| /16 | 255.255.0.0 |
| /24 | 255.255.255.0 |
| /25 | 255.255.255.128 |
| /26 | 255.255.255.192 |
| /27 | 255.255.255.224 |
| /28 | 255.255.255.240 |
| /29 | 255.255.255.248 |
| /30 | 255.255.255.252 |
| /32 | 255.255.255.255 |
CIDR notation is shorter and is therefore preferred today.
-----
===== Examples =====
Example 1:
192.168.1.0/24
This represents one subnet containing:
* Network address
* Host addresses
* Broadcast address (IPv4)
-----
Example 2:
10.0.0.0/8
A very large network containing over 16 million IPv4 addresses.
-----
Example 3:
203.0.113.17/32
Represents exactly one IPv4 address.
-----
===== CIDR in IPv6 =====
CIDR is also used with IPv6.
Example:
2001:db8::/32
Most local IPv6 networks use:
/64
Unlike IPv4, IPv6 almost always uses prefix notation rather than subnet masks.
-----
===== Why Is CIDR Useful? =====
CIDR allows networks of almost any size.
Instead of allocating only fixed-size networks, administrators can choose the most appropriate prefix.
Benefits include:
* Better utilization of IP addresses
* Smaller routing tables
* Flexible subnet sizes
* Simpler network management
-----
===== CIDR and Routing =====
Routers use CIDR prefixes when selecting routes.
Example:
Destination
192.168.10.25
Routing Table
192.168.0.0/16
192.168.10.0/24
0.0.0.0/0
The router chooses the **longest matching prefix**.
In this example:
192.168.10.0/24
is selected because it is more specific than:
192.168.0.0/16
This is known as the **Longest Prefix Match** rule.
-----
===== CIDR and Telenegar =====
Several Telenegar tools display or use CIDR notation.
* [[tools:ipcheck|IP Check]]
* [[tools:subnetcalc|Subnet Calculator]]
Subnet Calculator can convert between:
* CIDR notation
* Subnet mask
* Network address
* Host range
-----
===== Common Misconceptions =====
* **/24 means 24 computers.**
* False. It means 24 network bits.
* **CIDR is only used with IPv4.**
* False. IPv6 also uses CIDR notation.
* **CIDR and subnet masks are different technologies.**
* False. They represent the same information in different formats.
-----
===== Related Topics =====
* [[networking:internet:ip-addresses|IP Addresses]]
* [[networking:internet:ipv4|IPv4]]
* [[networking:internet:ipv6|IPv6]]
* [[networking:internet:subnetting|Subnetting]]
* [[tools:subnetcalc|Subnet Calculator]]
-----
{{tag>cidr subnet subnetting ipv4 ipv6 routing networking}}