30% off every course until Sunday, October 11. Our biggest update yet, and we'd like you to try it. Applied automatically at checkout.

Choose your certification
Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

4.2.1. Longest Prefix Match

The router always prefers the most specific route (longest prefix). For each packet it strips the incoming frame to read the destination IP, collects every route whose prefix contains that address, picks the longest, and then builds a new Layer 2 frame (new source and destination MAC) for the chosen next hop.

Example: Destination 192.168.1.50

  • Route A: 192.168.0.0/16 (covers .50 ✓)
  • Route B: 192.168.1.0/24 (covers .50 ✓) ← Selected (more specific)
  • Route C: 10.0.0.0/8 (doesn't cover .50 ✗)
See how it connects
Alvin Varughese
Written byAlvin Varughese
Founder•20 professional certifications