Another Example For Illustration:: (How It Works Practically)
Another Example For Illustration:: (How It Works Practically)
Figure 4
.
See the network configuration shown in Figure 4. Can you observe that each organization has
how many addresses? (Ans = 64) Hint: 32-26 = 6 , So 2^6 = 64). Note that 140.24.7.0 is the first
address of four blocks assigned to the four organizations. Also note that this is a typical situation
in which the four organizations are independent of each other. It may so happen that the
distances of all the four may be all different from router R1. For the Router R2, any packet with
destination 140.24.7.0 to 140.24.7.255 (64 addresses X 4 = 256) is sent out from interface m0
(the first address) regardless of the organization number. [Can you now justify the /24 mask in
the routing table of R2? {This is because 32-24 = 8, and 2^8 = 256} This is called address
aggregation because the blocks of addresses for four organizations are aggregated into one larger
block. This is not sub-netting but similar to it.
The routing table is as shown:
The principle of longest mask matching is very important in routing in classless addressing .This
principle states that the routing table is sorted from the longest mask to the shortest mask. In
other words, if there are three masks /27, /26, and /24, the mask /27 must be the first entry and
/24 must be last. This is used for choosing an entry from a forward route table. How this helps,
let us now understand. Routers forward a packet using forwarding table entries. The network
address of incoming packet may match multiple entries. To resolve this overlap of network
addresses or prefix of different entries in forwarding table, Routers forward the incoming packet
to the router which has the longest prefix matching with the incoming packet.
Forwarding tables often contain a default route, which has the shortest possible prefix match, to
fall back on in case matches with all other entries fail.
Solution We need to find out matching table entries for incoming packet with address
131.23.151.76”. . Perform the AND operation of this address with all the four masks:
Masks: row 1: 255.240.0.0 ; row 2: 255.252.0.0; row 3: 255.255.0.0; row4 : 255.254.0.0
the results are: 131.16.0.0, 131.20.0.0, 131.23.0.0, and 131.22.0.0 The address matches with two
entries “131.16.0.0/12” and “131.22.0.0/15”. So should the packet go to interface 3 or 1? We use
Longest Prefix Matching to decide among two. Compare 131. 00010110.0.0 and
130.00010000.0.0.The most specific of the matching table entries is used as the interface. The
most specific of the matching table entries — the one with the longest subnet mask — is called the
longest prefix match. It is called this because it is also the entry where the largest numbers of
leading address bits of the destination address match those in the table entry. Since
“131.22.0.0/15” is most specific, the packet goes to interface 1.
Example #2 When you look-up the address 192.168.20.19 in the forwarding table, having two
entries 192.168.20.16/28 and 192.168.0.0/16 which one will be selected ?
Solution : You can work out to verify that that both entries in forwarding table match. In this
case, the longest prefix of the candidate routes is 192.168.20.16/28, since its subnet mask (/28) is
longer than the other entry's mask (/16), making the route more specific
Example #3 1What is the route for a destination 92.168.100.50 for the routing table
192.168.100.0/24 or 192.168.0.0/16 ?
Try to understand that the prefix is the route itself
11000000.10101000.01100100.00000000 192.168.100.0/24
11000000.10101000.00000000.00000000 192.168.0.0/16
Then you use the subnet mask to get the prefix. Use the number of bits in the subnet mask,
starting from the left.
192.24.12.0/22 B
(a)For each interface m1, m2, and m3, identify the address ranges and their overlapping if any.
(b) Determine the interface of the following addresses
(i) 172.58.218.80 (ii)172.58.165.90 (iii)172.58.124.36 (iv)172.58.169.18 (v)172.58.155.112 and
(vi) 172.59.12.142
Solution /n : means (32-n) bits from right are host bits: make them zero to get the staring IP
address and make them all 1 to get the end address [Verify that this works , we have solved
problems in subnet design of this type] . Using this scheme you can quickly get the ranges
m1: 172.58.128.0/17 Starting -> 172.58.128.0 Ending -> 172.58.255.255
The 1's in the last octet yields 255 (8 1's). The 1's in the 3rd octet yields 127 (7 1's) & adding this
to the netmask of 128, we get 255.
Consider 13 (32-19) bits from right, make them all 0 to get the starting IP address in this range &
make them all 1 to get the ending IP address (3rd octet: 128 + 31 [5 1's] = 159)
The following table shows the possible overlaps with the interface ranges as follows.
Longer the horizontal division (as in case of m2 & m3) more specific the prefix is & should be
chosen in case of overlapping ranges. The ranges of m2 & m3 are independent (i.e., don't
overlap) but both overlap with the range of m1.
Verify that the given IP addresses match as follows against the correct range.