CIDR Notation - CIDR Notation

CIDR Notation

CIDR notation is a compact representation of an IP address and its associated routing prefix. The notation is constructed from the IP address and the prefix size, the latter being equivalent to the number of leading 1 bits in the routing prefix mask. The IP address is expressed according to the standards of IPv4 or IPv6. It is followed by a separator character, the slash ('/') character, and the prefix size expressed as a decimal number.

The address may denote a single, distinct interface address or the beginning address of an entire network. The maximum size of the network is given by the number of addresses that are possible with the remaining, least-significant bits below the prefix. This is often called the host identifier.

For example:

  • 192.168.100.0/24 represents the given IPv4 address and its associated routing prefix 192.168.100.0, or equivalently, its subnet mask 255.255.255.0.
  • the IPv4 block 192.168.100.0/22 represents the 1024 IPv4 addresses from 192.168.100.0 to 192.168.103.255.
  • the IPv6 block 2001:db8::/48 represents the IPv6 addresses from 2001:db8:0:0:0:0:0:0 to 2001:db8:0:ffff:ffff:ffff:ffff:ffff.
  • ::1/128 represents the IPv6 loopback address. Its prefix size is 128, i.e. the size of the address itself, indicating that this facility consists of only this one address.

Before CIDR notation, IPv4 networks were represented using dot-decimal notation for both the address and the subnet mask. Thus, 192.168.100.0/24 would be written as 192.168.100.0/255.255.255.0.

The number of addresses of a subnet defined by the mask or prefix can be calculated as 2address size - prefix size, in which the address size is 128 for IPv6 and 32 for IPv4. For example, in IPv4, a prefix size of /29 gives: 232-29 = 23 = 8 addresses.

Read more about this topic:  CIDR Notation