Routing Over Multiple Paths with Equal Costs

Problem

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

Solution

By default, the router will install up to four routes to the same destination for most routing protocols, except BGP where the default is one, and static routes that allow six. You can change this default to any value between one and sixteen by using the configuration command maximum-paths. In IOS versions before 12.3(2)T, the maximum number of paths was six:

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 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 only include a standard maximum-paths command. This command sets the maximum paths for both iBGP and eBGP.

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 when 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 when there are several Autonomous System Boundary Routers (ASBR) 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 level 12.2T, you can only specify a single value for both iBGP and eBGP. Note that 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 that packets 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 by 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 will discuss CEF in more detail in Chapter 11.

See Also

Chapter 9; Chapter 11

Категории