Introduction
BGP is an exterior gateway protocol (EGP), used to perform interdomain routing in TCP/IP networks. A BGP router needs to establish a connection (on TCP port 179) to each of it's BGP peers before BGP updates can be exchanged. The BGP session between two BGP peers is said to be an external BGP (eBGP) session if the BGP peers are in different autonomous systems (AS) . A BGP session between two BGP peers is said to be an internal BGP (iBGP) session if the BGP peers are in the same autonomous systems.
By default, the peer relationship is established using the IP address of the interface closest to the peer router. However, using the neighbor update-source (registered customers only) command, any operational interface, including the loopback interface, can be specified to be used for establishing TCP connections. This method of peering using a loopback interface is useful since it will not bring down the BGP session when there are multiple paths between the BGP peers, which would otherwise result in tearing down the BGP session if the physical interface used for establishing the session goes down. In addition to that, it also allows the routers running BGP with multiple links between them to load balance over the available paths.
The sample configurations in this document are for iBGP and eBGP, both with and without a loopback addresses.
Note: You can use these configurations for establishing neighbor relationship. Refer to Using the Border Gateway Protocol for Interdomain Routing for more complex configurations.
Prerequisites
Requirements
Before you attempt this configuration, ensure that you meet this requirement:
- Knowledge of BGP protocols
Components Used
This document is not restricted to specific software and hardware versions. The command outputs shown in this document were taken from the 2500 Series Routers running IOS® version 12.2(24a).
Conventions
For more information on document conventions, refer to Cisco Technical Tips Conventions.
Configure
This section contains the following configuration examples:
- iBGP Configuration
- eBGP Configuration
- iBGP Configuration with a Loopback Address
- eBGP Configuration with a Loopback Address
In this section, you are presented with the information to configure the features described in this document.
Note: To find additional information on the commands used in this document, use the Command Lookup Tool (registered customers only) .
Network Diagram
This document uses this network setup:
iBGP Configuration
In this configuration, both routers are in AS 400.
R1-AGS | R6-2500 |
---|---|
Current configuration: !-- Output suppressed. interface Serial1 ip address 10.10.10.1 255.255.255.0 ! router bgp 400!--- Enables BGP for the autonomous !--- system 400. neighbor 10.10.10.2 remote-as 400 !--- Specifies a neighbor 10.10.10.2 !--- in the remote AS 400, making !--- this an iBGP connection. !-- Output suppressed. end | Current configuration: !-- Output suppressed. interface Serial0 ip address 10.10.10.2 255.255.255.0 ! router bgp 400 neighbor 10.10.10.1 remote-as 400 !-- Output suppressed. end |
eBGP Configuration
In this configuration, the router R1-AGS is in AS 300 and Router R6-2500 is in AS 400.
R1-AGS | R6-2500 |
---|---|
Current configuration: !-- Output suppressed interface Serial1 ip address 10.10.10.1 255.255.255.0 ! router bgp 300!--- Enables BGP for the autonomous !--- system 300. neighbor 10.10.10.2 remote-as 400 !--- Specifies a neighbor 10.10.10.2 !--- in the remote AS 400, making !--- this an eBGP connection.!-- Output suppressed. end | Current configuration: !-- Output suppressed. interface Serial0 ip address 10.10.10.2 255.255.255.0 ! router bgp 400 neighbor 10.10.10.1 remote-as 300 !-- Output suppressed. end |
Peers must be directly connected when using eBGP. If they are not directly connected, the neighbor ebgp-multihop (registered customers only)command must be used and a path through an IGP or static route to reach the peer must exist in order for the routers to establish neighbor relationship. In the configuration above, R1-AGS router belongs to AS 300 while R6-2500 router belongs to AS 400.
iBGP Configuration with a Loopback Address
You can configure iBGP using a loopback address (or any other operational interface) as shown in this section.
R1-AGS | R6-2500 |
---|---|
Current configuration: !-- Output suppressed. interface Loopback0 ip address 1.1.1.1 255.255.255.255 ! interface Serial1 ip address 10.10.10.1 255.255.255.0 ! router bgp 300 neighbor 2.2.2.2 remote-as 300 neighbor 2.2.2.2 update-source Loopback0 !--- This command specifies that the TCP !--- connection with the specified external !--- peer should be established using the !--- address on the loopback interface. ! ip route 2.2.2.2 255.255.255.255 10.10.10.2 !--- This static route ensures that the !--- remote peer address used for peering !--- is reachable. !-- Output suppressed. end | Current configuration: !-- Output suppressed. interface Loopback0 ip address 2.2.2.2 255.255.255.255 ! interface Serial0 ip address 10.10.10.2 255.255.255.0 ! router bgp 300 neighbor 1.1.1.1 remote-as 300 neighbor 1.1.1.1 update-source Loopback0 ! ip route 1.1.1.1 255.255.255.255 10.10.10.1 !-- Output suppressed. end |
eBGP Configuration with a Loopback Address
You can also configure eBGP using a loopback address (or any other operational interface) as shown in this section. Loopback interfaces are used in this manner to guarantee reachability in networks with multiple paths as shown in the Load Sharing Using the Loopback Address as a BGP Neighborsection of Load Sharing with BGP in Single and Multihomed Environments: Sample Configurations.
R1-AGS | R6-2500 |
---|---|
Current configuration: !-- Output suppressed. interface Loopback0 ip address 1.1.1.1 255.255.255.255 ! interface Serial1 ip address 10.10.10.1 255.255.255.0 ! router bgp 300 neighbor 2.2.2.2 remote-as 400 neighbor 2.2.2.2 ebgp-multihop 2 !--- This command changes the ttl value in !--- order to allow the packet to reach the !--- external BGP peer which is not directly !--- connected or is using an interface other !--- than the directly connected interface. neighbor 2.2.2.2 update-source Loopback0 !--- This command specifies that the TCP !--- connection with the external BGP !--- peer should be established using the !--- address on the loopback interface. ! ip route 2.2.2.2 255.255.255.255 10.10.10.2 !--- This static route ensures that the !--- remote peer address used for peering !--- is reachable. !-- Output suppressed. end | Current configuration: !-- Output suppressed. interface Loopback0 ip address 2.2.2.2 255.255.255.255 ! interface Serial0 ip address 10.10.10.2 255.255.255.0 ! router bgp 400 neighbor 1.1.1.1 remote-as 300 neighbor 1.1.1.1 ebgp-multihop 2 neighbor 1.1.1.1 update-source Loopback0 ! ip route 1.1.1.1 255.255.255.255 10.10.10.1 !-- Output suppressed. end |
Verify
These sections provide information you can use to confirm your configurations are working properly. Certain show commands are supported by theOutput Interpreter Tool , which allows you to view an analysis of show command output.
Verify iBGP Configuration
Use the show ip bgp neighbors (registered customers only) command to display information about the TCP and Border Gateway Protocol (BGP) connections and verify if the BGP peer is established. The output of the show ip bgp neighbors command below shows the BGP state as 'Established', which indicates that the BGP peer relationship has been established successfully.
R1-AGS# show ip bgp neighbors | include BGP BGP neighbor is 10.10.10.2, remote AS 400, internal link BGP version 4, remote router ID 2.2.2.2 BGP state = Established, up for 00:04:20 BGP table version 1, neighbor version 1 R1-AGS#
The show ip bgp neighbors command has been used above with the modifier | include BGP. This makes the output more readable by filtering the the command output and displaying the relevant parts only.
In addition, the show ip bgp summary (registered customers only) command can also be used to display the status of all BGP connections, as shown below.
R1-AGS(9)# show ip bgp summary BGP router identifier 10.1.1.2, local AS number 400 BGP table version is 1, main routing table version 1 Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 10.10.10.2 4 400 3 3 1 0 0 00:00:26 0
Verify eBGP Configuration
Use the show ip bgp neighbors (registered customers only) command to display information about the TCP and Border Gateway Protocol (BGP) connections and verify if the BGP peer is established. The output of the show ip bgp neighbors command below shows the BGP state as 'Established', which indicates that the BGP peer relationship has been established successfully.
R1-AGS# show ip bgp neighbors | include BGP BGP neighbor is 10.10.10.2, remote AS 400, external link BGP version 4, remote router ID 2.2.2.2 BGP state = Established, up for 00:00:17 BGP table version 1, neighbor version 1
In addition, the show ip bgp summary (registered customers only) command can also be used to display the status of all BGP connections, as shown below.
R1-AGS(9)# show ip bgp summary BGP router identifier 10.10.10.1, local AS number 300 BGP table version is 1, main routing table version 1 Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 10.10.10.2 4 400 3 3 1 0 0 00:00:26 0
Verify iBGP Configuration with a Loopback Address
Use the show ip bgp neighbors (registered customers only) command to display information about the TCP and Border Gateway Protocol (BGP) connections and verify if the BGP peer is established. The output of the show ip bgp neighbors command below shows the BGP state as 'Established', which indicates that the BGP peer relationship has been established successfully.
R1-AGS# show ip bgp neighbors | include BGP BGP neighbor is 2.2.2.2, remote AS 300, internal link BGP version 4, remote router ID 2.2.2.2 BGP state = Established, up for 00:00:28 BGP table version 1, neighbor version 1 R1-AGS#
In addition, the show ip bgp summary (registered customers only) command can also be used to display the status of all BGP connections, as shown below.
R1-AGS(9)# show ip bgp summary BGP table version is 1, main routing table version 1 Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 2.2.2.2 4 400 3 3 1 0 0 00:00:26 0
Verify eBGP Configuration with a Loopback Address
Use the show ip bgp neighbors (registered customers only) command to display information about the TCP and Border Gateway Protocol (BGP) connections and verify if the BGP peer is established. The output of the show ip bgp neighbors command below shows the BGP state as 'Established', which indicates that the BGP peer relationship has been established successfully.
R1-AGS# show ip bgp neighbors | include BGP BGP neighbor is 2.2.2.2, remote AS 400, external link BGP version 4, remote router ID 2.2.2.2 BGP state = Established, up for 00:00:16 BGP table version 1, neighbor version 1 External BGP neighbor may be up to 2 hops away.
In addition, the show ip bgp summary (registered customers only) command can also be used to display the status of all BGP connections, as shown below.
R1-AGS(9)# show ip bgp summary BGP router identifier 1.1.1.1, local AS number 300 BGP table version is 1, main routing table version 1 Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 2.2.2.2 4 400 3 3 1 0 0 00:00:26 0
Troubleshoot
Refer to Why Do BGP Neighbors Toggle Between Idle, Connect, and Active States? and Troubleshooting BGP for troubleshooting information.