9.4 Peer Groups
9.4.1 Overview of peer groups
A BGP peer group is a group of BGP neighbors that share the same update policies. Instead of defining the same policies for each individual neighbor, you can define a peer group and then assign policies to the peer group itself.

Not only do peer groups save you from having to repetitively configure each BGP peer, but they also save the BGP router from the effort of parsing the policies sequentially for each neighbor. With peer groups, the router formulates the update message once, based on the policies of the peer group, and then floods the same update to all the neighbors that fall within the group.

In the figure, RTA has three internal peers with which it has the same internal policies, and three external peers with which it has the same policies.
RTA's configuration includes two sets of peer groups, one for inside the AS and one for outside the AS. Each peer group contains the set of policies that RTA has toward its peers. These policies could be a set of IP prefix filters, AS_Path filters, or even filters that result in attribute manipulation. After the peer groups have been defined, these policies are applied to the neighbors that make up the peer group.

Because of the route update optimization that peer groups offer, some restrictions need to be followed for peer groups to work correctly with EBGP peers. The hub router (such as RTA in the figure) cannot be a transit router for the external autonomous systems. In other words, updates from one EBGP neighbor in the peer group should not be passed to other EBGP neighbors in the same peer group.

What if one or more of the peers in the group require different policies than the rest of the peer group? The answer depends whether the update is incoming or outbound. If a router requires a conflicting outbound update policy, then it can not belong to the peer group. However, policies for incoming updates can be overridden on a per-neighbor basis. If the peer merely requires additional (and not conflicting) policy definition, then those specific configurations can be applied individually. For example, assume that RTA requires an additional set of filters to be set toward its peer RTB. RTA can apply the extra filters toward RTB while still keeping RTB within the external peer group.