Usage Guidelines
The establishment of a static route is appropriate when the Cisco IOS software
cannot dynamically build a route to the destination.
When you specify a DHCP server to assign a static route, the interface type and
number and administrative distance may be configured also. In Cisco IOS Release
12.4(1)T and later releases, this keyword is removed.
For Cisco IOS Release 12.4(1)T and later releases, use the
global keyword with the vrf
vrf-name keyword and argument combination to specify that the
next hop address is global.
If you specify an administrative distance, you are flagging a static route that can
be overridden by dynamic information. For example, routes derived with Enhanced
Interior Gateway Routing Protocol (EIGRP) have a default administrative distance of
100. To have a static route that would be overridden by an EIGRP dynamic route,
specify an administrative distance greater than 100. Static routes have a default
administrative distance of 1.
Static routes that point to an interface on a connected router will be advertised by
way of Routing Information Protocol (RIP) and EIGRP regardless of whether
redistribute static commands
are specified for those routing protocols. This situation occurs because static
routes that point to an interface are considered in the routing table to be
connected and hence lose their static nature. Also, the target of the static route
should be included in the network (DHCP) command. If this
condition is not met, no dynamic routing protocol will advertise the route unless a
redistribute static command
is specified for these protocols. With the following configuration:
rtr1 (serial 172.16.188.1/30)--------------> rtr2(Fast Ethernet 172.31.1.1/30) ------>
router [rip | eigrp]
network 172.16.188.0
network 172.31.0.0
ip route 172.16.188.252 255.255.255.252 FastEthernet 0/0
RIP and EIGRP do not redistribute the route with the following
ip route command because of
the split horizon algorithm:
ip route 172.16.188.252 255.255.255.252 serial 2/1
ip route 172.16.188.252 255.255.255.252 FastEthernet 0/0
ip route 172.16.188.252 255.255.255.252 serial 2/1
With the Open Shortest Path First (OSPF) protocol, static routes that point to an
interface are not advertised unless a redistribute static command is specified.
Adding a static route to an Ethernet or other broadcast interface (for example, ip
route 0.0.0.0 0.0.0.0 Ethernet 1/2) will cause the route to be inserted into the
routing table only when the interface is up. This configuration is not generally
recommended. When the next hop of a static route points to an interface, the router
considers each of the hosts within the range of the route to be directly connected
through that interface, and therefore it will send Address Resolution Protocol (ARP)
requests to any destination addresses that route through the static route.
A logical outgoing interface, for example, a tunnel, needs to be configured for a
static route. If this outgoing interface is deleted from the configuration, the
static route is removed from the configuration and hence does not show up in the
routing table. To have the static route inserted into the routing table again,
configure the outgoing interface once again and add the static route to this
interface.
The practical implication of configuring the ip route 0.0.0.0 0.0.0.0 ethernet 1/2
command is that the router will consider all of the destinations that the router
does not know how to reach through some other route as directly connected to
Ethernet interface 1/2. So the router will send an ARP request for each host for
which it receives packets on this network segment. This configuration can cause high
processor utilization and a large ARP cache (along with memory allocation failures).
Configuring a default route or other static route that directs the router to forward
packets for a large range of destinations to a connected broadcast network segment
can cause your router to reload.
Specifying a numerical next hop that is on a directly connected interface will
prevent the router from using proxy ARP. However, if the interface with the next hop
goes down and the numerical next hop can be reached through a recursive route, you
may specify both the next hop and interface (for example, ip route 0.0.0.0 0.0.0.0
ethernet 1/2 10.1.2.3) with a static route to prevent routes from passing through an
unintended interface.
 Note |
