Search code examples
network-programmingroutesiproutercidr

Networks: Classless Inter Domain Routing


Can anyone help me out in my revision of networks by helping me understand this question and how to go about answering it?


A router supporting variable length subnet masks and classless inter-domain routing (CIDR) has the following forwarding entries:

enter image description here

Showing full details of your working identify: Which next hop entries would match each of the following destination IP addresses, and in each case, which next hop would the router select?

  1. 10.20.96.16

  2. 10.20.130.16

  3. 192.168.87.4

  4. 192.168.89.2


Solution

  • It is simple.The mask corresponding to the entries are as follows:

    0.0.0.0/0 has mask 00000000 00000000 00000000 00000000

    10.20.0.0/17 has mask 11111111 11111111 10000000 00000000

    10.20.64.0/18 has mask 11111111 11111111 11000000 00000000

    192.168.80.0/21 has mask 11111111 11111111 11111000 00000000

    192.168.88.0/22 has mask 11111111 11111111 11111100 00000000

    Considering first address 10.20.96.16

    In binary : 00001010 00010100 01100000 00010000

    It is ANDed with the masks of various entries and result is compared with base address of corresponding entry, looking for a match.The entries that match are:

    A,B,C

    For example after performing AND operation with mask of 2nd entry you get

    0000 1010 00010100 00000000 00000000 and this matches base address 10.20.0.0

    But router selects the longest prefix match, so C is selected as next hop.

    Considering second address 10.20.130.16, performing similar procedure,the next hop entries that match are:

    A

    and since only one match the next hop selected by router is A

    For third address 192.168.87.4, performing similar procedure,the next hop entries that match

    A,D

    and the router selects the next hop as D(longest prefix match)

    For fourth address 192.168.89.2,performing similar procedure,the next hop entries that match

    A,E

    and router selects E as the next hop.