BGP (Border Gateway Protocol) uses a TCP (Transmission Control Protocol) connection between routers to exchange route update messages, also known as BGP update messages. When a router learns a new or modified route from a neighbor, it constructs a BGP update message that contains the route attributes and sends it to its neighboring routers over the TCP connection.
BGP update messages contain the following information:
1. Network Layer Reachability Information (NLRI) – the destination network prefix and subnet mask.
1. Path Attributes – the attributes that describe the characteristics of the route, such as the origin, AS path, next-hop, and metrics.
When a router receives a BGP update message, it first checks the NLRI to determine whether the destination network is within its own routing domain. If the destination network is within the router’s own domain, the router compares the received path attributes with its own stored path attributes for that destination network. If the received path attributes are better than its own stored path attributes, the router updates its routing table with the new path attributes.
If the destination network is not within the router’s own domain, it forwards the BGP update message to other neighboring routers. The update message is forwarded only to those routers that have expressed an interest in receiving updates for that particular destination network or prefix.
BGP uses various mechanisms to prevent loops and ensure that the best path is chosen and propagated throughout the network. These mechanisms include route filtering, route aggregation, route damping, and path selection policies.
In summary, BGP handles route update messages by exchanging them over a TCP connection between routers and using path selection policies to choose the best route and propagate it throughout the network while avoiding loops and ensuring stability.