Practical Approch to ClasslessInterDomainRouting(CIDR)
For example: I have an IP address like 10.94.0.0/16 ......
Normally CIDR notation can be written after the last 4th octet after the slash(/)...i.e. /16
An IP address is divided into 4
parts with each part separated by a dot. Each part is called an "Octet".
IP address above has the following octets:
Octet 1: 10
Octet 2: 94
Octet 3: 0
Octet 4: 0
====> 10.94.0.0
This is called dotted decimal format.
Each octet can be translated into binary which is what computer uses when transmitting data on the network.
When written in binary each octet has 8 bits:
IP address above has the following octets:
Octet 1: 10
Octet 2: 94
Octet 3: 0
Octet 4: 0
====> 10.94.0.0
This is called dotted decimal format.
Each octet can be translated into binary which is what computer uses when transmitting data on the network.
When written in binary each octet has 8 bits:
Octet 1: 00001010 --> 10
Octet 2: 01011110 --> 94
Octet 3: 00000000 --> 0
Octet 4: 00000000 --> 0
==> 00001010.01011110.00000000
The CIDR notation of /16 is used to describe what subnet we use.
CIDR notation always describes a subnet
written in binary.
The number 16 refers to the number bits that are
"turned on(1-bits)" meaning how many bits are "1" ---> 16 means sixteen 1's written as below.
Starting from the left of the
IP address (in binary format) turn on the first 16 bits as below to
write out the subnet mask.
11111111.11111111.00000000.00000000
When we translate this back to dotted decimal format we get
Subnet Mask: 255.255.0.0
11111111.11111111.00000000
When we translate this back to dotted decimal format we get
Subnet Mask: 255.255.0.0
IP Address : 10.94.0.0
When a computer, router or any layer 3 networking device receives a packet it performs an "AND" with the IP address and the subnet mask to figure out what subnet the IP address is in.
IP Ad: 00001010.
01011110.
00000000.00000000
Mask: 11111111.11111111.00000000.00000000
AND 00001010.
01011110.
00000000.00000000
SO Finally Subnet is 10.94.0.0
ip address in CIDR notation is 10.94.xxx.xxx/16.
The xxx can be any number from 0 to 255.
The subnet (i.e. Network Address) is always the first IP address available and
the Broadcast Address is always the last address available.
Subnet: 10.94.0.0
Broadcast: 10.94.255.255
So we always have 2 IP addresses we cannot use.
So we can have hosts starting at 10.94.0.1 and ending at 10.94.255.254. This range is available address range
To calculate the number of hosts
first translate subnet mask to binary:
255.255.0.0 = 11111111.11111111.00000000.00000000
Count the number of zeros = 16
Now we raise the number 2 to the power of 16 i.e. 2^16 = 65536 (we use 2 because we are dealing with binary, each bit has 2 states, 0 or 1)
Lastly, remember we always have 2 IP addresses we cannot use, for network address and broadcast address (or 3 if we count the Default Gateway too).
So in total we have 65536 -2 = 65534 hosts in a CIDR /16 network
Below describes all the CIDR notations and its available hosts in detail:
IPv4 CIDR blocks
IPv4 CIDR IP/CIDR | 0 to last IP addr | Mask | Hosts | Size | Notes |
a.b.c.d/32 | +0.0.0.0 | 255.255.255.255 | 1 | 1/256 C | |
a.b.c.d/31 | +0.0.0.1 | 255.255.255.254 | 2 | 1/128 C | d = 0 ... (2n) ... 254 |
a.b.c.d/30 | +0.0.0.3 | 255.255.255.252 | 4 | 1/64 C | d = 0 ... (4n) ... 252 |
a.b.c.d/29 | +0.0.0.7 | 255.255.255.248 | 8 | 1/32 C | d = 0 ... (8n) ... 248 |
a.b.c.d/28 | +0.0.0.15 | 255.255.255.240 | 16 | 1/16 C | d = 0 ... (16n) ... 240 |
a.b.c.d/27 | +0.0.0.31 | 255.255.255.224 | 32 | ⅛ C | d = 0 ... (32n) ... 224 |
a.b.c.d/26 | +0.0.0.63 | 255.255.255.192 | 64 | ¼ C | d = 0, 64, 128, 192 |
a.b.c.d/25 | +0.0.0.127 | 255.255.255.128 | 128 | ½ C | d = 0, 128 |
a.b.c.0/24 | +0.0.0.255 | 255.255.255.000 | 256 | 1 C | |
a.b.c.0/23 | +0.0.1.255 | 255.255.254.000 | 512 | 2 C | c = 0 ... (2n) ... 254 |
a.b.c.0/22 | +0.0.3.255 | 255.255.252.000 | 1,024 | 4 C | c = 0 ... (4n) ... 252 |
a.b.c.0/21 | +0.0.7.255 | 255.255.248.000 | 2,048 | 8 C | c = 0 ... (8n) ... 248 |
a.b.c.0/20 | +0.0.15.255 | 255.255.240.000 | 4,096 | 16 C | c = 0 ... (16n) ... 240 |
a.b.c.0/19 | +0.0.31.255 | 255.255.224.000 | 8,192 | 32 C | c = 0 ... (32n) ... 224 |
a.b.c.0/18 | +0.0.63.255 | 255.255.192.000 | 16,384 | 64 C | c = 0, 64, 128, 192 |
a.b.c.0/17 | +0.0.127.255 | 255.255.128.000 | 32,768 | 128 C | c = 0, 128 |
a.b.0.0/16 | +0.0.255.255 | 255.255.000.000 | 65,536 | 256 C = 1 B | |
a.b.0.0/15 | +0.1.255.255 | 255.254.000.000 | 131,072 | 2 B | b = 0 ... (2n) ... 254 |
a.b.0.0/14 | +0.3.255.255 | 255.252.000.000 | 262,144 | 4 B | b = 0 ... (4n) ... 252 |
a.b.0.0/13 | +0.7.255.255 | 255.248.000.000 | 524,288 | 8 B | b = 0 ... (8n) ... 248 |
a.b.0.0/12 | +0.15.255.255 | 255.240.000.000 | 1,048,576 | 16 B | b = 0 ... (16n) ... 240 |
a.b.0.0/11 | +0.31.255.255 | 255.224.000.000 | 2,097,152 | 32 B | b = 0 ... (32n) ... 224 |
a.b.0.0/10 | +0.63.255.255 | 255.192.000.000 | 4,194,304 | 64 B | b = 0, 64, 128, 192 |
a.b.0.0/9 | +0.127.255.255 | 255.128.000.000 | 8,388,608 | 128 B | b = 0, 128 |
a.0.0.0/8 | +0.255.255.255 | 255.000.000.000 | 16,777,216 | 256 B = 1 A | |
a.0.0.0/7 | +1.255.255.255 | 254.000.000.000 | 33,554,432 | 2 A | a = 0 ... (2n) ... 254 |
a.0.0.0/6 | +3.255.255.255 | 252.000.000.000 | 67,108,864 | 4 A | a = 0 ... (4n) ... 252 |
a.0.0.0/5 | +7.255.255.255 | 248.000.000.000 | 134,217,728 | 8 A | a = 0 ... (8n) ... 248 |
a.0.0.0/4 | +15.255.255.255 | 240.000.000.000 | 268,435,456 | 16 A | a = 0 ... (16n) ... 240 |
a.0.0.0/3 | +31.255.255.255 | 224.000.000.000 | 536,870,912 | 32 A | a = 0 ... (32n) ... 224 |
a.0.0.0/2 | +63.255.255.255 | 192.000.000.000 | 1,073,741,824 | 64 A | a = 0, 64, 128, 192 |
a.0.0.0/1 | +127.255.255.255 | 128.000.000.000 | 2,147,483,648 | 128 A | a = 0, 128 |
0.0.0.0/0 | +255.255.255.255 | 000.000.000.000 | 4,294,967,296 | 256 A |
Comments
Post a Comment