Table of Contents Link to heading
- Static Routing
- Static versus Dynamic Routing
- Types of Static Routes
- Next-Hop Static Route
- Directly Connected Static Route
- Fully Specified Static Route
- Next-hop Address Argument versus Exit-interface Argument
- Default Static Route or Gateway of Last Resort
- Floating Static Route
- Static Host Routes
- Null (0) Static Route
- Route Aggregation/Summarisation (Supernetting)
- Route Verification
- Note on IPv6 Static Routes
Static Routing Link to heading
Static versus Dynamic Routing Link to heading
Types of Static Routes Link to heading
There are a few different types of static routes, each with different purposes:
- Standard static route
- Default static route
- Floating static route
- Summary static route
To configure a static route, use the ip route network mask next-hop-option command from the global configuration mode.
Next-hop options can be:
- ip-address โ the IP address of the next-hop is specified.
- exit-interface โ the exit interface of the local roueris specified.
- Fully specified static route โ the IP address of the next-hop and router exit interface are specified.
To remove a static route from the configuration, use the no form of the ip route command.
Next-Hop Static Route Link to heading
R1(config)# ip route 172.16.1.0 255.255.255.0 172.16.2.2
Directly Connected Static Route Link to heading
R1(config)# ip route 172.16.1.0 255.255.255.0 s0/1/0
Fully Specified Static Route Link to heading
- Used when the exit interface is a multi-access interface, and it is necessary to explicitly identify the next hop.
- Used when the exit interface is an Ethernet network.
- The route is only valid if the exit interface is up.
- The most preferred method since recursive lookups do not result in routing decisions that might add latency to the path.
R1(config)# ip route 172.16.1.0 255.255.255.0 s0/1/0 172.16.2.2
Next-hop Address Argument versus Exit-interface Argument Link to heading
- The next-hop address argument requires a route lookup, which means the
router has to determine what exit interface to use by looking up the next-hop
IP address in the routing table.
- It then causes a recursive route lookup (one that requires an additional lookup in the routing table) since (under non-CEF conditions) the route has to do an additional route lookup to resolve the exit-interface for the specified next-hop address.
- Cisco Express Forwarding (CEF), which is enabled by default, automatically works through the iterative process of finding the exit interface so the CPU is not involved in that process for each packet matching the recursive route, which helps reduce latency and CPU cycles.
show ip route IP_# subnet_mask - displays the contents of the Routing Information Base (RIB).
show ip cef IP_# subnet_mask - displays the contents of the Forwarding Information Base (FIB).
- The exit-interface argument does not require (recursive) lookup as the
router can immediately forward the packet to the outbound interface.
- However, the router would have to send an ARP request for every destination that matches the static route, consuming CPU and memory along the way. This could cause instability in a larger network.
Default Static Route or Gateway of Last Resort Link to heading
- A default route can be obtained from a dynamic routing protocol or statically set with a default static route.
- Usually used when connecting between a stub router or from an edge router to a service provider network.
- Stub routers do not need specific routing information to reach networks beyond their gateway. A stub router can simply use a default route to send all traffic not destined for a directly connected network to its gateway.
- This greatly reduces the number of entries to be entered into the routing table.
Configuration Link to heading
- The default route in IPv4 is designated as 0.0.0.0/0 (called the quad-zero route) which matches every IPv4 address and is the shortest match possible to ensure it is only used as the last resort if nothing else matches.
- Configure a default route using the ip route 0.0.0.0 0.0.0.0 next-hop-options command from the global configuration mode.
Floating Static Route Link to heading
- It is not active by default and only becomes active when the primary route is not down.
- Static routes, by default, have an AD of 1. This can be increased to prevent takeover unless the primary is unavailable.
- A common usage is a backup to the default static route.
Configuration Link to heading
R1(config)# ip route 0.0.0.0 0.0.0.0 IP_# AD_#
- The AD (> 1) at the end of the second command specifies the AD of the route.
- To test that it works, shut down the interface of 172.16.2.2 on the other
router. This will remove the first/primary route from the IP routing table.
- Because a route must be reachable from the current router for it to be in the IP routing table.
Static Host Routes Link to heading
- For example, if there was a server behind an ISP that your branch router wanted to access, you could use a static host route to specify the exact server to reach instead of the network the server is on.
- Branch(config)# ip route 209.165.200.238 255.255.255.255 198.51.100.2
- Host routes are already added into the IP routing table by the IOS when a local interface is configured.
Null (0) Static Route Link to heading
The null 0 interface is used to insert routes into your routing table for destination prefixes that you do not actually have a path for; destination does not exist; packets filtered out by ACLs.
It allows you to basically drop (throw away) traffic destined for specific prefixes.
- The null 0 interface is always up and available on a Cisco router.
- It has only two options for ICMP: ip unreachable and ipv6 unreachable
- It has an AD of 1 and metric of 0 - like a directly connected route.
- The null route can also insert summary routes into your routing table so that dynamic routing protocols can advertise them, while your router routes are based on more specific prefixes within that summary
Route Aggregation/Summarisation (Supernetting) Link to heading
- Summary routes are generally a set of contiguous networks that have the same exit interface and/or next-hop IP address.
- Route aggregation is implemented to reduce the number of route table entries required to forward IP packets accurately in an internetwork.
- Otherwise, the routing tables would be too large for the routers to handle.
Algorithm Link to heading
Issue Link to heading
- Route aggregation is good and effective, but it does have issues.
- Consider the previous example:
- We own the networks 172.20.0.0 to 172.23.0.0.
- The routes are summarised as 172.20.0.0/14.
- This range includes 172.20.0.0, 172.21.0.0, 172.22.0.0, 172.23.0.0, and even 172.24.0.0.
- We do not own the network 172.24.0.0, but is stating that we own it in our summarised route.
- Therefore, care is needed to ensure that issues like this are kept to a minimum.
Route Verification Link to heading
R1# show ip route IP_# subnet_mask - show AD and metric for the static route.