Contents

Introduction

Prerequisites

Requirements

Components Used

Conventions

Background Information

Configure

Network Diagram

iBGP Configuration

eBGP Configuration

iBGP Configuration with a Loopback Address

eBGP Configuration with a Loopback Address

Verify

Verify iBGP Configuration

Verify eBGP Configuration

Verify iBGP Configuration with a Loopback Address

Verify eBGP Configuration with a Loopback Address

Troubleshoot

Related Information

Introduction

This document describes how to configure iBGP and eBGP with or without a loopback address.

Prerequisites

Requirements

Cisco recommends that you have knowledge of this topics:

- BGP protocols

Components Used

This document is not restricted to specific software and hardware versions.

The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, ensure that you understand the potential impact of any command.

Conventions

For more information on document conventions, refer to Cisco Technical Tips Conventions.

Background Information

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 the 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 with the IP address of the interface closest to the peer router. However, when theneighbor update-source command is used, any operational interface, which includes the loopback interface, can be specified to establish TCP connections. This method of peering with a loopback interface is useful since it cannot bring down the BGP session when there are multiple paths between the BGP peers. This would otherwise tear down the BGP session if the physical interface used to establish 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 to establish neighbor relationship.

Configure

This section contains the next 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. Only registered Cisco users can access internal Cisco information and tools.

Network Diagram

This document uses this network setup:

iBGP Configuration

In this configuration, both routers are inAS 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 inAS 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 eBGP is used. If they are not directly connected, the neighbor ebgp-multihop  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 previous configuration, 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 with 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 10.1.1.1 255.255.255.255

!

interface Serial1

ip address 10.10.10.1 255.255.255.0

!

router bgp 300

neighbor 10.2.2.2 remote-as 300

neighbor 10.2.2.2 update-source Loopback0

!--- This command specifies that the TCP

!--- connection with the specified external

!--- peer should be established with the

!--- address on the loopback interface.

!

ip route 10.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 10.2.2.2 255.255.255.255

!

interface Serial0

ip address 10.10.10.2 255.255.255.0

!

router bgp 300

neighbor 10.1.1.1 remote-as 300

neighbor 10.1.1.1 update-source Loopback0

!

ip route 10.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 with 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 Load Sharing that Uses the Loopback Address as a BGP Neighbor.

R1-AGS

R6-2500

Current configuration:

!-- Output suppressed.

interface Loopback0

ip address 10.1.1.1 255.255.255.255

!

interface Serial1

ip address 10.10.10.1 255.255.255.0

!

router bgp 300

neighbor 10.2.2.2 remote-as 400

neighbor 10.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 with an interface other

!--- than the directly connected interface.

neighbor 10.2.2.2 update-source Loopback0

!--- This command specifies that the TCP

!--- connection with the external BGP

!--- peer should be established with the

!--- address on the loopback interface.

ip route 10.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 10.2.2.2 255.255.255.255

!

interface Serial0

ip address 10.10.10.2 255.255.255.0

!

router bgp 400

neighbor 10.1.1.1 remote-as 300

neighbor 10.1.1.1 ebgp-multihop 2

neighbor 10.1.1.1 update-source Loopback0

!

ip route 10.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 work 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  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 next 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 10.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 previously with the modifier| include BGP. This makes the command output more readable and displays the relevant parts only.

In addition, the  show ip bgp summary   command can also be used to display the status of all BGP connections, as shown next.

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 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 next 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 10.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 command can also be used to display the status of all BGP connections, as shown next.

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  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 next 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.2.2.2,  remote AS 300, internal link

BGP version 4, remote router ID 10.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 command can also be used to display the status of all BGP connections, as shown next.

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

10.2.2.2         4   400       3       3        1    0    0 00:00:26        0

Verify eBGP Configuration with a Loopback Address

R1-AGS#show ip bgp neighbors | include BGP

BGP neighbor is 10.2.2.2,  remote AS 400, external link

BGP version 4, remote router ID 10.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 command can also be used to display the status of all BGP connections, as shown next.

R1-AGS(9)#show ip bgp summary

BGP router identifier 10.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

10.2.2.2         4   400       3       3        1    0    0 00:00:26        0

Troubleshoot

Refer toWhy Do BGP Neighbors Toggle Between Idle, Connect, and Active StatesandTroubleshoot Common BGP Issuesfor more information.

Related Information

- IP Routing Support

- Understand Load Share with BGP in Single and Multihomed Environments

- Cisco Technical Support & Downloads