CIDR Notation – Understanding the Slash After an IP Address

ipv4subnet

What does the "/16" means in here : "192.168.0.0/16", for example.

Best Answer

A simple explanation:

The /<number> is how a computer can quickly calculate what is part of its network and what is not. It represents the bit length of the subnet mask, as indicated above. The subnet mask is like masking when painting. You place a mask over what you DO NOT want to paint on. The subnet mask is a way to calculate the network portion of the address space and the host address space. The network address space is assigned to you, the host address space you define which device receives what address in the host space.

A computer performs binary math of ANDing the IP address and the network mask.

IP Address 10.10.15.10/16

Step 1) Translate the IP address 4 octets into binary: 00001010.00001010.00001111.00001010

Step 2) Translate the Subnet mask 4 octets into binary, which is easy using CIDR: 11111111.11111111.00000000.00000000

Step 3) Perform the ANDing operation on the two addresses. This will give you the Network Address for the subnet.

ANDing rules are as follows:

  • 1 AND 1 = 1
  • 0 AND 1 = 0
  • 0 AND 0 = 0
  • 1 AND 0 = 0
         00001010.00001010.00001111.00001010
     AND 11111111.11111111.00000000.00000000
         ———————————————————————————————————
         00001010.00001010.00000000.00000000

Step 4) Convert it back to decimal: 10.10.0.0

So now a computer knows that any address from 10.10.0.0 to 10.10.255.255 is part of its network and any other address is not.

It's like a binary network gang thing, you are in or you are not.

Related Topic