
Basic BGP Configuration
walks through the process of configuring BGP to establish a neighbor session and how routes exchanged between peers.
When configuring BGP, it is best to think of the configuration from a modular perspective. BGP router configuration requires the following components:
- BGP session parameters
- Address family initialization
- Activate the address family on the BGP peer
BGP Router Configuration Components
- BGP session parameters – BGP session parameters provide settings that involve estab- lishing communication to the remote BGP neighbor. Session settings include the ASN of the BGP peer, authentication, and keepalive timers.
- Address family initialization – The address family is initialized under the BGP router configuration mode. Network advertisement and summarization occur within the address family.
- Activate the address family on the BGP peer – In order for a session to initiate, one address family for a neighbor must be activated. The router’s IP address is added to the neighbor table, and BGP attempts to establish a BGP session or accepts a BGP session initiated from the peer router.
Modular Configuration
- Step 1. Initialize the BGP routing process with router bgp as-number.
- Step 2. (Optional) Statically define the BGP router ID (RID). The dynamic RID allocation logic uses the highest IP address of any of the up loopback interfaces.
- Step 3. Identify the BGP neighbor’s IP address and autonomous system number with the BGP router configuration command neighbor ip-address remote-as as-number.
- Step 4. Initialize the address family with the BGP router configuration command address-family afi safi.
- Step 5. Activate the address family for the BGP neighbor with the BGP address family configuration command neighbor ip-address activate.
Configuring Basic BGP on IOS
R1 (Default IPv4 Address-Family Enabled) router bgp 65100 neighbor 10.12.1.2 remote-as 65200 R2 (Default IPv4 Address-Family Disabled) router bgp 65200 no bgp default ipv4-unicast neighbor 10.12.1.1 remote-as 65100 ! address-family ipv4 neighbor 10.12.1.1 activate exit address-family
Verification of BGP Sessions
- The BGP session is verified with the command show bgp afi safi summary.
- Earlier commands, such as show ip bgp summary, came out before MBGP and do not provide a structure for the current multiprotocol capabilities within BGP.
Field | Description |
Neighbor | IP address of the BGP peer |
V | BGP version spoken by the BGP peer |
AS | Autonomous system number of the BGP peer |
MsgRcvd | Count of messages received from the BGP peer |
MsgSent | Count of messages sent to the BGP peer |
TblVer | Last version of the BGP database sent to the peer |
InQ | Number of messages queued to be processed by the peer |
OutQ | Number of messages queued to be sent to the peer |
Up/Down | Length of time the BGP session is established or the current status if the sessionis not in an established state |
State/PfxRcd | Current state of the BGP peer or the number of prefixes received from the peer |
Prefix Advertisement
- BGP network statements do not enable BGP for a specific interface; instead, they identify specific network prefixes to be installed into the BGP table, known as the Loc-RIB table.
- As the BGP prefix is installed into the Loc-RIB table, the following BGP PAs are set, depending on the RIB prefix type:
- Connected network – The next-hop BGP attribute is set to 0.0.0.0, the BGP origin attribute is set to i (IGP), and the BGP weight is set to 32,768.
- Static route or routing protocol – The next-hop BGP attribute is set to the next-hop IP address in the RIB, the BGP origin attribute is set to i (IGP), the BGP weight is set to 32,768, and the MED is set to the IGP metric.
All routes in the Loc-RIB table use the following process for advertisement to BGP peers: Step 1. Pass a validity check. Verify that the NRLI is valid and that the next-hop address is resolvable in the global RIB. If the NRLI fails, the NLRI remains but does not process further. Step 2. Process outbound neighbor route policies. After processing, if a route was not denied by the outbound policies, the route is maintained in the Adj-RIB-Out table for later reference. Step 3. Advertise the NLRI to BGP peers. If the NLRI’s next-hop BGP PA is 0.0.0.0, then the next-hop address is changed to the IP address of the BGP session. The network statement resides under the appropriate address family within the BGP router configuration. The command network network mask subnet-mask [route-map route-map- name] is used for advertising IPv4 networks. The optional route – map provides a method of setting specific BGP PAs when the prefix installs into the Loc-RIB table.
Receiving and Viewing Routes
BGP uses three tables for maintaining the network prefix and PAs for a route:
- Adj-RIB-In – Contains the NLRIs in original form
- Loc-RIB – Contains all the NLRIs that originated locally or were received from other BGP peers.
- Adj-RIB-Out – Contains the NLRIs after outbound route policies have been processed.
The command show bgp afi safi displays the contents of the BGP database (Loc-RIB) on the router.
Field |
Description |
Network |
A list of the network prefixes installed in BGP. Valid NLRIs are indicated by the *. The NLRI selected as the best path is indicated by an angle bracket (>). |
Next Hop |
A well-known mandatory BGP path attribute that defines the IP address for the next hop for that specific NLRI. |
Metric |
Multiple-exit discriminator (MED): An optional non-transitive BGP path attribute used in BGP for the specific NLRI. |
LocPrf |
Local Preference: A well-known discretionary BGP path attribute used in the BGP best-path algorithm for the specific NLRI. |
Weight |
A locally significant Cisco-defined attribute used in the BGP best-path algorithm for the specific NLRI. |
Path and Origin |
AS_Path: A well-known mandatory BGP path attribute used for loop prevention and in the BGP best-path algorithm for the specific NLRI. Origin: A well-known mandatory BGP path attribute used in the BGP best-path algorithm. A value of i represents an IGP, e indicates EGP, and ? indicates a route that was redistributed into BGP. |
Receiving and Viewing Routes
The command show bgp afi safi network displays all the paths for a specific route and the BGP path attributes for that route. The Adj-RIB-Out table is a unique table maintained for each BGP peer. It enables a network engineer to view routes advertised to a specific router. The command show bgp afi safi neighbor ip-address advertised routes displays the contents of the Adj-RIB-Out table for a neighbor.
BGP Route Advertisements from Indirect Sources
BGP should be thought of as a routing application as the BGP session and route advertisement are two separate components. BGP can install multiple routes learned from static routes, EIGRP, and OSPF. Redistributing routes learned from an IGP into BGP is completely safe. Redistributing routes learned from BGP into an IGP should be done with extreme caution. Example 11-12 Configuring Advertising Routes for Non-Connected Routes
Other useful information: