Forming BGP Neighbors



Two BGP routers become neighbors once they establish a TCP connection between each other. The TCP connection is essential in order for the two peer routers to start exchanging routing updates.

Once the TCP connection is up, the routers send open messages in order to exchange values such as the AS number, the BGP version they're running, the BGP router ID and the keepalive hold time. After these values are confirmed and accepted the neighbor connection is established. Any state other than "established" is an indication that the two routers didn't become neighbors, and BGP updates won't be exchanged.

Use this neighbor command to establish a TCP connection:

neighbor ip−address remote−as number

The remote−as number is the AS number of the router we're trying to connect to using BGP.

The ip−address is the next hop directly−connected address for eBGP and any IP address on the other router for iBGP.

It's essential that the two IP addresses used in the neighbor command of the peer routers be able to reach one another. One sure way to verify reachability is an extended ping between the two IP addresses. The extended ping forces the pinging router to use as source the IP address specified in the neighbor command rather than the IP address of the interface the packet is going out from.

It is important to reset the neighbor connection in case any BGP configuration changes are made in order for the new parameters to take effect.

clear ip bgp address (where address is the neighbor address)
clear ip bgp * (clear all neighbor connections)

By default, BGP sessions begin using BGP version 4 and negotiating downward to earlier versions if necessary. To prevent negotiations and force the BGP version used to communicate with a neighbor, perform the following task in router configuration mode:

neighbor {ip address|peer−group−name} version value

An example of the neighbor command configuration follows:



RTA#
router bgp 100
neighbor 129.213.1.1 remote−as 200
RTB#
router bgp 200
neighbor 129.213.1.2 remote−as 100
neighbor 175.220.1.2 remote−as 200
RTC#
router bgp 200
neighbor 175.220.212.1 remote−as 200

In the above example RTA and RTB are running eBGP. RTB and RTC are running iBGP. The difference
between eBGP and iBGP is manifested by having the remote−as number pointing to either an external or an
internal AS.

Also, the eBGP peers are directly connected while the iBGP peers are not. iBGP routers don't have to be directly connected, as long as there is some IGP running that allows the two neighbors to reach one another.

The following is an example of the information that the show ip bgp neighbors command displays. Pay special attention to the BGP state, since anything other than state "established" indicates the peers aren't up. You should also note the BGP version is 4, the remote router ID (highest IP address on the router or the highest loopback interface in case it exists) and the table version (this is the state of the table, any time new information comes in, the table increases the version and a version that keeps incrementing indicates that some route is flapping causing routes to continuously be updated).

#show ip bgp neighbors
BGP neighbor is 129.213.1.1, remote AS 200, external link
BGP version 4, remote router ID 175.220.12.1
BGP state = Established, table version = 3, up for 0:10:59
Last read 0:00:29, hold time is 180, keepalive interval is 60 seconds
Minimum time between advertisement runs is 30 seconds
Received 2828 messages, 0 notifications, 0 in queue
Sent 2826 messages, 0 notifications, 0 in queue
Connections established 11; dropped 10