Configuring a default route that points to an interface, such as
ip route
0.0.0.0 0.0.0.0
ethernet 1/2 , displays the warning
message: %Default routes, must specify a next hop IP address if not a
point-to-point interface Router. This command causes the router to consider all
the destinations that the router cannot reach through an alternate route, as
directly connected to Ethernet interface 1/2. Hence, the router sends an ARP
request for each host for which it receives packets on this network segment.
This configuration can cause high processor utilization and a large ARP cache
(along with memory allocation failures). Configuring a default route or other
static route that directs the router to forward packets for a large range of
destinations to a connected broadcast network segment can cause the router to
reload.
|
The name
next-hop-name keyword and argument combination allows you to
associate static routes with names in your running configuration. If you have
several static routes, you can specify names that describe the purpose of each
static route in order to more easily identify each one.
The track
number keyword and argument combination specifies that the
static route will be installed only if the state of the configured track object is
up.
Recursive Static Routing
In a recursive static route, only the next hop is specified. The output interface is
derived from the next hop.
For the following recursive static route example, all destinations with the IP
address prefix address prefix 192.168.1.1/32 are reachable via the host with address
10.0.0.2:
ip route 192.168.1.1 255.255.255.255 10.0.0.2
A recursive static route is valid (that is, it is a candidate for insertion in the
IPv4 routing table) only when the specified next hop resolves, either directly or
indirectly, to a valid IPv4 output interface, provided the route does not
self-recurse, and the recursion depth does not exceed the maximum IPv4 forwarding
recursion depth.
The following example defines a valid recursive IPv4 static route:
interface serial 2/0
ip address 10.0.0.1 255.255.255.252
exit
ip route 192.168.1.1 255.255.255.255 10.0.0.2
The following example defines an invalid recursive IPv4 static route. This static
route will not be inserted into the IPv4 routing table because it is self-recursive.
The next hop of the static route, 192.168.1.0/30, resolves via the first static
route 192.168.1.0/24, which is itself a recursive route (that is, it only specifies
a next hop). The next hop of the first route, 192.168.1.0/24, resolves via the
directly connected route via the serial interface 2/0. Therefore, the first static
route would be used to resolve its own next hop.
interface serial 2/0
ip address 10.0.0.1 255.255.255.252
exit
ip route 192.168.1.0 255.255.255.0 10.0.0.2
ip route 192.168.1.0 255.255.255.252 192.168.1.100
It is not normally useful to manually configure a self-recursive static route,
although it is not prohibited. However, a recursive static route that has been
inserted in the IPv4 routing table may become self-recursive as a result of some
transient change in the network learned through a dynamic routing protocol. If this
situation occurs, the fact that the static route has become self-recursive will be
detected and the static route will be removed from the IPv4 routing table, although
not from the configuration. A subsequent network change may cause the static route
to no longer be self-recursive, in which case it will be re-inserted in the IPv4
routing table.
 Note |
IPv4 recursive static routes are checked at one-minute intervals. Therefore, a
recursive static route may take up to a minute to be inserted into the routing
table once its next hop becomes valid. Likewise, it may take a minute or so for
the route to disappear from the table if its next hop becomes invalid.
|
Examples
The following example shows how to choose an administrative distance of 110. In this
case, packets for network 10.0.0.0 will be routed to a router at 172.31.3.4 if
dynamic information with an administrative distance less than 110 is not available.
ip route 10.0.0.0 255.0.0.0 172.31.3.4 110
 Note |
Specifying the next hop without specifying an interface when configuring a
static route can cause traffic to pass through an unintended interface if the
default interface goes down.
|
The following example shows how to route packets for network 172.31.0.0 to a router
at 172.31.6.6:
ip route 172.31.0.0 255.255.0.0 172.31.6.6
The following example shows how to route packets for network 192.168.1.0 directly to
the next hop at 10.1.2.3. If the interface goes down, this route is removed from the
routing table and will not be restored unless the interface comes back up.
ip route 192.168.1.0 255.255.255.0 Ethernet 0 10.1.2.3
The following example shows how to install the static route only if the state of
track object 123 is up:
ip route 0.0.0.0 0.0.0.0 Ethernet 0/1 10.1.1.242 track 123
The following example shows that using the dhcp keyword in
a configuration of Ethernet interfaces 1 and 2 enables the interfaces to obtain the
next-hop router IP addresses dynamically from a DHCP server:
ip route 10.165.200.225 255.255.255.255 ethernet1 dhcp
ip route 10.165.200.226 255.255.255.255 ethernet2 dhcp 20
The following example shows that using the name
next-hop-name keyword and argument combination for each
static route in the configuration helps you remember the purpose for each static
route.
ip route 172.0.0.0 255.0.0.0 10.0.0.1 name Seattle2Detroit
The name for the static route will be displayed when the show
running-configuration command is entered:
Router# show running-config
| include ip route
ip route 172.0.0.0 255.0.0.0 10.0.0.1 name Seattle2Detroit