External Gateway Protocol: BGP (Border Gateway Protocol)
BGP: the protocol for exchanging route information between as routers of different self-made systems.
The Internal Gateway Protocol rip or OSPF is used to send a datagram to the target site from the source site as much as possible in an. However, the external gateway protocol uses different BGP environments. This is mainly due to the following two reasons:
(1) the large scale of the Internet makes routing between as very difficult.
(2) related policies must be taken into account when selecting routes between.
As a result of the above situation, the Border Gateway Protocol can only find a good route to the destination network, rather than finding the best route.
BGP adopts the route vector routing protocol instead of the Distance Vector Routing Protocol or the link status routing protocol.
The administrator of each self-made system as selects at least one router as the spokesperson for the AS, known as the "BGP spokesman". Generally, the border router is selected as the "BGP spokesman ", of course, you can also choose not a VBR.
When a BGP spokesman needs other as BGP spokespersons to exchange routes, a TCP connection (Port Number 179) needs to be established first, and then BGP packets are exchanged through this connection for BGP sessions, such as adding a route, and revoking outdated routes.
Note that each BGP spokesman must run the Internal Gateway Protocol (rip or OSPF) in addition to the BGP protocol ).
The BGP spokesman for the self-made system as2 will notify the AS1 spokesman for the backbone network: "The networks N1, N2, N3, N4 can pass through as2 ", after receiving the BGP packet, the backbone network sends a notice to the adjacent bgp spokesman: "The networks arriving at N1, N2, N3, and N4 can pass through (AS1, As2 )".
We can see from the above that the number of nodes for BGP protocol routing information exchange is proportional to the number of self-made systems, and is no longer proportional to the number of networks.
BGP-4 has four types of packets:
(1) Open message: it is used to establish a relationship with the adjacent BGP spokesman to initialize the communication.
(2) UPDATE message: used to notify the information of a route and list multiple routes to be revoked.
(3) keepalive packets are used to periodically verify the accessibility of neighboring routers.
(4) notification message: used to send detected errors.
What is the format of BGP packets? Let's take a look...
The four types of packets contain the same header, which consists of 19 bytes. It contains three fields: Tag, length, and type.
Mark, which occupies 16 bytes. It is used to identify BGP packets. If it is not applicable, this field is set to '1 '.
The length of the entire BGP packet, including the BGP header. The minimum length is 19 bytes (that is, the header length ).
Type, which occupies one byte. The value range is 1-4. It corresponds to four types of BGP packets.
The following describes the composition of the four types of packets.
(1) Open message: contains 6 fields, the version number (1 byte), and the self-made system number (2 bytes, the globally unique 16-bit self-made system number allocated by ICANN. The retention time (in seconds) and the BGP identifier (in 4 bytes, the IP address of the BGP spokesman. optional parameter length (1 byte) and optional parameter length.
(2) UPDATE message: contains five fields, the length of the unfeasible route (occupies 2 bytes, indicating the length of the next field), and the Undo route (list all the routes to be UNDO ), total path attribute length (2 bytes used to indicate the length of the next field), path attribute (defined the attribute of the path added in this message) and network-layer accessibility information (defines the network that sends the message, including the number of digits of the network prefix, IP address prefix ).
(3) keepalive message: contains only 19 bytes of the general header.
(4) notification message: contains three fields: Error Code (1 byte), error subcode (1 byte), and error data.
The following describes how these four types of packets work.
Assume that two BGP spokespersons belonging to different self-made systems as need to exchange route information, so we need to discuss the process here, because the peer BGP spokesman may not want to perform route switching because the router load is too heavy. First, a BGP spokesman sends an open packet to the adjacent BGP spokesman. If the adjacent BGP spokesman accepts the packet, a keepalive message is returned, so that the connection between the two is established.
Once the connection is established, the connection relationship needs to be maintained. Therefore, the BGP spokesman must periodically send keepalive packets to ensure that the adjacent relationship exists. Generally, it is sent once every 30 seconds.
If you want to send route update information, you need to send an update message. Note that this message can cancel multiple route information at a time, only one route information can be added for each packet.
So far, I have a rough idea about the basic situation of the external Gateway Protocol BGP (Border Gateway Protocol.