Network Layer — IP — Internet Protocol

The key to all this is the following relations of decimal versus binary:

Decimal Binary How the binary is built
0 00000000
128 10000000 (128)
192 11000000 (128 + 64)
224 11100000 (128 + 64 + 32)
240 11110000 (128 + 64 + 32 + 16)
248 11111000 (128 + 64 + 32 + 16 + 8)
252 11111100 (128 + 64 + 32 + 16 + 8 + 4)
254 11111110 (128 + 64 + 32 + 16 + 8 + 4 + 2)
255 11111111 (128 + 64 + 32 + 16 + 8 + 4 + 2 + 1)

Given that, we can build the following table:

Useful only for| Useful for subnets | Useful for subnets | Useful for subnets
CIDR blocks | of /8, or for CIDR | of /8 or /16, or for | of any networks
of any networks| blocks of /16 and | CIDR blocks of /24 |
| /24 networks | networks |
| | |
0.0.0.0 /0 | 255.0.0.0 /8 | 255.255.0.0 /16 | 255.255.255.0 /24
128.0.0.0 /1 | 255.128.0.0 /9 | 255.255.128.0 /17 | 255.255.255.128 /25
192.0.0.0 /2 | 255.192.0.0 /10 | 255.255.192.0 /18 | 255.255.255.192 /26
224.0.0.0 /3 | 255.224.0.0 /11 | 255.255.224.0 /19 | 255.255.255.224 /27
240.0.0.0 /4 | 255.240.0.0 /12 | 255.255.240.0 /20 | 255.255.255.240 /28
248.0.0.0 /5 | 255.248.0.0 /13 | 255.255.248.0 /21 | 255.255.255.248 /29
252.0.0.0 /6 | 255.252.0.0 /14 | 255.255.252.0 /22 | 255.255.255.252 /30
254.0.0.0 /7 | 255.254.0.0 /15 | 255.255.254.0 /23 | 255.255.255.254 /31

Note that not all combinations are really useful, apply the follow exceptions.

0.0.0.0 isn’t useful for much of anything at all. Plus, those CIDR blocks represented by the first column are awfully big! Unless you’re running a backbone, or selling IP space to a continent, you probably won’t encounter them.

255.0.0.0, 255.255.0.0, and 255.255.255.0 define the classful /8, /16, and /24, or Class A, B, and C, respectively. They cannot define subnets of their own classful nets.

255.254.0.0, 255.255.254.0, and 255.255.255.254 cannot define subnets of /8, /16, and /24 nets, respectively, as that would only allow one bit for the host number, and that is not allowed by the RFC’s.
Really Simple CIDR Block Rule

To answer the question, “Does this set of classful network addresses form a CIDR block”, instead answer the following question.
Is there a netmask /X such that:

* The first X bits of all network addresses in the set are identical, and
* The remaining bits of all network addresses exhibit all possible patterns.

If so, the answer is “Yes”, and the CIDR block description is the first network address followed by /X.

As an example, this is a CIDR block, divided as indicated:

| Host bits
| ———
200.201.200.0 = 1100 1000 1100 1001 1100 10|00 xxxx xxxx
200.201.201.0 = 1100 1000 1100 1001 1100 10|01 xxxx xxxx
200.201.202.0 = 1100 1000 1100 1001 1100 10|10 xxxx xxxx
200.201.203.0 = 1100 1000 1100 1001 1100 10|11 xxxx xxxx
<—– 22 constant bits —->|<- varying ->
CIDR block = 200.201.200.0/22

But this is not a CIDR block:

| Host bits
| ———
200.201.201.0 = 1100 1000 1100 1001 1100 1|001 xxxx xxxx
200.201.202.0 = 1100 1000 1100 1001 1100 1|010 xxxx xxxx
200.201.203.0 = 1100 1000 1100 1001 1100 1|011 xxxx xxxx
200.201.204.0 = 1100 1000 1100 1001 1100 1|100 xxxx xxxx
<—– 22 constant bits —>|<– varying ->

Not all combinations of the last three bits of the classful network designations are used, so the above is not a CIDR block. But it shows us what would have to be added to make it one, as seen below:

| Host bits
| ———
200.201.200.0 = 1100 1000 1100 1001 1100 1|000 xxxx xxxx <– added!
200.201.201.0 = 1100 1000 1100 1001 1100 1|001 xxxx xxxx
200.201.202.0 = 1100 1000 1100 1001 1100 1|010 xxxx xxxx
200.201.203.0 = 1100 1000 1100 1001 1100 1|011 xxxx xxxx
200.201.204.0 = 1100 1000 1100 1001 1100 1|100 xxxx xxxx
200.201.205.0 = 1100 1000 1100 1001 1100 1|101 xxxx xxxx <– added!
200.201.206.0 = 1100 1000 1100 1001 1100 1|110 xxxx xxxx <– added!
200.201.207.0 = 1100 1000 1100 1001 1100 1|111 xxxx xxxx <– added!
<—– 22 constant bits —>|<– varying ->
CIDR block = 200.201.200.0/21

A VLSM Example

The best place to look is the 3com paper (see above), but here’s a fairly simple example. Let’s say you’re allocated the /24 address space 200.201.202.0/24, and you have to address hosts on the following networks:

* Six point-to-point WAN links (2 IP addresses each for end points)
* Six LAN’s:
o 60 hosts (LAN #1)
o 50 hosts (LAN #2)
o 25 hosts (LAN #3)
o 20 hosts (LAN #4)
o 10 hosts (LAN #5)
o 10 hosts (LAN #6)

Assign the addresses as below, where bits marked “x” can take all possible patterns other than all zeros and all ones.

Number Final
IP Addresses, Dotted-Quad and Binary Net Base Address of Hosts Octet
——————————————————————————–
200 . 201 . 202 . ???
1100 1000 1100 1001 1100 1010 01xx xxxx 200.201.202.64/26 62 65-126
1100 1000 1100 1001 1100 1010 10xx xxxx 200.201.202.128/26 62 128-190
1100 1000 1100 1001 1100 1010 001x xxxx 200.201.202.32/27 30 33- 62
1100 1000 1100 1001 1100 1010 110x xxxx 200.201.202.192/27 30 193-222
1100 1000 1100 1001 1100 1010 1110 xxxx 200.201.202.224/28 14 225-238
1100 1000 1100 1001 1100 1010 0001 xxxx 200.201.202.16/28 14 17- 30
1100 1000 1100 1001 1100 1010 0000 01xx 200.201.202.4/30 2 5- 6
1100 1000 1100 1001 1100 1010 0000 10xx 200.201.202.8/30 2 9- 10
1100 1000 1100 1001 1100 1010 0000 11xx 200.201.202.12/30 2 13- 14
1100 1000 1100 1001 1100 1010 1111 00xx 200.201.202.240/30 2 241-242
1100 1000 1100 1001 1100 1010 1111 01xx 200.201.202.244/30 2 245-246
1100 1000 1100 1001 1100 1010 1111 10xx 200.201.202.248/30 2 249-250

Final octet for host addresses on each network:
Minimum = final octet of base address plus one
Maximum = final octet of base address plus number of hosts
Final octet for broadcast on each net:
Broadcast = final octet of base address plus one plus number of hosts

Leave a Reply