How to use static routing for backup path or load-balancing

In this article, I will explain how to use static routes for backup path or load-balancing between 2 paths. Let’s take the following architecture:

1-LBST

Here is our architecture. We have 3 routers (Paris, Amsterdam and London). If Paris sends traffic to London, we will suppose that this traffic will use the downside path (Fa0/1 of router Paris). But with a better look to this topology, we can see that there is another path (Paris to Amsterdam to London) that our traffic can use to reach network 1.1.1.0/24. This means that we have 2 paths to reach this network from Paris:

2-LBST

Are you following me so far?

We have 2 scenarios here:

  • Scenario 1: We can use the 2 paths simultaneously to send traffic to London. this is load-balancing;
  • Scenario 2: Use the active backup scenario. This means that one path is active, and the other will be the backup path.

What do you prefer, the first or the second?! 😉 don’t worry, we’ll see the 2 scenarios.

Scenario 1

In the first Scenario, We will use the 2 paths to communicate with 1.1.1.0/24 on London. Before starting the configuration, we will suppose that Router Amsterdam and London are already configured and can reach Router Paris. We also suppose that addresses on router Paris are already configured. This means that our work is to configure Static routes on router Paris and do the verifications.

Let’s do this:

We will configure 2 static routes to reach network 1.1.1.0/24: One with router Amsterdam as next hop, and the second with router London as next hop.

PARIS(config)#ip route 1.1.1.1 255.255.255.0 192.168.1.2
PARIS(config)#ip route 1.1.1.1 255.255.255.0 192.168.2.2

As you can see, we configured 2 static routes:

  • The first one will send traffic to Router Amsterdam ;
  • The second one will send it to router London.

Let’s see the routing table:

PARIS#show ip route
2.0.0.0/24 is subnetted, 1 subnets
C         2.2.2.0 is directly connected, Loopback0
C     192.168.1.0/24 is directly connected, FastEthernet0/0
C     192.168.2.0/24 is directly connected, FastEthernet0/1
S*     1.1.1.0/24 [1/0] via 192.168.2.2
               [1/0] via 192.168.1.2

Here is the routing table, and as you can see, we have 1 static route with 2 different next hops, this means that Router Paris will use this 2 routes to forward traffic.

Do you want to verify this?

3-LBST

I will use the Wireshark tool to verify if packets are load-balanced and I will listen on the paths between Paris and Amsterdam, and between Paris and London.

WR1

This capture is between Paris and London. On the same time, we made a capture between Paris and Amsterdam.

WR2

As you can see on the 2 captures, the traffic is load-balanced between the 2 paths.

You can also verify if the traffic is load-balanced using the CLI:

PARIS# debug ip packet
*Dec 24 12:43:15.187: IP: tableid=0, s=192.168.1.1 (local), d=1.1.1.1 (FastEthernet0/0), routed via RIB
*Dec 24 12:43:15.191: IP: s=192.168.1.1 (local), d=1.1.1.1 (FastEthernet0/0), len 100, sending

*Dec 24 12:43:15.599: IP: tableid=0, s=1.1.1.1 (FastEthernet0/0), d=192.168.1.1 (FastEthernet0/0), routed via RIB
*Dec 24 12:43:15.599: IP: s=1.1.1.1 (FastEthernet0/0), d=192.168.1.1 (FastEthernet0/0), len 100, rcvd 3
*Dec 24 12:43:15.603: IP: tableid=0, s=192.168.2.1 (local), d=1.1.1.1 (FastEthernet0/1), routed via RIB
*Dec 24 12:43:15.603: IP: s=192.168.2.1 (local), d=1.1.1.1 (FastEthernet0/1), len 100, sending
*Dec 24 12:43:15.935: IP: tableid=0, s=1.1.1.1 (FastEthernet0/1), d=192.168.2.1 (FastEthernet0/1), routed via RIB
*Dec 24 12:43:15.935: IP: s=1.1.1.1 (FastEthernet0/1), d=192.168.2.1 (FastEthernet0/1), len 100, rcvd 3
*Dec 24 12:43:15.935: IP: tableid=0, s=192.168.1.1 (local), d=1.1.1.1 (FastEthernet0/0), routed via RIB
*Dec 24 12:43:15.935: IP: s=192.168.1.1 (local), d
PARIS#u=1.1.1.1 (FastEthernet0/0), len 100, sending
*Dec 24 12:43:16.039: IP: tableid=0, s=1.1.1.1 (FastEthernet0/0), d=192.168.1.1 (FastEthernet0/0), routed via RIB
*Dec 24 12:43:16.039: IP: s=1.1.1.1 (FastEthernet0/0), d=192.168.1.1 (FastEthernet0/0), len 100, rcvd 3
*Dec 24 12:43:16.039: IP: tableid=0, s=192.168.2.1 (local), d=1.1.1.1 (FastEthernet0/1), routed via RIB
*Dec 24 12:43:16.039: IP: s=192.168.2.1 (local), d=1.1.1.1 (FastEthernet0/1), len 100, sending
*Dec 24 12:43:16.107: IP: tableid=0, s=1.1.1.1 (FastEthernet0/1), d=192.168.2.1 (FastEthernet0/1), routed via RIB
*Dec 24 12:43:16.107: IP: s=1.1.1.1 (FastEthernet0/1), d=192.168.2.1 (FastEthernet0/1), len 100, rcvd 3

