PacketLab
BGP · Advanced BGP Features

Peer Groups

Replace repeated neighbor settings with a shared peer group while preserving each remote AS.

Four routers and a common policy

R1 has three external neighbors in different ASes. Start with direct sessions, then migrate the lab to loopback-sourced sessions with multihop and a common outbound MED. The complete baseline below is the direct-session starting point.

Lab topologyPhysical links
.1 / .2.5 / .6.9 / .10R1AS 65001R2AS 65002R3AS 65003R4AS 65004
Solid lines are physical links. Endpoint labels are the last octets of 192.0.2.x/30, first router then second router in the address table. Loopback0 is 10.255.0.N/32 on RN. Logical BGP peers are listed in the configurations.
LinkFirst endpointSecond endpoint
R1–R2GigabitEthernet1 192.0.2.1/30GigabitEthernet1 192.0.2.2/30
R1–R3GigabitEthernet2 192.0.2.5/30GigabitEthernet1 192.0.2.6/30
R1–R4GigabitEthernet3 192.0.2.9/30GigabitEthernet1 192.0.2.10/30
Complete baseline configurations

R1

hostname R1
ip cef
interface Loopback0
 ip address 10.255.0.1 255.255.255.255
exit
interface Loopback10
 ip address 198.51.100.1 255.255.255.255
exit
interface GigabitEthernet1
 ip address 192.0.2.1 255.255.255.252
 no shutdown
exit
interface GigabitEthernet2
 ip address 192.0.2.5 255.255.255.252
 no shutdown
exit
interface GigabitEthernet3
 ip address 192.0.2.9 255.255.255.252
 no shutdown
exit
router bgp 65001
 bgp router-id 10.255.0.1
 no bgp default ipv4-unicast
 neighbor 192.0.2.2 remote-as 65002
 neighbor 192.0.2.6 remote-as 65003
 neighbor 192.0.2.10 remote-as 65004
 address-family ipv4 unicast
  no auto-summary
  neighbor 192.0.2.2 activate
  neighbor 192.0.2.6 activate
  neighbor 192.0.2.10 activate
  network 198.51.100.1 mask 255.255.255.255
 exit-address-family
end

R2

hostname R2
ip cef
interface Loopback0
 ip address 10.255.0.2 255.255.255.255
exit
interface GigabitEthernet1
 ip address 192.0.2.2 255.255.255.252
 no shutdown
exit
router bgp 65002
 bgp router-id 10.255.0.2
 no bgp default ipv4-unicast
 neighbor 192.0.2.1 remote-as 65001
 address-family ipv4 unicast
  no auto-summary
  neighbor 192.0.2.1 activate
 exit-address-family
end

R3

hostname R3
ip cef
interface Loopback0
 ip address 10.255.0.3 255.255.255.255
exit
interface GigabitEthernet1
 ip address 192.0.2.6 255.255.255.252
 no shutdown
exit
router bgp 65003
 bgp router-id 10.255.0.3
 no bgp default ipv4-unicast
 neighbor 192.0.2.5 remote-as 65001
 address-family ipv4 unicast
  no auto-summary
  neighbor 192.0.2.5 activate
 exit-address-family
end

R4

hostname R4
ip cef
interface Loopback0
 ip address 10.255.0.4 255.255.255.255
exit
interface GigabitEthernet1
 ip address 192.0.2.10 255.255.255.252
 no shutdown
exit
router bgp 65004
 bgp router-id 10.255.0.4
 no bgp default ipv4-unicast
 neighbor 192.0.2.9 remote-as 65001
 address-family ipv4 unicast
  no auto-summary
  neighbor 192.0.2.9 activate
 exit-address-family
end

Open plain-text configurations

Outputs are illustrative, not recorded router results. Each lab starts from its own baseline. Configuration and feature support vary by image and release; platform-specific examples identify their prerequisites.

Prepare loopback reachability

R1 needs the three remote loopback routes; each remote router needs a return route to R1’s loopback. Configure these before changing the BGP transport.

ip route 10.255.0.2 255.255.255.255 192.0.2.2
ip route 10.255.0.3 255.255.255.255 192.0.2.6
ip route 10.255.0.4 255.255.255.255 192.0.2.10

R2

ip route 10.255.0.1 255.255.255.255 192.0.2.1

R3

ip route 10.255.0.1 255.255.255.255 192.0.2.5

R4

ip route 10.255.0.1 255.255.255.255 192.0.2.9
R1# show ip route 10.255.0.2
Routing entry for 10.255.0.2/32
  Known via "static", distance 1
  * 192.0.2.2

