We will use Figure 1 to explain the basic concepts of Routing. When host 1 needs to send IP packets to host 2 it will see whether host 2 IP address is within its own subnet, since host 2 does not belong to the same subnet host 1 will send the packet to the default gateway. An important point to note here is that when host 1 sends the packet it will use the destination IP address of host 2 and a destination MAC address of the Router, since host 1 already has the IP address of default gateway it will use Address Resolution Protocol to obtain the MAC address. When the Router receives the Packet it will examine the destination IP address to make a routing decision to find an outgoing interface to forward the packet out. To make this decision the router must consult a table called the Routing table, this table at minimum must include two entries for successfully routing the Packet, a destination address and a pointer to the destination which can be a directly connected interface or an IP address of next hop router. The Pointer to the destination will finally recurse to an outgoing interface, the Router will then only change Layer 2 destination address that will now point to the next-hop router and the Layer 3 Header that contains source and destination IP address will remain intact. This process is repeated and every router independently performs a routing decision and switches packet from an incoming interface to an outgoing interface until the packet reaches the destination. If router does not have the information to successfully route a packet it will drop the packet and send an ICMP destination unreachable message.
The Routing Table can get routing information dynamically through Routing Protocols or it may be defined statically.
In case of static routing, an administrator has to define static routes on every router for every network in an internetwork. This process is cumbersome and a lot of manual intervention will be required when networks are removed and added. On the other hand dynamic routing will adapt to changes in the network and automatically converge.
We will use Figure 2 throughout the rest of the article to explain various routing concepts. If host 1 needs to communicate with host 2 every router in the path must be able successfully route the packet. It may be able to do so by gathering information dynamically through Routing Protocols or learn it manually through static routes. A static route can be defined on a Cisco Router using the following syntax
Config)# ip route network