Router Packet Forwarding Decision

When a host sends a packet to another host in the network 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 not on the same network; the data is forwarded to the default gateway. When a data arrives at the default gateway, which is generally a router. So the routers consult its 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 active interfaces. When Interface has an IP address configured and both status code in up and up status. Subnet directly connected to a router’s interface added to the router’s routing table. A router will be able to route all packets destined for all hosts in 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 networks for Router-1 and network in the light red rectangles are a remote network for Router-1.

Packet on remote and directly connected network

Default route 

Routers also use a default route as a gateway of last resort option if there is no other route available to the desired network in the routing table of the router.  The IP address reserved for a default route. If a router has no information about the incoming packet; it routes the packet to the interface where the default route has configured.

The Host Default Gateway and Routing Table