STATIC ROUTING

Static routes provide precise control over routing therefore it may create an administrative burden as the number of routers and network segments grow. Using static routing requires zero network bandwidth because implementing manual route entries does not require communication with other routers.

Unfortunately, because of the routers are not communicating, there is no network intelligence,hence If a link goes down, other routers will not be aware that the network path is no longer valid. Static routes are useful when

  • Dynamic routing protocols cannot be used on a router because of limited router CPU or memory
  • Routes learned from dynamic routing protocols need to be superseded

Static Route Types

Static routes can be classify as one of the following:

  • Directly attached static routes
  • Recursive static route
  • Fully specified static route

Directly Attached Static Routes

Point-to-point (P2P) serial interfaces do not have to worry about maintaining an adjacency table and do not use Address Resolution Protocol (ARP),because of this static routes can directly reference the outbound interface of a router. A static route that uses only the outbound next-hop interface is known as a directly attached static route, and therefore the outbound interface be in an up state for the route to be installed into the RIB.

Directly attache static routes are configure with the command
ip route network subnet-mask next-hop-interface-id.

Below figure state that,R1 connecting to R2 using a serial connection hence R1 uses a directly attache static route to the 10.22.22.0/24 network, and R2 uses a directly attache static route to the 10.11.11.0/24 network to allow connectivity between the two remote networks. Static routes are require on both routers due to that return traffic will have a path back.

image

R1 and R2 Connected with a Serial Connection

R1 indicates that the 10.22.22.0/24 network is reachable via the S1/0 interface.
R2 indicates that the 10.11.11.0/24 network is reachable via the S1/0 interface.
R1(config)# ip route 10.22.22.0 255.255.255.0 Serial 1/0
R2(config)# ip route 10.11.11.0 255.255.255.0 Serial 1/0

Below table shows the routing table with the static route configure. A directly attache static route does not display [AD/Metric] information when looking at the routing table. Notice that the static route displays directly connect outbound interface

R1# show ip route
Output omitted for brevity 
Gateway of last resort is not set 
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks 
 C    10.11.11.0/24 is directly connected, GigabitEthernet0/1 
 C    10.12.2.0/24 is directly connected, Serial1/0 
 S    10.22.22.0/24 is directly connected, Serial1/0 
R2# show ip route
Output omitted for brevity 
Gateway of last resort is not set 
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks 
 S        10.11.11.0/24 is directly connected, Serial1/0 
 C        10.12.2.0/24 is directly connected, Serial1/0 
 C        10.22.22.0/24 is directly connected,GigabitEthernet0/1 
 

Note :
Configuring a directly attache static route to an interface that uses ARP (that is, Ethernet) causes problems and is not recommended. The router must repeat the ARP process for every destination that matches the static route, therefore it consumes CPU and memory. Depending on the size of the prefix of the static route and the number of lookups, the configuration can cause system instability

Recursive Static Routes

The forwarding engine on Cisco devices needs to know which interface an outbound packet should use. A recursive static route specifies the IP address of the next-hop address. The recursive lookup occurs when the router queries the RIB to locate the route toward the next-hop IP address (connected, static, or dynamic) and then cross-references the adjacency table.

Recursive static routes are configure with the command ip route network subnet-mask next-hop-ip. Recursive static routes require the route’s next-hop address to exist in the routing table to install the static route into the RIB. A recursive static route may not resolve the next-hop forwarding address using the default route (0.0.0.0/0) entry. The static route will fail next-hop reachability requirements and will not be insert into the RIB.

Below figure shows a topology with R1 and R2 connect with each other using the Gi0/0 port hence R1 uses a recursive static route to the 10.22.22.0/24 network, and R2 uses a recursive static route to the 10.11.11.0/24 network to allow connectivity between these networks.

image 2
R1 and R2 Connected by Ethernet

Configuring Recursive Static Routes

R1’s configuration states that the 10.22.22.0/24 network is reachable via the 10.12.1.2 IP address.
R2’s configuration states that the 10.11.11.0/24 network is reachable via the 10.12.1.1 IP address.
R1(config)# ip route 10.22.22.0 255.255.255.0 10.12.1.2
R2(config)# ip route 10.11.11.0 255.255.255.0 10.12.1.1

