-1

I am working through problems for practice and have been given:

Consider a datagram network using 8-bit host addresses. Suppose a router uses longest prefix matching and has the following forwarding table:

| Prefix Match | Interface |
| 1            | 0         |
| 10           | 1         |
| 111          | 2         |
| otherwise    | 3         |

Which works out to:

1100 0000 to 1101 1111 for 0
1000 0000 to 1011 1111 for 1
1110 0000 to 1111 1111 for 2
0000 0000 to 0111 1111 for 3

For the range for 0, why does the prefix match not state 110, the longest prefix match? What steps can I take to think about and calculate this range?

Ron Maupin
  • 3,243
  • 1
  • 12
  • 20
Jean480
  • 11
  • 3

1 Answers1

0

This question is a little tricky, I had been using the assumption that there was a sequential progression in ranges. I realized that neither interface 0, 1, or 2 included a destination address of 0000 0000, thus it would be the start of the otherwise range. To determine the end of the otherwise range I needed to know the least possible value not accounted for in other prefix matches. Thus, subtracting 1 for interface's 0 prefix match yielded 0111 1111.
0000 0000 to 0111 1111 for 3

Having determined the start of the ranges, can I determine the end? Yep! Interface 2 will stop at 1111 1111, knowing the prefix match between the two was created using AND logic comparison, only 1110 0000 would generate the prefix match of 111
So far I have:
0000 0000 to 0111 1111 for 3
1XXX XXXX to 1XXX XXXX for 0
10XX XXXX to 10XX XXXX for 1
1110 0000 to 1111 1111 for 2

If 1110 0000 is the start of the range for interface 2, then subtracting 1 from it will give me the end of the lower adjacent range, being 1101 1111. Now, if I were to pass the address 1101 1111 through the forwarding table it would exit interface 0. Thus, 1101 1111 is the end range for interface 0. Rearranging my table according to the ranges I have:
0000 0000 to 0111 1111 for 3
10XX XXXX to 10XX XXXX for 1
1XXX XXXX to 1101 1111 for 0
1110 0000 to 1111 1111 for 2

Now, adding 1 to the end range of interface 3 yields: 1000 0000. Passing this value through the forwarding table would have it exit interface 1. Thus, 1000 0000 is the start of the range for interface 1.
0000 0000 to 0111 1111 for 3
1000 0000 to 10XX XXXX for 1
1XXX XXXX to 1101 1111 for 0
1110 0000 to 1111 1111 for 2

All that is left to determine is where the start of interface 0 is, if it was 1000 0000 it would have overlapped with interface 1. Thus, 1100 0000 is the only address that would prefix match with it and only it. Subtract 1 from 1100 0000 and the end of interface 1 address range is yielded.
0000 0000 to 0111 1111 for 3
1000 0000 to 1011 1111 for 1
1100 0000 to 1101 1111 for 0
1110 0000 to 1111 1111 for 2

Does anyone have any input on this?

Jean480
  • 11
  • 3