Featured image

Table of Contents Link to heading

Static Routing Link to heading

Tip
Read at ๐Ÿ”—.

Static versus Dynamic Routing Link to heading

Tip
Read at ๐Ÿ”—.

Types of Static Routes Link to heading

There are a few different types of static routes, each with different purposes:

  1. Standard static route
  2. Default static route
  3. Floating static route
  4. 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:

  1. ip-address โ€“ the IP address of the next-hop is specified.
  2. exit-interface โ€“ the exit interface of the local roueris specified.
  3. 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

Info
Only specify the next-hop IP address. It requires looking up the next-hop IP address in the routing table to resolve the exit interface.
Note
Router(config)# ip route IP_# subnet_mask next_hop_IP_#
Example

R1(config)# ip route 172.16.1.0 255.255.255.0 172.16.2.2

Next Hop

Directly Connected Static Route Link to heading

Info
Only specify the exact local exit interface. It will not result in a recursive lookup in the routing table.
Note
Router(config)# ip route IP_# subnet_mask local_interface_#
Example

R1(config)# ip route 172.16.1.0 255.255.255.0 s0/1/0

DirectlyConnected

Fully Specified Static Route Link to heading

Info
Specify both the exit interface and next-hop IP address.
  • 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.
Note
Router(config)# ip route IP_# subnet_mask local_interface_# next_hop_IP_#
Example

R1(config)# ip route 172.16.1.0 255.255.255.0 s0/1/0 172.16.2.2

Fully Specified2

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.
Note

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.
Tip
If the destination network is not directly connected, it is recommended to specify the next-hop address to minimise the impact on performance.

Default Static Route or Gateway of Last Resort Link to heading

Info
If the destination address does not match any route in the routing table, the router will send all IP packets to this default route if it is configured and active in the routing table.
  • 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.

Default StaticRoute

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.

Configuration

Floating Static Route Link to heading

Info
Used to provide a secondary or backup to a primary static or dynamic route.
  • 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

Note
R1(config)# ip route 0.0.0.0 0.0.0.0 IP_#
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

Info
Used when directing traffic to a specific destination host. It is called this because it uses a /32 (255.255.255.255) to represent an exact host in the destination network.
  • 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.

Static HostRoutes

Null (0) Static Route Link to heading

Info

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
Note
Router(config)# ip route IP_# subnet_mask null 0

Route Aggregation/Summarisation (Supernetting) Link to heading

Info
The process of aggregating multiple IP address networks into one superset of those networks - called the summary route - to reduce the quantity of routing information carried by a router.
  • 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

Tip
Read at ๐Ÿ”—.

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

Note
R1# show ip route static | begin Gateway
R1# show ip route IP_# subnet_mask - show AD and metric for the static route.

Note on IPv6 Static Routes Link to heading

Info
With IPv6, the next-hop address is a link-local address, and thus the only type of route that can be used is a fully specified static route.