Inspect the repeated configuration

On R1, remove the direct-neighbor definitions and add the three loopback neighbors. Apply the same MED policy to each. The remote examples below complete the migration.

route-map SET-MED permit 10
 set metric 2323
exit
router bgp 65001
 no neighbor 192.0.2.2
 no neighbor 192.0.2.6
 no neighbor 192.0.2.10
 neighbor 10.255.0.2 remote-as 65002
 neighbor 10.255.0.2 update-source Loopback0
 neighbor 10.255.0.2 ebgp-multihop 2
 neighbor 10.255.0.3 remote-as 65003
 neighbor 10.255.0.3 update-source Loopback0
 neighbor 10.255.0.3 ebgp-multihop 2
 neighbor 10.255.0.4 remote-as 65004
 neighbor 10.255.0.4 update-source Loopback0
 neighbor 10.255.0.4 ebgp-multihop 2
 address-family ipv4 unicast
  neighbor 10.255.0.2 activate
  neighbor 10.255.0.2 route-map SET-MED out
  neighbor 10.255.0.3 activate
  neighbor 10.255.0.3 route-map SET-MED out
  neighbor 10.255.0.4 activate
  neighbor 10.255.0.4 route-map SET-MED out
 exit-address-family

R2

router bgp 65002
 no neighbor 192.0.2.1
 neighbor 10.255.0.1 remote-as 65001
 neighbor 10.255.0.1 update-source Loopback0
 neighbor 10.255.0.1 ebgp-multihop 2
 address-family ipv4 unicast
  neighbor 10.255.0.1 activate
 exit-address-family

R3

router bgp 65003
 no neighbor 192.0.2.5
 neighbor 10.255.0.1 remote-as 65001
 neighbor 10.255.0.1 update-source Loopback0
 neighbor 10.255.0.1 ebgp-multihop 2
 address-family ipv4 unicast
  neighbor 10.255.0.1 activate
 exit-address-family

R4

router bgp 65004
 no neighbor 192.0.2.9
 neighbor 10.255.0.1 remote-as 65001
 neighbor 10.255.0.1 update-source Loopback0
 neighbor 10.255.0.1 ebgp-multihop 2
 address-family ipv4 unicast
  neighbor 10.255.0.1 activate
 exit-address-family

Replace repetition with a group

On R1, remove the three temporary loopback definitions, create EXTERNAL, and bind each address to it. Remote AS numbers remain per neighbor because these ASes differ.

router bgp 65001
 no neighbor 10.255.0.2
 no neighbor 10.255.0.3
 no neighbor 10.255.0.4
 neighbor EXTERNAL peer-group
 neighbor EXTERNAL update-source Loopback0
 neighbor EXTERNAL ebgp-multihop 2
 neighbor 10.255.0.2 remote-as 65002
 neighbor 10.255.0.2 peer-group EXTERNAL
 neighbor 10.255.0.3 remote-as 65003
 neighbor 10.255.0.3 peer-group EXTERNAL
 neighbor 10.255.0.4 remote-as 65004
 neighbor 10.255.0.4 peer-group EXTERNAL
 address-family ipv4 unicast
  neighbor EXTERNAL activate
  neighbor EXTERNAL route-map SET-MED out
 exit-address-family

Verify inheritance and cleanup

R1# show ip bgp peer-group EXTERNAL
BGP peer-group is EXTERNAL
  Members: 10.255.0.2 10.255.0.3 10.255.0.4
R2# show ip bgp 198.51.100.1/32
BGP routing table entry for 198.51.100.1/32
  65001
    10.255.0.1 from 10.255.0.1
      Origin IGP, metric 2323, localpref 100, valid, external, best

Peer groups simplify policy administration. Modern implementations also use dynamic update groups, so one peer group does not universally imply a particular CPU saving. Inbound overrides and outbound compatibility depend on platform rules. Restore the saved baseline configurations to return to direct sessions.

Key Takeaways

  • A peer group shares compatible neighbor settings.
  • Different external AS numbers can remain per member.
  • Loopback peering requires routes in both directions.
  • Group membership does not replace address-family activation.
  • Verify effective attributes after changing the configuration.

Peer Groups Quiz

Six questions · four options each · select one answer per question. Submit all answers to see your score and explanations.

1. Which value differs among these group members?
2. What must exist before loopback peering works?
3. Where is the shared MED policy attached?
4. Does a peer group discover unconfigured neighbors?
5. What is inherited here?
6. What proves the MED policy took effect?
Protocol and command references

Peer-group command reference · BGP specification · Router-symbol attribution.