BGP Messages

 BGP uses different types of messages to form neighbor-ship and exchange routes, checking if the remote BGP neighbor is still there and/or notifying the remote side if any errors occur.

In-order to do this, BGP uses 4 types of messages:

  • Open message
  • Update message
  • Notification message
  • Keepalive message
Let's consider the below topology and see this in action:

Open Message:

  • BGP protocol is based on TCP. Once the TCP 3-way handshake is completed, they will attempt to establish a session. This will be done with the help of Open messages.
  • BGP will negotiate with its neighbor to form in Open message to form a neighbor-ship
  • Negotiation will occur based on AS number, neighbor IP, router ID, BGP version, Hold-down timer,..
R1 BGP Configuration:

R1(config)#router bgp 1
R1(config-router)#neighbor 192.168.12.2 remote-as 2
R1(config-router)#

R2 BGP Configuration:

R2(config)#router bgp 2
R2(config-router)#neighbor 192.168.12.1 remote-as 1
R2(config-router)#

As per above configuration I have configured the neighbor in both the routers. Now, once the negotiation is completed, they will form neighbor-ship. Below is the snap of Wireshark Open message from R1 to R2.

  • Open messages type is 1.
  • BGP version is 4
  • Hold down timer (Default) = 180
  • BGP identifier (BGP Router ID) = 1.1.1.1

Update message:

  • Once the router become neighbors, they can start exchanging routes. This is done with the update message.
  • The prefix that are advertised/removed will be updated in the Update message.
  • In BGP, prefix that are advertised is referred in the NLRI (Network Layer Reachability Information) and the prefix that are removed will be shown as Withdrawn routes.
  • Now, I am going to advertise the 1.1.1.1/32 in R1 router.
    • R1(config-router)#network 1.1.1.1 mask 255.255.255.255
You can see from the above screenshot,
  • BGP message type is 2 (Update message)
  • NLRI information is added with the prefix 1.1.1.1/32
  • Withdrawn routes length is 0, because no routes are removed.
Now, going to shut the loopback 0 interface in R1.

R1(config)#interface loopback 0
R1(config-if)#sh
R1(config-if)#shutdown
R1(config-if)#

After shutting the interface, update message was sent mentioning 1.1.1.1/32 route was withdrawn. Wireshark screenshot is as below

From the above screenshot, 
  • BGP message type is 2 (Update message)
  • Withdrawn routes length is set as 5
  • loopback 0 interface (1.1.1.1/32) was added in the withdrawn routes.

Notification Message:

  • When the BGP peer is down , it will be notified with the possible reason.
  • Now, I am going to remove the AS_2 from R2 router and  create a new AS as AS_22 in R2. Lets see what happens,
R2(config)#no router bgp 2
R2(config)#
R2(config)#router bgp 22
R2(config-router)#bgp log-neighbor-changes
R2(config-router)# network 2.2.2.2 mask 255.255.255.255
R2(config-router)# neighbor 192.168.12.1 remote-as 1
R2(config-router)#

Now, we can see that the notification message will be sent.
From the above screenshot,
  • BGP message type is 3 (Notification message)
  • Major error code: Open message Error (2) 
  • Minor error code: Open message -- Bad Peer AS (2) [ As the issue is due to AS number mismatch, AS number negotiation will be handled by Open message]
  • Bad Peer AS: 22 [ Bad AS error occurred by the AS number 22]

Keepalive Message:

  • Keepalive message will be sent for every 60 seconds to check whether the peer is still alive or not.
  • 3 keepalive message will be sent (3 * 60) = 180 seconds. If no response received after 3 keepalive message, peer will be inactive.
  • From the below screenshot, BGP message type is 4 (Keepalive message)
That's it about BGP Messages.

You can also look into the video tutorial explained in tamil:


Post a Comment