Bitzu

JN0-106 ยท Networking fundamentals

Longest-match routing

How a router selects the most specific matching prefix from its table, including default routes, with worked lookup examples.

Key points

  • A router compares the destination address with every prefix in its table and, among the prefixes that contain it, selects the one with the longest prefix length (the most specific).
  • The default route 0.0.0.0/0 matches everything but has length 0, so it is used only when nothing more specific matches.
  • Example: for 10.1.1.9, routes 10.0.0.0/8, 10.1.0.0/16 and 10.1.1.0/24 all match and the /24 wins.

Practice questions

Single choice

When several routes match a destination, which one does the router use?

  1. The first one listed in the table
  2. The one with the longest prefix length
  3. The one with the shortest prefix length
  4. The one with the highest network number
Show answer

Answer: B. The one with the longest prefix length

The most specific match, meaning the longest prefix length, wins. Order in the table and the size of the network number are irrelevant.

Select all that apply

A packet is destined to 10.1.1.9. Which of these table entries match it?

  1. 10.0.0.0/8
  2. 10.1.0.0/16
  3. 10.1.1.0/24
  4. 10.2.0.0/16
  5. 192.168.0.0/16
Show answer

Answer: A. 10.0.0.0/8, B. 10.1.0.0/16, C. 10.1.1.0/24

10.0.0.0/8, 10.1.0.0/16 and 10.1.1.0/24 all contain 10.1.1.9. 10.2.0.0/16 and 192.168.0.0/16 do not.

True or false

True or false: the default route 0.0.0.0/0 is preferred over a /24 route because it matches every destination.

Show answer

Answer: False

False. The default route has the shortest possible prefix (0), so any more specific matching route beats it.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More JN0-106 topics in this module