BGP Messages.

All BGP messages are sent over a TCP connection and every message type uses the same fixed-size header. BGP speaking routers have five types of messages at their disposal. These message types are the following:

This is the first BGP message that is send after the establishment of a TCP connection. It is send by both sides. The Open message contains information about the sender. This information contains the senders autonomous system, a proposed value for the Hold Timer, the senders optional parameters and more. If an Open message is determined to be acceptable, a Keepalive message is returned to the sender

The BGP Update message is used to transport all routing information. The Update message is used to advertise as well as withdraw routes. An Update message can include multiple routes. The BGP Update message carries information about the Path attributes as well as the NLRI (Network Layer Reachability Information).

BGP peers exchange Keepalive messages to ensure that the hold timer doesn’t expire.

A BGP speaking router will send a Notification message when it detects an error. After sending a Notification, the BGP speaking router will close the BGP session. RFC 4271 defines several error codes. A few examples are Open Message error, Hold Timer Expired, Update message error.

Refresh: RFC 2918 discusses the route refresh capability for BGP-4. Since TCP provides for reliable transmission, an Update is sent only once. Routes are not periodically readvertised. When BGP speaking routes advertise the Route Refresh capability, they enable their peer to send Route-Refresh Messages. The Route Refresh message is a way for a BGP speaking router to ask the neighbor to re-advertise its routes.