DSA Factory
Free IP addressing and routing lessonsIP addressing and routing · Stage 1 · Forwarding and routing · Step 1

Forwarding and longest-prefix match

See how a router chooses an outgoing interface from its table when several entries match. About 13 minutes.

Quick check

A router has routes for 192.168.0.0/16 and 192.168.5.0/24. A packet is for 192.168.5.20. Which route is used?

  1. A192.168.5.0/24, because it is the longest matching prefix
  2. B192.168.0.0/16, because it was added first
  3. CEither: they're equivalent
Show the answer

192.168.5.0/24, because it is the longest matching prefix. Both match; the more specific one wins.

Lock it in

4 questions on this idea

Short questions that apply the idea to new cases: trace it, work out a number, put steps in order. A wrong answer explains itself.

Answer them in your browserFree account, no card. Your progress is saved, and the idea comes back in a quick review later.
Sign up free to solve