Static routing is useful in very simple
networks that do not have multiple paths to any destination network.
Static routing reduces the memory and processing burdens on a
router. Even on large internetworks, administrators often configure
static routes on access routers that connect stub networks, or
networks that have only one way in and one way out. In Figure ,
RTZ is configured with a static route to 172.24.4.0 /24.
To configure static routing on a
Cisco router, you must use the ip
route command. This command
uses the following syntax:
Router(config)#ip route
destination-prefix destination-prefix-mask {address |
interface} [distance] [tag tag] [permanent]
Figure
describes the parameters that are used with this command.
You can manually add an entry to a
routing table
using one of two variations on the ip
route command:
RTA(config)#ip route 10.6.0.0
255.255.0.0 s1
or
RTA(config)#ip route 10.7.0.0
255.255.0.0 10.4.0.2
Both of these global configuration
commands will add a static route to the routing table. The first
example maps a network prefix (10.6.0.0/16) to a local physical
interface (S1) on the router the same way that a directly connected
network is mapped to an interface. The second example maps the
network prefix (10.7.0.0/16) to the next-hop address (10.4.0.2).
Although these commands will both add valid static routes to the
router's table, notice that the format of these two static routing
table entries is different.
In Figure ,
the static route to 10.6.0.0 shows as a static route (notice the
S at the beginning of the line), but is formatted similar to a
directly connected route (even though it is not) because the router
has just been configured to forward packets for 10.6.0.0 out S1. The static route to 10.7.0.0, which is configured with a
next-hop address, is formatted the same way that
dynamic routes are; the next-hop address is included in the
routing table because the packets destined for 10.7.0.0
should be forwarded to another router's interface at 10.4.0.2. What
is the difference between these two kinds of static routes?
When using a routing protocol such as
RIP or IGRP, static routes that show as directly connected will
automatically be advertised to other routers as long as the
appropriate network
command has been issued. The next-hop static route will not be
advertised without additional configuration. Static routes can be
included in updates if they are injected, or redistributed into the dynamic routing protocol.
When an interface goes down, all
static routes mapped to that interface are removed from the IP
routing table. In addition, when the router can no longer find a valid next
hop for the address specified in a static route, the static route is
likewise removed from the table. An alternative method is to map a
static IP address to a loopback interface.
Note: As a rule, you should
always use the next-hop address when defining a static route on a
multi-access network such as Ethernet. A router interface on a
multi-access network could have several link partners, so you must
use the next-hop address to specify which neighbor should receive
traffic for a given network.
Static routes are also good to use
when having trouble with a routing protocol. At a multi-campus
college, the ISP was upgrading its infrastructure. As each campus
was converted to the new ISP infrastructure, problems occurred with
the RIP routing protocol. As a quick solution, the WAN staff created
static routes until the ISP issue was resolved.
Static routing does not suit large,
complex networks that include redundant links, multiple protocols,
and meshed topologies. Routers in complex networks must adapt to
topology changes quickly and select the best route from multiple
candidates. Dynamic routing is the best choice for complex networks
or in any other network in which automation is preferred over human
intervention.
|