Extracting Block Information in Classless Addresing
Extracting Block Information in Classless Addresing
In classless addresing
An address in slash notation (CIDR) contains all information we need
about the block:
the first address (network address), the number of addresses, and the last
address. These three pieces of information can be found as follows:
❑ The number of addresses in the block can be found as:
in which n is the prefix length and N is the number of addresses in the
block.
❑ The first address (network address) in the block can be found by
ANDing the address with the network mask: Alternatively, we can keep
the n leftmost bits of any address in the block and set
the 32n bits to 0s to find the first address.
❑ The last address in the block can be found by either adding the first
address with the number of addresses or, directly, by OR ing the address
with the complement (NOTing) of the network mask:
Alternatively, we can keep the n leftmost bits of any address in the block
and set the 32 n bits to 1s to find the last address.
Example
• b. We use the AND operation to find the first address (network address).The first
address is
• 167.199.170.64/27.
• N=2
• First address = (any address) AND (network mask)
• Last address = (any address) OR [NOT (network mask)]
167.199.170.82 IP
AND 255.255.255.240 SM
First Address 167.199.170.64
• Solution
• The network mask is 255.255.240.0.
• a. The number of addresses in the network is 232 20 = 4096.
• b. To find the first address, we apply the first short cut to bytes 1, 2, and 4 and the second
• short cut to byte 3. The first address is 110.23.112.0/20.
• c. To find the last address, we apply the first short cut to bytes 1, 2, and 4 and the second
• short cut to byte 3. The OR operation is applied to the complement of the mask. The last
• address is 110.23.127.255/20.
• Address in binary: 10100111 11000111 10101010 01010010
• Complement of network mask: 00000000 00000000 00000000 00011111
• Last address: 10100111 11000111 10101010 01011111
Example