Previous section   Next section

Recipe 9.15 Using Peer Groups

9.15.1 Problem

You want to apply the same options to several peers.

9.15.2 Solution

Peer groups allow you to apply the same BGP configuration to a number of neighbors at the same time:

Router1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#router bgp 65500
Router1(config-router)#neighbor EBGP-PEERS peer-group
Router1(config-router)#neighbor EBGP-PEERS prefix-list PRE-RTFILTER in
Router1(config-router)#neighbor EBGP-PEERS filter-list 15 out
Router1(config-router)#neighbor 192.168.1.5 remote-as 65520
Router1(config-router)#neighbor 192.168.1.5 peer-group EBGP-PEERS
Router1(config-router)#neighbor 192.168.1.9 remote-as 65521
Router1(config-router)#neighbor 192.168.1.9 peer-group EBGP-PEERS
Router1(config-router)#neighbor 192.168.1.13 remote-as 65522
Router1(config-router)#neighbor 192.168.1.13 peer-group EBGP-PEERS
Router1(config-router)#neighbor 192.168.1.17 remote-as 65523
Router1(config-router)#neighbor 192.168.1.17 peer-group EBGP-PEERS
Router1(config-router)#end
Router1#

9.15.3 Discussion

Peer groups have been around since IOS Version 11.0, but they had several unfortunate restrictions that were eliminated in Version 12.0. The most important of these were that all eBGP members of the same peer group had to be members of the same IP subnet and routers couldn't perform transit functions for eBGP neighbors that were members of the same peer group. These restrictions have been removed, but you will still sometimes see these problems discussed in older references.

Peer groups are most useful when you have several neighbors, all with nearly the same BGP parameters. In the previous example, we created a peer group called EBGP-PEERS that we can then applied to several different neighbors. This allows you to set up common properties such as filter lists or route maps, and apply them identically to a large list of peers.

The biggest value for this feature is for ISPs who want to set up common properties for all of the other ISP routers at a large Internet exchange point. But peer groups can also be useful in enterprise networks that include several ASes that all connect with one another.

Suppose, for example, that you need to connect to four different ASes, and that each connection point used two BGP routers for redundancy. Each router would have an eBGP connection to two routers in each of three different ASes, for a total of six eBGP connections.

If you need to do any special filtering on one of these routers, then you would have to configure six different eBGP neighbors with an identical set of filters. Or, if you use peer groups, you can set up the filters just once and reduce the typing as well as the chance of errors. Further, if you need to make any changes to your filters, you can make them once and they will instantly apply to all of the group members.

It's also important to remember that you can use the peer group as a basic template, but still add further options for one or more individual peers:

Router1(config)#router bgp 65500
Router1(config-router)#neighbor EBGP-PEERS peer-group
Router1(config-router)#neighbor EBGP-PEERS prefix-list PRE-RTFILTER in
Router1(config-router)#neighbor EBGP-PEERS filter-list 15 out
Router1(config-router)#neighbor 192.168.1.5 remote-as 65520
Router1(config-router)#neighbor 192.168.1.5 peer-group EBGP-PEERS
Router1(config-router)#neighbor 192.168.1.5 ebgp-multihop 5

  Previous section   Next section
Top