3.1 Routing
3.1.1 Routing fundamentals
One of a router's primary jobs is to make decisions about which path is the best path to a given destination. A router learns paths, called routes, from an administrator's configuration or from other routers via routing protocols. Routers keep a routing table in RAM. A routing table is a list of the best available routes. Routers use this table to make decisions about how to forward a packet. You can issue the show ip route command to view the TCP/IP routing table, an example of which is shown in Figure .

A routing table maps network prefixes to an outbound interface. Consider the routing table shown in Figure . When RTA receives a packet destined for 192.168.4.46, it looks for the prefix 192.168.4.0/24 in its table.  RTA then forwards the packet out an interface (Ethernet0) based on the routing table entry. If RTA receives a packet destined for 10.3.21.5, it sends that packet out Serial0 (S0).

The first few lines in Figure list possible codes that designate how the IP router learned the route. The example table shows four routes for directly connected networks. They are labeled with a C in the routing table. RTA drops any packet destined for a network that is not listed in the routing table. To forward to other destinations, RTA's table will have to include more routes. New routes can be added via one of two methods:

  • Static routing - An administrator manually defines routes to one or more destination networks.
  • Dynamic routing - Routers follow rules defined by a routing protocol to exchange routing information and independently select the best path.

Administratively defined routes are said to be static because they do not change until a network administrator manually programs the changes. Routes learned from other routers are dynamic because they can change automatically as neighboring routers update each other with new information. Each method has fundamental advantages and disadvantages, as listed in Figure and .

The following sections describe how to configure both static and dynamic routing on a Cisco router.