September 20, 2025
Binary IPv4 and IPv6 CIDR Notation

Binary IPv4 and IPv6 CIDR Notation

CIDR Notation: An Overview

CIDR, or Classless Inter-Domain Routing, is a method for allocating IP addresses and routing Internet Protocol packets. It was introduced in 1993 as a replacement for the previous system of IP address allocation, known as Classful IP addressing.

History of CIDR

The original system of IP address allocation, known as Classful IP addressing, was based on dividing IP addresses into classes (A, B, and C) based on their most significant bits. This system, however, proved to be inflexible as it did not allow for efficient use of IP address space. CIDR was introduced as a solution to this problem, allowing for more fine-grained control over IP address allocation.

Why and How CIDR is used

CIDR notation is used to specify the number of bits in a network’s IP address that are used for the network prefix, as opposed to the host identifier. This allows for more efficient use of IP address space by allowing for smaller, more specific subnets to be created. CIDR notation is written as a IP address followed by a slash (/) and the number of bits in the prefix, for example: 192.0.2.0/24.

Benefits of using CIDR

The use of CIDR notation provides a number of benefits, including:

  • More efficient use of IP address space
  • Easier aggregation of routing information
  • Reduction in the size of routing tables

CIDR for IPv4 and IPv6

CIDR notation is used for both IPv4 and IPv6 addresses. In IPv4, CIDR notation is used to specify the number of bits in a network’s IP address that are used for the network prefix, with the remaining bits used for the host identifier. In IPv6, CIDR notation is used to specify the number of bits in a network’s IP address that are used for the network prefix, with the remaining bits used for the host identifier.

Examples of CIDR notation

Here are some examples of commonly used IPv4 and IPv6 CIDR addresses:

IPv4 CIDR addresses:

  • /24 (255.255.255.0) – This CIDR notation is commonly used for small to medium-sized networks, allowing for up to 256 host addresses.
  • /16 (255.255.0.0) – This CIDR notation is commonly used for large networks, allowing for up to 65,536 host addresses.
  • /8 (255.0.0.0) – This CIDR notation is used for very large networks and is the largest CIDR block available for IPv4, allowing for up to 16,777,216 host addresses.

IPv6 CIDR addresses:

  • /64 – This CIDR notation is commonly used for small to medium-sized networks, allowing for a large number of host addresses (18,446,744,073,709,551,616).
  • /48 – This CIDR notation is commonly used for large networks, allowing for a large number of host addresses (281,474,976,710,656).
  • /32 – This CIDR notation is used for very large networks and is the largest CIDR block available for IPv6, allowing for a very large number of host addresses (4,398,046,511,104).

It is worth noting that these are just examples and that the actual number of usable host addresses will depend on the specific IP address range being used. Additionally, CIDR notation can be used with other subnet mask to define the network boundaries.

Binary IPv4 and IPv6 CIDR Notation
Binary IPv4 and IPv6 CIDR Notation

Calculating Subnets using Binary

For both IPv4 and IPv6 addresses, the bits in the IP address are used to determine the network prefix and the host identifier. The network prefix is used to identify the network that the IP address belongs to, while the host identifier is used to identify a specific host within that network.

IPv4: In IPv4, an IP address is 32 bits in length, with the first few bits determining the network prefix and the remaining bits determining the host identifier. The number of bits used for the network prefix is determined by the CIDR notation. For example, if the CIDR notation is /24, the first 24 bits of the IP address are used for the network prefix, while the remaining 8 bits are used for the host identifier.

To calculate the subnet in an IPv4 address, you need to know the IP address and the CIDR notation. Once you have this information, you can use the following steps:

  • Convert the IP address to binary
  • Take the first x bits of the binary IP address, where x is the number of bits in the CIDR notation
  • Convert the binary subnet back to decimal to get the subnet address

For example, let’s say the IP address is 192.168.1.5 and the CIDR notation is /24.

  • Convert the IP address to binary: 11000000.10101000.00000001.00000101
  • Take the first 24 bits of the binary IP address: 11000000.10101000.00000001
  • Convert the binary subnet back to decimal: 192.168.1.0

This means that the subnet address is 192.168.1.0, and the host address range is from .1 to .254

IPv6: In IPv6, an IP address is 128 bits in length, with the first few bits determining the network prefix and the remaining bits determining the host identifier. The number of bits used for the network prefix is determined by the CIDR notation. For example, if the CIDR notation is /64, the first 64 bits of the IP address are used for the network prefix, while the remaining 64 bits are used for the host identifier.

To calculate the subnet in an IPv6 address, you need to know the IP address and the CIDR notation. Once you have this information, you can use the following steps:

  • Convert the IP address to binary
  • Take the first x bits of the binary IP address, where x is the number of bits in the CIDR notation
  • Convert the binary subnet back to hexadecimal to get the subnet address

For example, let’s say the IP address is 2001:0db8:85a3:0000:0000:8a2e:0370:7334 and the CIDR notation is /64.

  • Convert the IP address to binary: 0010000000000001:0000110110111000:10000010110100011:0000000000000000:0000000000000000:
    1000101000101110:0000001101110000:0111001110110100
  • Take the first 64 bits of the binary IP address: 0010000000000001:0000110110111000:10000010110100011:0000000000000000
  • Convert the binary subnet back to hexadecimal: 2001:0db8:85a3:0000:0000:0000:0000:0000

This means that the subnet address is 2001:0db8:85a3:0000:0000:0000:0000:0000, and the host address range is the remaining 64 bits after the subnet.

In summary, CIDR notation is a method for allocating IP addresses and routing Internet Protocol packets, it was introduced as a replacement for the previous system of IP address allocation, known as Classful IP addressing. It allows for more fine-grained control over IP address allocation and provides a number of benefits such as more efficient use of IP address space, easier aggregation of routing information, reduction in the size of routing tables. It can be used with both IPv4 and IPv6 address.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Share via
Copy link
Powered by Social Snap