Load Balancing Using Static Route

Static route can be configure to load balancing and redundancy traffic across parallel links. This method usually used by enterprise network to connect to their Providers. Let’s take a look at sample network topology where R1 connected to R2 using 2 serial interface.

In this topic we have two objectives :
  • Lab 1. Load Balancing
  • Lab 2. Redundancy

Lab 1 - Load Balancing

Components used :
  • Cisco router with minimum 2 Serial interface
  • In this lab R1, R2 : Cisco 3640 with NM-4T slot serial interfaces, IOS c3640-ik9o3s-mz.123-22.bin
Lab step by step:
  1. Configure IP addresses on both routers interfaces
  2. Configure static route load balancing between R1 and R2
  3. Identify and understanding 2 types of load balancing

Step 1. Configure IP addresses on both routers interfaces

Let's configure both router using IP addresses from sample network topology. To simplify our lab, we will use loopback interfaces as our destination networks.


R1 router configuration

!
interface Loopback0
 description R1 Network
 ip address 100.1.1.1 255.255.255.0
!
interface Serial0/0
 description Link #1 to R2
 ip address 10.10.10.1 255.255.255.252
 serial restart-delay 0
!
interface Serial0/1
 description Link #2 to R2
 ip address 20.20.20.1 255.255.255.252
 serial restart-delay 0
!

 

R2 configuration

!
interface Loopback0
 description R2 Network
 ip address 200.1.1.1 255.255.255.0
!
interface Serial0/0
 description Link #1 to R1
 ip address 10.10.10.2 255.255.255.252
 serial restart-delay 0
!
interface Serial0/1
 description Link #2 to R1
 ip address 20.20.20.2 255.255.255.252
 serial restart-delay 0
!

 

Verify connectivity for both links

R1#ping 10.10.10.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.10.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/72/96 ms
R1#ping 20.20.20.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 20.20.20.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/128/188 ms
R1#

Step 2. Configure static route load balancing between R1 and R2

If the router receives and installs multiple paths with the same administrative distance and cost / metric to a destination, load-balancing can occur. So, we just need to configure static route to the particular network (loopback IP address in this lab) toward both (parallel) links to accomplish this load balance.
Before we continue this lab, here is cisco static route command syntax :

ip route prefix mask {next-hop-ip-address | interface-type interface-number [next-hop-ip-address]} [distance] [name] [permanent | track number] [tag tag]

So, what is { next-hop-ip-address | interface-type interface-number [next-hop-ip-address]} [distance] [name] [permanent | track number] [tag tag] means ? Sorry that I don’t remember type of those formats, but here are simple explanation about the formats :
{} : is mandatory
a|b : select one, you can select a or b
b[a] : b, can be followed with a, mean a is optional
[c] : optional

I recommended format “ip route prefix mask interface-type interface-number [next-hop-ip-address] name destination_route_name”, for me that best practice to reduce human error static route.
Take a look at configuration on R1 and R2 static routes :

 

R1 static routes

R1#sh run | i ip route
ip route 200.1.1.0 255.255.255.0 Serial0/0 10.10.10.2 name R2_Network_link#1
ip route 200.1.1.0 255.255.255.0 Serial0/1 20.20.20.2 name R2_Network_link#2
R1#

 

R2 static routes

R2#sh run | i ip route
ip route 100.1.1.0 255.255.255.0 Serial0/0 10.10.10.1 name R1_Network_link#1
ip route 100.1.1.0 255.255.255.0 Serial0/1 20.20.20.1 name R1_Network_link#2
R2#

 

Verify load balance traffic

R1#traceroute
Protocol [ip]: i
Target IP address: 200.1.1.1
Source address:
Numeric display [n]:
Timeout in seconds [3]:
Probe count [3]: 6
Minimum Time to Live [1]:
Maximum Time to Live [30]:
Port Number [33434]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Type escape sequence to abort.
Tracing the route to 200.1.1.1

  1 10.10.10.2 44 msec
    20.20.20.2 44 msec
    10.10.10.2 96 msec
    20.20.20.2 184 msec
    10.10.10.2 360 msec
    20.20.20.2 44 msec
R1#

Well, look like our traffic already send out toward both links. So, if send let say ICMP ping should be both links utilize by amount of traffics right ?.
Pay attention to our both interfaces traffic counter rate on R2 when we send ICMP traffic toward network R2.

 

R1#ping 200.1.1.1 rep 1000 size 1000 source 100.1.1.1

R2#sh int s0/0 | i rate
  Queueing strategy: weighted fair
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
R2#sh int s0/1 | i rate

  Queueing strategy: weighted fair
  5 minute input rate 56000 bits/sec, 9 packets/sec
  5 minute output rate 56000 bits/sec, 9 packets/sec
R2#
Only one link utilized by traffic, another remain idle. What happen ?
Keep reading guys, you’re almost done…

Step 3. Identify and understanding 2 types of load balancing

There are two main types of Cisco Express Forwarding (CEF) switching technology : per-destination and per-packet.

Per-destination load balancing is enabled by default, and it is the load balancing method usually used for most situations. Per-destination load balancing means the router distributes the packets based on the destination address. For example given two paths to the same network, all packets for destination1 on that network go over the first path, all packets for destination2 on that network go over the second path, and so on. This Because per-destination load balancing depends on the statistical distribution of traffic, load sharing becomes more effective as the number of source-destination pairs increase. This preserves packet order, with potential unequal usage of the links. If one host receives the majority of the traffic all packets use one link, which leaves bandwidth on other links unused.

