In This Lesson We Will
- Review components of the routing table
- Review how a router makes forwarding decisions by default
Routing table and Routing Decisions
The router has two primary functions when it received an IP packet on an interface:
- Determine the best path to forward the packet based on its routing table
- Forward that packet to its destination
What is the best path? It’s called the “Longest Match.” The router will use the longest match process to find a match between the destination IP address and a routing entry in the routing table. Basically, the router will look at an IPv4 address in its binary form, and compare it to other IPv4 addresses in its routing table. The IPv4 address with the longest binary match is the path in which the router will choose to forward a packet. For instance, if the destination IP address is 10.0.0.24, and the routing table has the following addresses in its routing table:
It will convert the above address into binary, and find the address with the longest number of matching binary numbers, which of course would be 10.0.0.0, and forward the packet out that route.
What about IPv6?
The process is similar for IPv6, yet slightly simpler. For IPv6 routing decisions, the router is reviewing its routing table for matching prefix lengths. Say we have a destination IPv6 address of 2001:db8:c000:5555::/64, and a routing table as follows:
Which IPv6 address would be the longest match? We can tell based on the prefix length. /40 requires that the first 40 bits match, and they do, so this address is in the running. /48 has the same requires, but with an additional bits, making this one a longer match than the /40. The longest match is in fact /48. It cannot be the /64 address as this would require the first 64 bits match the destination address, which it does not.
Once the best path has been determined, the router do one of three things:
- Forward the packet to a device that directly connected to the network
- Forward the packet to a next-hop router
- Drop the packet as there is no match in the routing table
What’s in a routing table?
A routing table stores three types of routing entries:
- Directly Connected Networks – These are, as the name suggests, directly connected networks to a routers interface.
- Remote Networks – Again, as the name suggests, there are networks that are remote, or not connected to a routers interface. A router can only learn of remote networks by being configured by the administrator, or by learning routes from other routers via ND.
- Default Route – These are the routes the router chooses when there isn’t an explicitly better route to forward packets to. For instance, an administrator might configure that all packets for a remote network go out through a specifically configured router if there isn’t a better route found on the table.
Let’s examine what a routing table looks like for both IPv4 and IPv4, as decoding these will be required for the CCNA 200-301.
IPV4 Route Entry Example:
o 10.0.7.0/24 [110/50] via 10.0.5.4, 00:15:29, Serial0/1/1
The letters to the very left of the readout are the “Route Source.” Below are common route sources you would see:
L – Directly Connected local interface IP address
C – Directly Connected Network
S – Static route manually configured by the administrator
O – OSPF
D – EIGRP
The IPv4 address after the Route source is the destination network (10.0.7.0/24).
After that comes the Administrative Distance and the Metric. These are used to determined the trustworthiness and value assigned to each network. Lower values mean preferred routes.
The “via 10.0.5.4” is the next hop, the IP address of the next router to forward the packet to.
After that comes the route timestamp, which identifies how much time has passed since the route was learned.
Finally, the exit interface, which is the interface in which the packet will be forwarded out of.
The readout for IPv6 route entries are similar, with the IPv4 addresses being replaced by IPv6 addresses.
As always, if you’ve enjoyed this material and want to learn more, remember to subscribe to my newsletter for content every day on Every Day Tech, thank you!