Below output verifies that the static route was configure on R1 for the 10.22.22.0/24 network with the next-hop IP address 10.12.1.2. Notice that the [AD/Metric and next-hop IP address ] information is present in the output.

R1# show ip route
!Output omitted for brevity 
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C        10.11.11.0/24 is directly connected, GigabitEthernet0/1
C        10.12.1.0/24 is directly connected, GigabitEthernet0/0
S        10.22.22.0/24 [1/0] via 10.12.1.2

Cisco supports the configuration of multiple recursive static routes
In figure R1 needs connectivity to the 10.23.1.0/24 network and to the 10.33.1.0/24 network

image 3
Multi-Hop Topology

R1 could configure the static route for the 10.33.33.0/24 network with a next-hop IP address as either 10.12.1.2 or 10.23.1.3. If R1 configure static route with the 10.23.1.3 next-hop IP address, the router performs a second lookup when building the CEF entry for the 10.33.33.0/24 network

Fully Specified Static Routes

Static route recursion can simplify topologies if a link fails because it may allow the static route to stay installe while it changes to a different outbound interface in the same direction as the destination. However, problems arise if the recursive lookup resolves to a different interface point in the opposite direction.

To correct this issue, the static route configuration should use the outbound interface and the next-hop IP address. A static route with both an interface and a next-hop IP address is known as a fully specified static route. If the interface listed is not in an up state, the router removes the static route from the RIB. Specifying the next-hop address along with the physical interface removes the recursive lookup and does not involve the ARP processing problems that occur when using only the outbound interface.

Revisting above figure R1 and R2 use fully specifie static routes to connect to the 10.11.11.0/24 and 10.22.22.0/24 networks using the Gi0/0 interface.
Fully specific static routes are configure with the command ip route network subnet-mask interface-id next-hop-ip.

Configuring Fully Specified Static Routes

R1# configure term
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)# ip route 10.22.22.0 255.255.255.0 GigabitEthernet0/0 10.12.1.2
R2# configure term
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)# ip route 10.11.11.0 255.255.255.0 GigabitEthernet0/0 10.12.1.1

The output in below table verifies that R1 can only reach the 10.22.22.0/24 network via 10.12.1.2 from the Gi0/0 interface.

Verifying the Fully Specified Static Route

R1# show ip route
!Output omitted for brevity
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C     10.11.11.0/24 is directly connected, GigabitEthernet0/1
C     10.12.1.0/24 is directly connected, GigabitEthernet0/0
S     10.22.22.0/24 [1/0] via 10.12.1.2, GigabitEthernet0/0

Floating Static Routing

The default AD on a static route is 1, but a static route can be configure with an AD value of 1 to 255 for a specific route. The AD is set on a static route by appending the AD as part of the command structure.

Using a floating static route is a common technique for providing backup connectivity for prefixes learn via dynamic routing protocols. A floating static route is configure with an AD higher than that of the primary route. Because the AD is higher than that of the primary route, it is install in the RIB only when the primary route is withdrawn.

In below figure, R1 and R2 are configure with two links hence The 10.12.1.0/24 transit network is prefer to the 10.12.2.0/24 network.

Floating Static Route Topology
Floating Static Route Topology

Below table shows the configuration of the floating static route on R1, and R2 would be configured similarly. The static route using the Ethernet link (10.12.1.0/24) has an AD of 10, and the serial link (10.12.2.0/24) has an AD set to 210.

Configuring the Floating Static Route for R1

R1# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)# ip route 10.22.22.0 255.255.255.0 10.12.1.2 10
R1(config)# ip route 10.22.22.0 255.255.255.0 Serial 1/0 210

Below table shows the routing tables of R1. Notice that the static route across the serial link is not install into the RIB. Only the static route for the Ethernet link (10.13.1.0/24) with an AD of 10 is installed into the RIB.

Routing Table of R1 with a Floating Static Route

R1# show ip route
! Output omitted for brevity
Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C        10.11.11.0/24 is directly connected, GigabitEthernet0/1
C        10.12.1.0/24 is directly connected, GigabitEthernet0/0
C        10.12.2.0/24 is directly connected, Serial1/0
S        10.22.22.0/24 [10/0] via 10.12.1.2

