When multiple routing table entries match a destination, the router selects the entry with the longest prefix. This is the most specific match.
Example: A packet destined for matches these routes:
- (matches first bits)
- (matches first bits)
- (matches first bits)
The router selects because it has the longest prefix ( bits). This route provides the most specific path to that destination.
Longest prefix match allows you to create hierarchical routing. General routes handle most traffic, while more specific routes override them for particular destinations.