BGP Peer Template Overview and Configuration Example
What is BGP Peer Template
BGP peer templates allow you to create blocks of common configuration that you can reuse across similar BGP peers. Each block allows you to define a set of attributes that a peer then inherits.
You can choose to override some of the inherited attributes as well, making it a very flexible scheme for simplifying the repetitive nature of BGP configurations.
There are mainly 2 types of peer templates:
I- Peer-Session Template
The peer-session template defines BGP peer session attributes, such as the transport details, remote autonomous system number of the peer, and session timers.
A peer-session template can also inherit attributes from another peer-session template.
Note
Locally defined attributes that override the attributes from an inherited peer-session.
Peer-Session Template configuration Example:
First define the peer-session template and add the needed parameters:
router bgp 65010
template peer-session LD_TEMP
remote-as 65020
local-as 65030
description LD_TEMPLATE
Code language: JavaScript (javascript)
We can inherit another peer session template:
router bgp 65010
template peer-session LD_TEMP
remote-as 65020
local-as 65030
description LD_TEMPLATE
inherit peer-session LD_GLOBAL_TEMP
template peer-session LD_GLOBAL_TEMP
update-source Loopback100
Code language: JavaScript (javascript)
Apply the session tempalte under the neighbor:
router bgp 65010
neighbor 172.16.40.2 inherit peer-session LD_TEMP
Code language: CSS (css)
II- Peer-Policy Template
A peer-policy template defines the address-family dependent policy aspects for a peer including the inbound and outbound policy, filter-lists, and prefix-lists.
A peer-policy template can inherit from a set of peer-policy templates.
Peer-Policy Template configuration Example:
router bgp 65010
template peer-policy ALL_PEERS
soft-reconfiguration inbound
template peer-policy eBGP_PEERS
maximum-prefix 2000
inherit peer-policy ALL_PEERS 10
neighbor 172.16.70.2 inherit peer-policy eBGP_PEERS
Code language: CSS (css)
Note
We can inherit multiple Peer-Policy tempalte:
inherit peer-policy ALL_PEERS 10
inherit peer-policy other_PEERS 20
Higher-order templates override lower-order templates
Below are the parameters that can defined under Session tempalte and Policy template:
Reference: Cisco.com