0% found this document useful (0 votes)
63 views5 pages

Another Example For Illustration:: (How It Works Practically)

The document discusses longest prefix matching in routing tables. It provides examples of how to determine the next hop interface for a destination address when there are multiple matching entries in the routing table. The key points are: 1) The routing table entry with the longest matching prefix is used, as it is the most specific. 2) Addresses are converted to binary to determine the matching prefix lengths. 3) Overlapping address ranges in the forwarding table use the entry with the longest prefix.

Uploaded by

virat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views5 pages

Another Example For Illustration:: (How It Works Practically)

The document discusses longest prefix matching in routing tables. It provides examples of how to determine the next hop interface for a destination address when there are multiple matching entries in the routing table. The key points are: 1) The routing table entry with the longest matching prefix is used, as it is the most specific. 2) Addresses are converted to binary to determine the matching prefix lengths. 3) Overlapping address ranges in the forwarding table use the entry with the longest prefix.

Uploaded by

virat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

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.

Example #1 Classless Inter-domain Routing (CIDR) receives a packet with address


131.23.151.76. The router’s routing table has the following entries. On which identifier of the
output interface will this packet be forwarded?
Prefix Output Interface Identifier
131.16.0.0/12 3
131.28.0.0/14 5
131.19.0.0/16 2
131.22.0.0/15 1

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.

11000000.10101000.01100100 is the prefix for 192.168.100.0/24


11000000.10101000 is the prefix for 192.168.0.0/16
Now when you are choosing a route for a destination you will convert your destination IP to
binary and choose the route with the longest prefix that matches. You can see that the destination
for matches both route prefixes ( Do it yourself to verify this ) and so it chooses the longer prefix
of 192.168.100.0/24

Example #4 Consider the forwarding table below : Addresses from 192.24.12.0 to


192.24.15.255 overlap, i.e., match with both entries of the table. In the above example, all
packets in overlapping range (192.24.12.0 to 192.24.15.255) are forwarded to next hop B as B
has longer prefix (22 bits). PREFIX NEXT-HOP
192.24.0.0/18 D

192.24.12.0/22 B

Example # 5 The following is a forwarding table


Destination Interface
0.0.0.0/0 m0
172.58.128.0/17 m1
172.58.128.0/19 m2
172.58.160.0/19 m3

(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.

m2: 172.58.128.0/19 Starting -> 172.58.128.0 Ending -> 172.58.159.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)

m3: 172.58.160.0/19 Starting -> 172.58.160.0 Ending -> 172.58.191.255

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.

(i) 172.58.218.80 -> m1


(ii) 172.58.165.90 -> m3
(iii) 172.58.124.36 -> m0
(iv) 172.58.169.18 -> m3
(v) 172.58.155.112 -> m2
(vi) 172.59.12.142 -> m0

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy