Load Balancing with OSPF
Load balancing is a standard functionality of Cisco IOS Software that is available across all router platforms. It is inherent to the forwarding process in the router, and it enables a router to use multiple paths to a destination when it forwards packets. The number of paths used is limited by the number of entries that the routing protocol puts in the routing table. Four entries is the default in Cisco IOS Software for IP routing protocols except for BGP. BGP has a default of one entry. The maximum number of paths you can configure is 16.
Figure 4-6 shows an example of configuring an OSPF router to load balance across six equal-cost paths.
Figure 4-6 OSPF Equal-Cost Load Balancing

The cost (or metric) of an interface in OSPF indicates the overhead that is required to send packets across a certain interface. The cost of an interface is inversely proportional to its bandwidth. A higher bandwidth indicates a lower cost. By default, Cisco routers calculate the cost of an interface based on the bandwidth. However, you can force the cost of an interface with the command ip ospf cost {value} in interface configuration mode.
If equal-cost paths exist to the same destination, the Cisco implementation of OSPF can keep track of up to 16 next hops to the same destination in the routing table (which is called load balancing). By default, the Cisco router supports up to four equal-cost paths to a destination for OSPF. Use the maximum-paths command under the OSPF router process configuration mode to set the number of equal-cost paths in the routing table, as shown in Example 4-8.
Example 4-8 Setting the Number of Equal-Cost Paths in the Routing Table
|
RouterX(config) |
#router ospf 1 |
|
|
RouterX(config- |
router)#maximum |
paths ? |
|
<1-16> Number |
of paths |
|
|
RouterX(config- |
router)#maximum- |
paths 3 |
You can use the show ip route command to find equal-cost routes. Following is an example of the show ip route command output for a specific subnet that has multiple routes available in the routing table. Example 4-9 shows three equal-cost paths to the 194.168.20.0 network.
Example 4-9 Finding Equal-Cost Routes with the show ip route Command
|
RouterX#show ip route 194.168.20.0 |
|
|
Routing entry for 194.168.20.0/24 |
|
|
Known via "ospf 1", distance 110, metric 74, type intra area |
|
|
Redistributing via ospf 1 |
|
|
Last update from 10.10.10.1 on Seriall, 00:00:01 ago |
|
|
Routing Descriptor Blocks: |
|
|
* 20.20.20.1, from 204.204.204.1, 00:00:01 ago |
via Serial2 |
|
Route metric is 74, traffic share count is |
1 |
|
30.30.30.1, from 204.204.204.1, 00:00:01 ago |
via Serial3 |
|
Route metric is 74, traffic share count is |
1 |
|
10.10.10.1, from 204.204.204.1, 00:00:01 ago |
via Seriall |
|
Route metric is 74, traffic share count is |
1 |
Notice the three routing descriptor blocks. Each block is one available route. Also note the asterisk (*) next to one of the block entries. The asterisk corresponds to the active route that is used for new traffic. The term "new traffic" corresponds to a single packet or an entire flow to a destination, depending on whether the router is performing per-destination or per-packet load balancing.
Continue reading here: OSPF Authentication
Was this article helpful?
Readers' Questions
-
mulu tekle2 months ago
- Reply
-
matthew8 months ago
- Reply
-
mebrat awate8 months ago
- Reply
-
hagos1 year ago
- Reply
-
Rorimac1 year ago
- Reply
-
ruben olszewski1 year ago
- Reply
-
dina1 year ago
- Reply
-
massawa1 year ago
- Reply
-
Karolin1 year ago
- Reply
-
faramir goodchild1 year ago
- Reply
-
teodros1 year ago
- Reply
-
karin1 year ago
- Reply
-
Monika1 year ago
- Reply
-
Pupa1 year ago
- Reply
-
karolin1 year ago
- Reply
-
mezan1 year ago
- Reply
-
kaisa piili1 year ago
- Reply
-
DAVID1 year ago
- Reply
-
kieron1 year ago
- Reply
-
Balbo1 year ago
- Reply
-
KRISTIN1 year ago
- Reply
-
Marie Vogel1 year ago
- Reply
-
Roberto1 year ago
- Reply
-
Uta1 year ago
- Reply
-
amina1 year ago
- Reply