Page 160 - DCAP207_NETWORKS_DCAP406_COMPUTER_NETWORKS
P. 160
Unit 10: Network Layer in the Internet
indicated in the second row and put zero for the remaining bit and then convert back to Notes
decimal number. This will be the entry in that column. For our example the entry in third
column of first row is 10. Therefore, the binary equivalent is 00001010. Again the third
column of second row is having 6. It means we have to take 6 bits as such from high bi side
and converting the remaining two bits as 00. This will give us a binary number as 00001000
which is decimal equivalent to 8. Therefore, the entry 8 will go in that column.
192 168 10 25
8 8 6 0
192 168 8 0
This gives the subnet prefix for the IPv4 address configuration 192.168.10.25/22 as 192.168.204.0/
22.
Now, we have to extract the subnet prefix from an arbitrary IPv4 address using an arbitrary
subnet mask. For this purpose a mathematical operation logical AND is used. A logical
comparison between the 32-bit IP address and the 32-bit subnet mask is performed. It gives the
subnet prefix. For example, we may consider the following possible addresses for Class C.
Class C Network Bit Representation Address Range
210.195.8.0 11010010-11000011-00001000-xxxxxxxx 210.195.8.0-211.195.8.255
210.195.9.0 11010010-11000011-00001001-xxxxxxxx 210.195.9.0-211.195.9.255
210.195.10.0 11010010-11000011-00001010-xxxxxxxx 210.195.10.0-211.195.10.255
210.195.11.0 11010010-11000011-00001011-xxxxxxxx 210.195.11.0-211.195.11.255
These Class C networks define the contiguous set of addresses from 210.195.8.0 to 210.195.11.255.
On examining these addresses, it is observed that the first 22 bits are same for each address.
It means that any of these Class C networks has 22 bit network number followed by a 10 bit local
identifier for hosts. A router then can extract the network number using a logical AND operation
between a 22-bit subnet mask and an IP address. For this example, we can say that a router can
represent the four networks using the single entry 210.195.8.0/22, where /22 indicates the network
number is 22 bits long. Likewise, 210.195.8.0/20 address would first 20 bits and so on. This
indicates that we are grouping different smaller networks together and they are being treated
same for the routing purposes.
Let us know take an example. Our IPv4 address is 210.195.8.0 and a 22 bit subnet mask is
255.255.252.0.
11010010 – 11000011 – 000010xx – xxxxxxxx (IP Address)
and
11111111 - 11111111 - 11111100 - 00000000 (22 bit subnet mask)
11010010 - 11010011 - 00001000 - 00000000 (network number)
(210) (195) (8) (0)
The result of the bit-wise logical AND of the 32 bits of the IPv4 address and the subnet mask is
the subnet prefix 210.195.8.0. It may therefore be noted that the bits in the fixed portion of the
address (in which the bits in the subnet mask are set to 1), the subnet prefix bits are copied from
the IPv4 address, essentially extracting the subnet prefix of the IPv4 address. On the other side,
the bits in the variable portion of the address where these are set to zero, the subnet prefix bits
are also set to 0 and thus discarding the host ID portion of the IPv4 address.
LOVELY PROFESSIONAL UNIVERSITY 153