Lec3 Static Routing
Lec3 Static Routing
Lec3 Static Routing
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 2
15.1 Static Routes
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 3
Static Routes
Types of Static Routes
Static routes are commonly implemented on a network. This is true even when there is a
dynamic routing protocol configured.
Static routes can be configured for IPv4 and IPv6. Both protocols support the following
types of static routes:
• Standard static route
• Default static route
• Floating static route
• Summary static route
Static routes are configured using the ip route and ipv6 route global configuration
commands.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 4
Static Routes
IPv4 Static Route Command
IPv4 static routes are configured using the following global configuration command:
Note: Either the ip-address, exit-intf, or the ip-address and exit-intf parameters must be
configured.
When configuring a static route, the next hop can be identified by an IP address, exit
interface, or both. How the destination is specified creates one of the three following types
of static route:
• Next-hop route - Only the next-hop IP address is specified
• Directly connected static route - Only the router exit interface is specified
• Fully specified static route - The next-hop IP address and exit interface are
specified
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 5
Static Routes
Dual-Stack Topology
The figure shows a dual-stack
network topology. Currently, no
static routes are configured for
either IPv4 or IPv6.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 6
Static Routes
IPv4 Starting Routing Tables
• Each router has entries only for directly connected networks and associated local
addresses.
• R1 can ping R2, but cannot ping the R3 LAN
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 7
15.2 Configure IP Static
Routes
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 8
Static Routes
Dual-Stack Topology
The figure shows a dual-stack
network topology. Currently, no
static routes are configured for
either IPv4 or IPv6.
Or
Or
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 9
Configure IP Static Routes
IPv4 Next-Hop Static Route
The resulting routing table entries on R1:
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 10
Configure IP Static Routes
IPv6 Fully Specified Static Route
In a fully specified static route, both the exit interface and the next-hop IPV6 address are specified.
There is a situation in IPv6 when a fully specified static route must be used. If the IPv6 static route
uses an IPv6 link-local address as the next-hop address, use a fully specified static route. The
figure shows an example of a fully specified IPv6 static route using an IPv6 link-local address as the
next-hop address.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 11
Configure IP Static Routes
IPv6 Fully Specified Static Route (Cont.)
The reason a fully specified static route must be used is because IPv6 link-local
addresses are not contained in the IPv6 routing table. Link-local addresses are only
unique on a given link or network. The next-hop link-local address may be a valid address
on multiple networks connected to the router. Therefore, it is necessary that the exit
interface be included.
The following example shows the IPv6 routing table entry for this route. Notice that both
the next-hop link-local address and the exit interface are included.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 12
Configure IP Static Routes
Verify a Static Route
Along with show ip route, show ipv6 route, ping and traceroute, other useful
commands to verify static routes include the following:
• show ip route static • show running-config | section ip route
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 13
15.3 Configure IP Default
Static Routes
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 14
Configure IP Default Static Routes
Default Static Route
• A default route is a static route that
matches all packets. A single default route
represents any network that is not in the
routing table.
• Routers commonly use default routes that
are either configured locally or learned
from another router. The default route is
used as the Gateway of Last Resort.
• Default static routes are commonly used
when connecting an edge router to a
service provider network, or a stub router
(a router with only one upstream neighbor
router).
• The figure shows a typical default static
route scenario.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 15
Configure IP Default Static Routes
Default Static Route (Cont.)
IPv4 Default Static Route: The command syntax for an IPv4 default static route is similar to any
other IPv4 static route, except that the network address is 0.0.0.0 and the subnet mask is 0.0.0.0.
The 0.0.0.0 0.0.0.0 in the route will match any network address.
The basic command syntax for an IPv4 default static route is as follows:
IPv6 Default Static Route: The command syntax for an IPv6 default static route is similar to any
other IPv6 static route, except that the ipv6-prefix/prefix-length is ::/0, which matches all routes.
The basic command syntax for an IPv6 default static route is as follows:
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 16
Configure IP Default Static Routes
Configure a Default Static Route
The example shows an IPv4 default static route
configured on R1. With the configuration shown in
the example, any packets not matching more
specific route entries are forwarded to R2 at
172.16.2.2.
Notice that the static default route configuration uses the /0 mask for IPv4 default routes. Remember that the IPv4
subnet mask in a routing table determines how many bits must match between the destination IP address of the
packet and the route in the routing table. A /0 mask indicates that none of the bits are required to match. As long
as a more specific match does not exist, the default static route matches all packets.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 18
Configure IP Default Static Routes
Verify a Default Static Route (Cont.)
This example shows the show ipv6 route static command output to display the contents of the
routing table.
Notice that the static default route configuration uses the ::/0 prefix for IPv6 default routes.
Remember that the IPv6 prefix-length in a routing table determines how many bits must match
between the destination IP address of the packet and the route in the routing table. A ::/0 prefix
indicates that none of the bits are required to match. As long as a more specific match does not
exist, the default static route matches all packets.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 19
15.4 Configure Floating
Static Routes
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 20
Configure Floating Static Routes
Floating Static Routes
• Another type of static route is a floating static route. Floating static routes are static
routes that are used to provide a backup path to a primary static or dynamic route.
The floating static route is only used when the primary route is not available.
• To accomplish this, the floating static route is configured with a higher administrative
distance than the primary route. The administrative distance represents the
trustworthiness of a route. If multiple paths to the destination exist, the router will
choose the path with the lowest administrative distance.
• By default, static routes have an administrative distance of 1, making them preferable
to routes learned from dynamic routing protocols.
• The administrative distance of a static route can be increased to make the route less
desirable than that of another static route or a route learned through a dynamic
routing protocol. In this way, the static route “floats” and is not used when the route
with the better administrative distance is active.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 21
Configure Floating Static Routes
Test the Floating Static Routes
• What would happen if R2 failed? To
simulate this, R2 shuts down both of its
serial interfaces.
• R1 automatically generates syslog
messages for the link going down.
• A look at R1’s routing table would show
the secondary route being used.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 22
15.5 Configure Static Host
Routes
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 23
Configure Static Host Routes
Static Host Routes
A host route can be a manually configured static route to direct traffic to a specific destination device,
such as the server shown in the figure. The static route uses a destination IP address and a
255.255.255.255 (/32) mask for IPv4 host routes, and a /128 prefix length for IPv6 host routes.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 24