Problem
You want to apply the same options to several peers.
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)#exit Router1(config)#end Router1#
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 you couldn't act as a transit router to eBGP neighbors that were members of the same peer group. These restrictions have been removed now, 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 above example, we have created a peer group called EBGP-PEERS that we then apply 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 ASs that all connect with one another.
Suppose, for example, that you need to connect to four different ASs, and that each connection point used two BGP routers for redundancy. Then each router would have an eBGP connection to two routers in each of three different ASs, for a total of six eBGP connections.
If you need to do any special filtering that would be common to all 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
The example in the "Solution" section of this recipe uses eBGP peers, but you can also use peer groups for iBGP peers. To be worthwile, however, there should be at least three common BGP neighbor commands that you want to sue with two or more peers:
Router1(config)#router bgp 6550 Router1(config-router)#neighbor IBGP-PEERS peer-group Router1(config-router)#neighbor IBGP-PEERS update-source Loopback0 Router1(config-router)#neighbor IBGP-PEERS route-reflector-client Router1(config-router)#neighbor 192.168.101.5 remote-as 65500 Router1(config-router)#neighbor 192.168.101.5 peer-group IBGP-PEERS Router1(config-router)#neighbor 192.168.101.9 remote-as 65500 Router1(config-router)#neighbor 192.168.101.9 peer-group IBGP-PEERS
Router Configuration and File Management
Router Management
User Access and Privilege Levels
TACACS+
IP Routing
RIP
EIGRP
OSPF
BGP
Frame Relay
Handling Queuing and Congestion
Tunnels and VPNs
Dial Backup
NTP and Time
DLSw
Router Interfaces and Media
Simple Network Management Protocol
Logging
Access-Lists
DHCP
NAT
First Hop Redundancy Protocols
IP Multicast
IP Mobility
IPv6
MPLS
Security
Appendix 1. External Software Packages
Appendix 2. IP Precedence, TOS, and DSCP Classifications
Index