Enabling Static Routing
Routing is the process of determining where to send data packets destined for addresses outside the local network. Routers gather and maintain routing information to enable the transmission and receipt of such data packets.
Conceptually, routing information takes the form of entries in a routing table, with one entry for each identified route. You can statically (manually) configure the entries in the routing table, or the router can use a routing protocol to create and maintain the routing table dynamically to accommodate network changes when they occur.
To manage an IP network effectively, you must understand the operation of both static and dynamic routing and the impact that they have on an IP network. This lesson introduces IP static routing.
Routing Overview
To be able to route anything, a router, or any entity that performs routing, must do the following:
- Identify the destination address: Determine the destination (or address) of the item that needs to be routed.
- Identify sources of routing information: Determine from which sources (other routers) the router can learn the paths to given destinations.
- Identify routes: Determine the initial possible routes, or paths, to the intended destination.
- Select routes: Select the best path to the intended destination.
- Maintain and verify routing information: Determine if the known paths to the destination are the most current.
The routing information that a router obtains from other routers is placed in its routing table. The router relies on this table to tell it which interfaces to use when forwarding addressed packets. Figure 5-25 shows that the router on the left uses interface s0/0/0 to get to the 172.16.1.0 subnet.
Figure 5-25 Routes to Destination
If the destination network is directly connected, the router already knows which interface to use when forwarding packets. If destination networks are not directly attached, the router must learn the best route to use when forwarding packets.
The destination information can be learned in two ways:
- You can enter routing information manually.
- You can collect routing information through the dynamic routing process that runs in the routers.
Static and Dynamic Route Comparison
Routers can forward packets over static routes or dynamic routes based on the routerconfiguration. The two ways to tell the router where to forward packets to destination networks that are not directly connected are as follows:
- Static route: The router learns routes when an administrator manually configures the static route. The administrator must manually update this static route entry whenever an internetwork topology change requires an update. Static routes are user-defined routes that specify the path that packets take when moving between a source and a destination. These administrator-defined routes allow very precise control over the routing behavior of the IP internetwork.
- Dynamic route: The router dynamically learns routes after an administrator configures a routing protocol that helps determine routes. Unlike the situation with static routes, after the network administrator enables dynamic routing, the routing process automatically updates route knowledge whenever new topology information is received. The router learns and maintains routes to the remote destinations by exchanging routing updates with other routers in the internetwork.
Static Route Configuration
Static routes are commonly used when you are routing from a network to a stub network. A stub network (sometimes called a leaf node) is a network accessed by a single route. Static routes can also be useful for specifying a “gateway of last resort” to which all packets with an unknown destination address are sent. Following is the syntax for configuring a
static route:
RouterX(config)# ip route network [ mask] {address | interface}[ distance] [ permanent]
Example: Understanding Static Routes
In Figure 5-26, router A is configured with a static route to reach the 172.16.1.0 subnet via the serial interface of router A given either configuration method. Router B is configured with a static or default route to reach the networks behind router A via the serial interface of router B.
NOTE The static route is configured for connectivity to remote networks that are not directly connected to your router. For end-to-end connectivity, a static route must be configured in both directions.
Figure 5-26 Static Route Example
To configure a static route, enter the ip route command in global configuration mode. The parameters identified in Table 5-3 further define the static route. A static route allows manual configuration of the routing table. No dynamic changes to the routing table entry occur as long as the path is active.
Table 5-3 lists the ip route command parameters and gives descriptions of them.
Example: Configuring Static Routes
In this example, the static route is configured as follows: Router(config)#ip route 172.16.1.0 255.255.255.0 172.16.2.1 or Router(config)#ip route 172.16.1.0 255.255.255.0 s0/0/0
Table 5-4 lists the ip route command parameters for this example.
Table 5-4 Static Route Example Parameters
The assignment of a static route to reach the stub network 172.16.1.0 is proper for router A because only one way to reach that network exists.
Default Route Forwarding Configuration
You should use a default route in situations in which the route from a source to a destination is not known or when it is not feasible for the router to maintain many routes in its routing table, such as the one shown in Figure 5-27.
Use the ip route command to configure default route forwarding. In Figure 5-27, router B is configured to forward all packets that do not have the destination network listed in the router B routing table to router A.
In the default route example, the default route is configured as follows:
Router(config)# ip route 0.0.0.0 0.0.0.0 172.16.2.2
Figure 5-27 Using Default Routes
Table 5-5 lists the ip route command parameters for this example.
Table 5-5 Default Route Example Parameters
Static Route Configuration Verification
To verify that you have properly configured static routing, enter the show ip route command and look for static routes signified by “S.” You should see a verification output as indicated:
RouterA# show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default U - per-user static route Gateway of last resort is 0.0.0.0 to network 0.0.0.0 10.0.0.0/8 is subnetted, 1 subnets C 10.1.1.0 is directly connected, Serial0/0/0 S* 0.0.0.0/0 is directly connected, Serial0