shows the routing table for R1 after shutting down the Gi0/0 Ethernet link to simulate a link failure. The 10.12.1.0/24 network (R1’s Gi0/0) is remove from the RIB. The floating static route through the 10.12.2.0/24 network (R1’s S1/0) is now the best path and is install into the RIB. Notice that the AD is not shown for that static route.

Routing Table After Ethernet Link Failure

R1# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)# interface GigabitEthernet0/0
R1(config-if)# shutdown
R1# show ip route
! Output omitted for brevity
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C        10.11.11.0/24 is directly connected, GigabitEthernet0/1
C        10.12.2.0/24 is directly connected, Serial1/0
S        10.22.22.0/24 is directly connected, Serial1/0

Even though the static route’s AD is not shown, it is still programmed in the RIB. The output confirms that the floating static route with AD 210 is currently active in the routing table.

Verifying the AD for the Floating Static Route

R1# show ip route 10.22.22.0
Routing entry for 10.22.22.0/24
  Known via "static", distance 210, metric 0 (connected)
  Routing Descriptor Blocks:
  * directly connected, via Serial1/0
      Route metric is 0, traffic share count is

Static Null Routes

The null interface is a virtual interface that is always in an up state. Null interfaces do not forward or receive network traffic and drop all traffic destined toward them without adding overhead to a router’s CPU.

Configuring a static route to a null interface provides a method of dropping network traffic without requiring the configuration of an access list. Creating a static route to the Null0 interface is a common technique to prevent routing loops. The static route to the Null0 interface uses a summarized network range, and routes that are more specific point toward the actual destination.

Below figure shows a common topology in which company ABC has acquire the 172.16.0.0/20 network range from its service provider. ABC uses only a portion of the given addresses but keeps the large network block in anticipation of future growth.

Routing Loop Topology
Routing Loop Topology

The service provider places a static route for the 172.16.0.0/20 network to R1’s interface (192.168.1.1). R1 uses a static default route pointed toward the service provider (192.168.1.2) and a static route to the 172.16.3.0/24 network via R2 (172.16.1.2). Because R2 accesses all other networks through R1, a static default route points toward R1’s interface (172.16.1.1).

If packets are sent to any address in the 172.16.0.0/20 range that is not used by company ABC, the packet gets stuck in a loop between R1 and the ISP, consuming additional bandwidth until the packet’s TTL expires.

Example

A computer on the Internet sends a packet to 172.16.5.5, and the 172.16.5.0/24 network is not allocated on R1 or R2. The ISP sends the packet to R1 because of the 172.16.0.0/20 static route; R1 looks into the RIB, and the longest match for that prefix is the default route back to the ISP, so R1 sends the packet back to the ISP, creating the routing loop.

Packet Traces Demonstrating the Routing Loop

Below table shows the routing loop when packets originate from R2. Notice the IP address in the traceroute alternative between the ISP router (192.168.1.2) and R1 (192.168.1.1).

R2# trace 172.16.5.5 source GigabitEthernet 0/2
Type escape sequence to abort.
Tracing the route to 172.16.5.5
  1 172.16.1.1 0 msec 0 msec 0 msec
  2 192.168.1.1 0 msec 0 msec 0 msec
  3 192.168.1.2 0 msec 4 msec 0 msec
  4 192.168.1.1 0 msec 0 msec 0 msec
  5 192.168.1.2 0 msec 0 msec 0 msec
! Output omitted for brevity

To prevent the routing loop, a static route is added for 172.16.0.0/20, pointed to the Null0 interface on R1. Any packets matching the 172.16.0.0/20 network range that do not have a longer match in R1’s RIB are dropped.below table shows the static route configuration for R1 with the newly added null static route.

R1 Static Route for 172.16.0.0/20 to Null0

R1
ip route 0.0.0.0 0.0.0.0 Gi0/0 192.168.1.2
ip route 172.16.3.0 255.255.255.0 Gi0/2 172.16.1.2
ip route 172.16.0.0 255.255.240.0 Null0

The output in below table confirms that the null static route has removed the routing loop as intended

Packet Traces Demonstrating Loop Prevention

R2# trace 172.16.5.5 source GigabitEthernet 0/2
Type escape sequence to abort.
Tracing the route to 172.16.5.5
  1 172.16.1.1  *  *  *
  2 172.16.1.1  *  *  *
! Output omitted for brevity