External BGP

Condition for eBGP neighborship formation.

1)The router's ASN must be same as the ASN mentioned in the neighbor router's configuration command which is "neighbor remote-as [ASN]".

2) The BGP router ID's of the two routers should be different.

3)There must be a TCP connection between the two routers and the IP address used in the BGP "neighbor remote-as" command should match will the local router's IP address.

4) If authentication is configured then it should pass the authentication.



Update Source selection


When "neighbor 172.16.1.2 " command is configured on R1, R1 sends BGP messages for this neighbor inside packets with destination IP address 172.16.1.2.

R1 checks the routing table for the route for the destination 172.16.1.2

As per the routing table to reach the destination 172.16.1.2 the outgoing interface is S1/0

And the IP address for the interface s1/0 on R1 is 172.16.1.1. So R1 uses 172.16.1.1 as the source IP address for this BGP peer.


Redundancy between EBGP neighborship



When two layer 3 paths are available between two eBGP neighbors and is we use the interface IP address in the neighbor command, then the neighborship is lost if that link fails.

There are two solutions for this.

1) Using two neighbor commands.

2)Using loopback interface in the neighbor command.

Using loopback interface is the preferred solution. Since we are using loopback interface in the neighbor command, even if one of the link fail the router will use the other link.


To make the BGP use the loopback interface as the source, we have to configure BGP as mentioned below.

1)We have to use "neighbor x.x.x.x update-source [loopback ip address]" 

2) We have to make the neighbor command on the router to refer to the loopback address of the other router.

3) We have to use the "neighbor x.x.x.x ebgp-multihop [hops] command.


Example:




eBGP Multihop



By default, the TTL field value in the IP header  is 1  when the packet is being sent to eBGP neighbor.

So when using loopback interface, the neighborships fails with this default TTL value.Since the TTL=1 and when the packet arrives at the neighbor,the neighbor discards it.So we have to use the command "neighbor ebgp-multihop 2" when using loopback interface .


BGP neighbor states



Idle:The BGP process has not yet begin but is waiting to start the process.

Connect: The BGP process is waiting for the TCP connection to be completed.

Active: The BGP process is completed but no BGP messages were sent till now.

Opensent: The BGP open message has been sent and waiting for the matching reply from the other router.

Openconfirm: The BGP Open message has been sent and received. Now BGP process is waiting for the keepalive message.

Established: All neighbor parameters match, the neighborship formation is success and they can exchange update messages.


Types of BGP messages


Open: This message is used to form the neighborship in the initial stages.

Keepalive: This message is used to maintain the neighborship and to check the neighbor is up or down.If this message is not received from the neighbor for a certian period of time then the BGP router will consider the neighbor as down.

Update: This message is used to exchange the path attributes and related prefix/lenths(NLRI) that use those attributes.

Notification: This message is used in case of any BGP errors.