Router Packet Forwarding Decision
When a host sends a packet to another host in or outside the network. It will use the host routing table where to send the packets. If the destination host belongs to the same network, the host directly sends the data to the specific host without involving the default gateway. But while the destination host is not on the same network, the data is forwarded to the default gateway. When data arrives at the default gateway, which is generally a router. So, the routers consult their routing table to decide where to send this packet. The routing table of a router has information about the destination in the form of a different route in the routing table:
Directly connected routes
These routes come from the router’s active interfaces. When the Interface has an IP address configured and both status codes are up and up status, the subnet directly connected to a router’s interface is added to the router’s routing table. A router can route all packets destined for all hosts in the subnet directly connected to its active interfaces.
Remote routes
These routes come from remote networks connected to other routers. Routes to these networks can be manually or dynamically configured on the local router by the network administrator. The figure below identifies the directly connected networks and remote networks of Router-1. The network with a light blue rectangle is the directly connected network for Router-1, and the network in the light red rectangles is a remote network for Router-1.
Default route
Routers also use a default route as a gateway of last resort option if no other route is available to the desired network in the router’s routing table. The IP address 0.0.0.0 is reserved for a default route. If a router has no information about the incoming packet, it routes it to the interface where the default route has been configured.