Using the debug ip packet command, we can see that the traffic is load-balanced between the 2 paths (highlighted in RED color).

To summarize, if you create 2 static routes pointing to 2 different routers, the traffic is load-balanced (make sure that IP CEF is disabled by using the no ip cef command).

Scenario 2

We will create the 2 static routes on Router Paris, but now we will use different administrative distance for every one. Don’t remember the Administrative distance?
No problem, here is a recall:
The Administrative Distance (AD) is the feature that routers use in order to select the best path when there are 2 or more different routes to the same destination from 2 different routing protocols. AD also defines the reliability of a routing protocol. Here is a table listing the AD values:

Route Source Default Distance Values
Connected interface 0
Static route 1
Enhanced Interior Gateway Routing Protocol (EIGRP) summary route 5
External Border Gateway Protocol (BGP) 20
Internal EIGRP 90
IGRP 100
OSPF 110
Intermediate System-to-Intermediate System (IS-IS) 115
Routing Information Protocol (RIP) 120
Exterior Gateway Protocol (EGP) 140
On Demand Routing (ODR) 160
External EIGRP 170
Internal BGP 200
Unknown 255

You can see that a static route have an AD value of 1. And that explain the result of load-balancing in scenario 1: the 2 static routes had the same AD value, so they were used both by Router Paris, and thus the traffic was load-balanced.

Now, let’s suppose that the upside path (Paris to Amsterdam to London) is the active and downside path (Paris to London) is the backup path.

Are you ready to configure this? I think yes… 😉

PARIS(config)#ip route 1.1.1.1 255.255.255.0 192.168.1.2 2
PARIS(config)#ip route 1.1.1.1 255.255.255.0 192.168.2.2 3

The 2 numbers in red on the end of the static route are the Administrative distance. By default a static route have an AD value of 1, but we can change it. In my configuration, the first static route will be used as an active path (Paris to Amsterdam to London), and the second (Paris to London) will be used as backup route.

Let’s check this:

PARIS#show ip route
2.0.0.0/24 is subnetted, 1 subnets
C         2.2.2.0 is directly connected, Loopback0
C     192.168.1.0/24 is directly connected, FastEthernet0/0
C     192.168.2.0/24 is directly connected, FastEthernet0/1
S*     1.1.1.0/24 [2/0] via 192.168.1.2

As you can see, the static route that have the lowest AD value is preferred and used by router Paris.
Let’s now change the Fa0/0 of router Paris to a Down state:

PARIS(config)#int f0/0
PARIS(config-if)#shutdown

If we look at the routing table now:

PARIS#show ip route
2.0.0.0/24 is subnetted, 1 subnets
C         2.2.2.0 is directly connected, Loopback0
C     192.168.2.0/24 is directly connected, FastEthernet0/1
S*     1.1.1.0/24 [3/0] via 192.168.2.2

You can see that the next hop now is router London, this means we are using the backup path.  Note that the transition can be done in real time.

So to summarize, if you want to have backup routes using static routing, you can play with Administrative distance of the static routes.

This is all I have for you in this article, if you have any question just leave it in the comment part.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *