Previous section   Next section

Recipe 5.10 Routing Over Multiple Paths with Equal Costs

5.10.1 Problem

You want to restrict how many paths your router can use simultaneously to reach a particular destination.

5.10.2 Solution

By default, the router will install up to four routes to the same destination for most routing protocols, except for BGP (where the default is one), and static routes (which allow six). You can change this default to any value between one and six by using the maximum-paths configuration command:

Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#router ospf 65510
Router(config-router)#maximum-paths 2
Router(config-router)#end 
Router#

The same syntax works for other routing protocols:

Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#router eigrp 99
Router(config-router)#maximum-paths 2
Router(config-router)#end
Router#

In IOS Version 12.2T, Cisco introduced a new command to allow you to configure the number of iBGP paths separately from eBGP. You set the maximum number of eBGP paths using the standard maximum-paths command, and specify the number of paths for iBGP separately:

Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#router bgp 65511
Router(config-router)#maximum-paths 2
Router(config-router)#maximum-paths ibgp 3
Router(config-router)#end
Router#

IOS releases prior to 12.2T include only the standard maximum-paths command. This command sets the maximum paths for both iBGP and eBGP.

5.10.3 Discussion

In large, highly redundant networks, it is common to have many possible paths between two points. By default, the router will install up to four routes to the same destination in the routing table for most routing protocols, provided that all of these routes have the same cost. But sometimes this is either too many or too few, so these commands offer a way to change the defaults.

For BGP the default value is one path because of the sheer number of routes in the public Internet and the desire to simplify things where possible. However, BGP is not always used to connect to the Internet. Even when it is, there are times when you want to share the load between two Internet connections. With IOS Version 12.2T, Cisco has introduced the ability to control the number of iBGP paths separately from the number of eBGP paths using the command:

Router(config)#router bgp 65511
Router(config-router)#maximum-paths ibgp 2

This is useful in situations where there are several Autonomous System Boundary Routers (ASBRs) sharing routing information within a complex, multiply connected Autonomous System, but you still wish to keep your external routing tables as simple as possible.

Without the ibgp keyword, this command affects both iBGP and eBGP. So, if you want two different values, you can specify them separately, as we have shown. Before IOS Version 12.2T, you could specify only a single value for both iBGP and eBGP. For BGP, the default value for this parameter is one. However, for all other protocols, the default is four.

When there are several paths available in the routing table, the router will generally alternate between the different possible paths. When you use process switching, the router will alternate packets among the different paths. With fast switching, however, it will alternate flows, rather than individual packets. For TCP connections, this means that each separate connection will find one of the available paths and use this path exclusively. For UDP and ICMP, however, every packet is a separate flow, so successive packets will likely take different paths.

Alternating flows rather than packets results in slightly less efficient load sharing of TCP traffic, but it has the benefit of causing packets to always arrive in the same order that they were sent. When packets take different paths through the network, they can arrive out of sequence. So, in general, it is better to use per-flow rather than per-packet load sharing.

By default, Cisco Express Forwarding (CEF) will also load balance by alternating flows rather than individual packets. You can configure CEF to load balance on a packet-by-packet basis using the interface configuration command ip load-sharing per-packet:

Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#ip cef 
Router(config)#interface Ethernet0
Router(config-if)#ip load-sharing per-packet
Router(config-if)#end
Router#

We discuss CEF in more detail in Chapter 11.


  Previous section   Next section
Top