Per-packet load balancing uses the round-robin method to determine which path each packet takes to the destination. For example the router sends one packet for destination1 over the first path, the second packet for (the same) destination1 over the second path, and so on. Per-packet load balancing guarantees equal load across all links. That's why this method is processor intensive task and impacts the overall forwarding performance. This form of per-packet load balancing is not well suited for higher speed interfaces. There is potential that the packets may arrive out of order at the destination because differential delay may exist within the network. So, do not use it for VOIP traffic.

Now, we surely can answer question why only one link utilized by traffic, another remain idle.
This is because our router uses per-destination load balancing method.
Note that destination means destination address or single host, not destination network.

After you can identify and understand 2 types of load balancing method, let's continue our lab using per-destination load balance. Make a little change to loopback 0 interface, shut it down, and make another 3 loopback interface with ip 200.1.1.1/32, 200.1.1.10/32, and 200.1.1.100/32. As result, we have 3 ping-able loopback IP’s on R2. Remember that we still uses 200.1.1.0/24 on R1 as destination network.

Per-destination Load Balancing Lab

R1#ping 200.1.1.1 rep 1000 size 1000 source 100.1.1.1
R1#sh int s0/0 | i output rate
  30 second output rate 192000 bits/sec, 24 packets/sec
R1#sh int s0/1 | i output rate
  30 second output rate 0 bits/sec, 0 packets/sec
R1#
R1#ping 200.1.1.10 rep 1000 size 1000 source 100.1.1.1
R1#sh int s0/0 | i output rate
  30 second output rate 20000 bits/sec, 0 packets/sec
R1#sh int s0/1 | i output rate
  30 second output rate 120000 bits/sec, 15 packets/sec
R1#
R1#ping 200.1.1.100 rep 1000 size 1000 source 100.1.1.1

R1#sh int s0/0 | i output rate
  30 second output rate 0 bits/sec, 0 packets/sec
R1#sh int s0/1 | i output rate
  30 second output rate 272000 bits/sec, 35 packets/sec
R1#
Now we can see that R1 send traffic to 200.1.1.1 out via link #1, 200.1.1.10 via link#2, and 200.1.1.100 via link#2. Once again, R1 still uses 200.1.1.0/24 in routing table.
Here are some command to identify type of load balancing :

R1#sh run int s0/0
Building configuration...

Current configuration : 135 bytes
!
interface Serial0/0
 description Link #1 to R2
 ip address 10.10.10.1 255.255.255.252
 load-interval 30
 serial restart-delay 0
end

R1#standard configuration, means per-destination load balancing
R1#sh cef int s0/0

Serial0/0 is up (if_number 3)
  Corresponding hwidb fast_if_number 3
  Corresponding hwidb firstsw->if_number 3
  Internet address is 10.10.10.1/30
  ICMP redirects are always sent
  Per packet load-sharing is disabled
  IP unicast RPF check is disabled
R1#sh ip cef 200.1.1.1
200.1.1.0/24, version 15, epoch 0, per-destination sharing
0 packets, 0 bytes
  via 10.10.10.2, Serial0/0, 0 dependencies
    traffic share 1

Per-packet Load Balance Lab

This lab resulting equal network load balancing using static route. We just need to add "ip load-sharing per-packet" on interface basis, in this lab means interface Serial 0/0 and Serial 0/1 on both routers.
Note that not all IOS versions support this command.

R1(config)#int s0/0
R1(config-if)#ip load-sharing per-packet

R1(config-if)#int s0/1
R1(config-if)#ip load-sharing per-packet
R1(config-if)#end
R1#ping 200.1.1.1 rep 1000 size 1000 source 100.1.1.1
--- ouput omitted ---
R1#sh int s0/0 | i output rate
  30 second output rate 61000 bits/sec, 8 packets/sec
R1#sh int s0/1 | i output rate
  30 second output rate 61000 bits/sec, 8 packets/sec
R1#
R1#sh ip cef 200.1.1.1
200.1.1.0/24, version 15, epoch 0, per-packet sharing
R1#sh cef int s0/0
Serial0/0 is up (if_number 3)
  Corresponding hwidb fast_if_number 3
  Corresponding hwidb firstsw->if_number 3
  Internet address is 10.10.10.1/30
  ICMP redirects are always sent
  Per packet load-sharing is enabled

R1#sh run int s0/0
Building configuration...

Current configuration : 163 bytes
!
interface Serial0/0
 description Link #1 to R2
 ip address 10.10.10.1 255.255.255.252
 ip load-sharing per-packet
 load-interval 30
 serial restart-delay 0
end

R1#sh run int s0/1
Building configuration...

Current configuration : 163 bytes
!
interface Serial0/1
 description Link #2 to R2
 ip address 20.20.20.1 255.255.255.252
 ip load-sharing per-packet
 load-interval 30
 serial restart-delay 0
end

R1#

Related Posts by Categories



3 comments:

Sakun Sharm said...

Thanks..!!
Good Article..! :)

John Salchichon said...

Nice, thanks for the help!
Cheers!

Anonymous said...

hello Great article!! I have a scenarios like this but i want to do load balancing with two isp. One of them is asdl, I mean I learn the gateway for dhcp and the another i know the next hop. the problem is that i can´t configure the router of the isp and i use the same instruction but they work like failover. Can you help with something? do you have another example?

Post a Comment

 
© Copyright 2010 Free Lab Workbook All rights reserved | freelabworkbook.blogspot.com is proudly powered by Blogger.com | Template by o-om.com
Edited by Free Lab Workbook August 2010.