A router checks one destination against a small static table.

highlighted = computed this step

Forwarding starts with one destination

A router looks at the destination address on the packet and checks it against its table.

destination=192.168.1.130\text{destination}=192.168.1.130
Destination and routesThe destination is masked against every pinned route prefix.Longest prefix match - destination 192.168.1.130, winner 192.168.1.128/25 -> labprefixmaskdest & maskmatchnext hopwinner192.168.0.0/16255.255.0.0192.168.0.0yescoreno192.168.1.0/24255.255.255.0192.168.1.0yesfloor-1no192.168.1.128/25255.255.255.128192.168.1.128yeslabyes0.0.0.0/00.0.0.00.0.0.0yesdefaultno

The destination is exact

The pinned destination is 192.168.1.130. Nothing in this lesson guesses a location from the name.

dst=192.168.1.130\text{dst}=192.168.1.130
Destination and routesThe destination is masked against every pinned route prefix.Longest prefix match - destination 192.168.1.130, winner 192.168.1.128/25 -> labprefixmaskdest & maskmatchnext hopwinner192.168.0.0/16255.255.0.0192.168.0.0yescoreno192.168.1.0/24255.255.255.0192.168.1.0yesfloor-1no192.168.1.128/25255.255.255.128192.168.1.128yeslabyes0.0.0.0/00.0.0.00.0.0.0yesdefaultno

The table has overlapping routes

Several rows can match the same destination because some prefixes are broader and some are narrower.

route rows=4\text{route rows}=4
Destination and routesThe destination is masked against every pinned route prefix.Longest prefix match - destination 192.168.1.130, winner 192.168.1.128/25 -> labprefixmaskdest & maskmatchnext hopwinner192.168.0.0/16255.255.0.0192.168.0.0yescoreno192.168.1.0/24255.255.255.0192.168.1.0yesfloor-1no192.168.1.128/25255.255.255.128192.168.1.128yeslabyes0.0.0.0/00.0.0.00.0.0.0yesdefaultno

Summary

Longest-prefix matching starts by testing one exact destination against every route row.

rows checked=4\text{rows checked}=4
Destination and routesThe destination is masked against every pinned route prefix.Longest prefix match - destination 192.168.1.130, winner 192.168.1.128/25 -> labprefixmaskdest & maskmatchnext hopwinner192.168.0.0/16255.255.0.0192.168.0.0yescoreno192.168.1.0/24255.255.255.0192.168.1.0yesfloor-1no192.168.1.128/25255.255.255.128192.168.1.128yeslabyes0.0.0.0/00.0.0.00.0.0.0yesdefaultno