Friday, May 9, 2014

OSPF Unequal-Cost Load Balancing

Note:
I posted this shortly after I obtained my CCNA and didn't fully understand the nature/differences between how OSPF handles multiple paths vs. how EIGRP does it.  OSPF can't really "load-balance" or take advantage of the higher bandwidth of one link over another slower link.

**********************************

Hello all,

here's a fun little demo (well... I had fun at least) of how to do unequal-cost load balancing w/ OSPF.  Now I know that your textbooks and other sources will tell you that EIGRP is the only routing protocol that can do this, and that's true in a strict sense, but they both can accomplish the same thing.

Technically, when the multiple routes to the same subnet are added to the routing table in EIGRP, some, and perhaps all, will show a different cost/metric to the right of the AD:

D    192.168.203.0/24 [90/27392000] via 10.10.10.12, 00:00:08, Serial0/0/0
                      [90/27392000] via 10.10.10.11, 00:00:08, Serial0/0/0
                      [90/28160000] via 192.168.202.2, 00:00:07, Tunnel2
                      [90/28160000] via 192.168.201.2, 00:00:06, Tunnel0

When you force unequal-cost load balancing on OSPF the costs will look the same even though they are over different types of connections that clearly should have vastly different costs:



This screenshot was taken from the video below.  In it you can see that all the routes say the cost is "3" (this is why it's said that OSPF only does "equal-cost load balancing), however the Serial line (1.5Mb) route should have a cost of 131 and the Ethernet (10Mb) route should be 21.  We've tricked the OSPF protocol to think that these routes are faster than they really are.

I've included a video below that shows how you can accomplish this by using the "bandwidth" interface subcommand.  You can also, under the "router ospf 1" process, use the "auto-cost reference-bandwidth" command, which might be easier than touching each interface on a router, however if you want to be very "granular" with which ones you want to include in the load-balancing scheme, then you'll probably want to just use the "bandwidth" command.

Apologies in advance for all the "uhs" and "ums" in the video; I groan every time I watch one of these that I've recorded.  Lastly, if you're trying to load-balance over more than 4 routes, then you'll need to adjust the maximum-paths value to anywhere from 5-16, as the default is set to 4.  This is accomplished with the "maximum-paths [1-16]" command under the ospf router process.

Also, in the video I mention that I'm not sure about the "auto-cost reference-bandwidth"; whether it's local to the router or if its setting applies to all routes that it "sees" on the network.  Turns out that it's only local to the router so you'd want to apply the same command to each OSPF process on each router in your network.

Feel free to leave comments below.  Thanks.





View my profile on LinkedIn