01-24-2020 02:35 AM
Hello community,
i'm new in Cisco Router using IOS and I have some questions.
I use a Cisco 2951 Router and I want to implement loadbalancing.
I read a lot about cisco loadbalacing but actually I don't find a solution for my problem.
My network description:
I have some local networks (vlans) connected to one ethernet port and 2 ISP wan connections to the other ethernet ports.
My interfaces have the "ip route-cache" and "ip load-sharing per-destination" commands and I use two default gateway
"ip route 0.0.0.0 0.0.0.0 192.168.3.1" and "ip route 0.0.0.0 0.0.0.0 192.168.3.1" and "ip route 0.0.0.0 0.0.0.0 192.168.4.1".
In this enviroment the loadbalaning is working for equal costs. The router share the traffic to 50:50 percent.
But one wan connection is slower and has a higher cost depends on network load and so it should has an other ratio, for example75:25 percent. 75 percent load for the fast and 25 percent for the slow connection.
Is it possible to configure this? I read a lot about loadbalancing with routing protocols but I have only one cisco Router and the other ISP border routers
don't speak a routing protocol for external.
The second question is if it's possible to configure the second (slower) wan connection as additional route if the first wan connection (fast) has a higher network load.
I had some tries with ip sla to find a solution. It works to switch the routes(icmp-echo with timeout and track) if the first wan connection has a high network load.
But if it switchs to the second (slower) wan, the first connection is lost.
Maybe, someone has experience in loadbalancing in this enviroment and has successfull implement.
Thanks and have a nice day
01-24-2020 04:20 AM
Hello,
regarding the unequal cost load balancing, you can use a 'trick' and configure multiple static routes using bogus IP addresses. Let's say you ISP link with IP address 192.168.3.1 is the link you want to send 25% of bandwidth over, and the other ISP link with IP address 192.168.4.1 should use 75%, you would configure the below:
ip route 10.0.1.1 255.255.255.255 192.168.3.1
ip route 10.0.2.1 255.255.255.255 192.168.4.1
ip route 10.0.2.2 255.255.255.255 192.168.4.1
ip route 10.0.2.3 255.255.255.255 192.168.4.1
!
ip route 0.0.0.0 0.0.0.0 10.0.1.1
ip route 0.0.0.0 0.0.0.0 10.0.2.1
ip route 0.0.0.0 0.0.0.0 10.0.2.2
ip route 0.0.0.0 0.0.0.0 10.0.2.3
This will result in a 3:1 ratio in favor of 192.168.4.1.
01-24-2020 05:48 AM
Hello,
you can also combine the multiple static routes and an EEM script. The script below assumes that interface GigabitEthernet0/0 is the link that should get 75 percent of the traffic, and GigabitEthernet0/1 the link that should get 25 percent of the traffic. The line:
action 1.4 if $TX_LOAD gt 15
is the most important. The script checks for the value txload. If the value is higher (greater than 'gt') what you have configured, the script will execute a series of commands, and vice versa, if the txload is lower, it will do the reverse.
If you have a GigabitEthernet interface, a 1Gbps load would be 255. A 100Mbps load would be 25. In the example below, I assumed a line speed of 100, the value to check for is 15, which would mean the link is 60 percent.
event manager applet HIGH_LOAD_FAILOVER
event timer watchdog time 5 maxrun 31536000
action 1.0 cli command "enable"
action 1.1 cli command "show interfaces GigabitEthernet 0/0 | section txload
action 1.2 set TX_LOAD "$_cli_result"
action 1.3 regexp "txload ([0-9]+)" "$TX_LOAD" match TX_LOAD
action 1.4 if $TX_LOAD gt 15
action 1.6 cli command "configure terminal"
action 1.7 cli command "no ip route 0.0.0.0 0.0.0.0 192.168.4.1"
action 1.8 cli command "ip route 10.0.1.1 255.255.255.255 192.168.3.1"
action 1.9 cli command "ip route 10.0.2.1 255.255.255.255 192.168.4.1"
action 2.0 cli command "ip route 10.0.2.2 255.255.255.255 192.168.4.1"
action 2.1 cli command "ip route 10.0.2.3 255.255.255.255 192.168.4.1"
action 2.2 cli command "ip route 0.0.0.0 0.0.0.0 10.0.1.1"
action 2.3 cli command "ip route 0.0.0.0 0.0.0.0 10.0.2.1"
action 2.4 cli command "ip route 0.0.0.0 0.0.0.0 10.0.2.2"
action 2.5 cli command "ip route 0.0.0.0 0.0.0.0 10.0.2.3"
action 2.6 cli command "interface GigabitEthernet 0/1"
action 2.7 cli command "no shut"
action 2.8 cli command "do clear ip nat translation *"
action 2.9 cli command "end"
action 3.0 if $TX_LOAD lt 15
action 3.1 cli command "configure terminal"
action 3.2 cli command "ip route 0.0.0.0 0.0.0.0 192.168.4.1"
action 3.3 cli command "no ip route 10.0.1.1 255.255.255.255 192.168.3.1"
action 3.4 cli command "no ip route 10.0.2.1 255.255.255.255 192.168.4.1"
action 3.5 cli command "noip route 10.0.2.2 255.255.255.255 192.168.4.1"
action 3.6 cli command "no ip route 10.0.2.3 255.255.255.255 192.168.4.1"
action 3.7 cli command "no ip route 0.0.0.0 0.0.0.0 10.0.1.1"
action 3.8 cli command "no ip route 0.0.0.0 0.0.0.0 10.0.2.1"
action 3.9 cli command "no ip route 0.0.0.0 0.0.0.0 10.0.2.2"
action 4.0 cli command "no ip route 0.0.0.0 0.0.0.0 10.0.2.3"
action 4.1 cli command "interface GigabitEthernet 0/1"
action 4.2 cli command "shut"
action 4.3 cli command "do clear ip nat translation *"
action 4.4 cli command "end"
action 4.5 end
action 4.6 end
01-24-2020 09:04 AM
01-24-2020 04:59 PM
Hi,
thanks for your great and fast answers.
I tryed your solutions and it's nearly what I want.
The EEM script is a good possibility but it seems that after the switch to the additional route that all connections have a short reset. For example: If there is a download which produce the high load and
after the route switch the download will abort. The established connections to the destinations should't abort, new connections should use the additional route.
Are there any documents für PfR and flow control that your recommend?
What will bee the better solution, EEM or PfR?
Thanks
01-25-2020 12:01 PM - edited 01-25-2020 12:03 PM
https://www.cisco.com/c/en/us/products/ios-nx-os-software/performance-routing-pfr/index.html
IMO, PfR might be the better solution, but much depends on what you need and what you can afford.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide