The packet and state machine of BGP protocol analysis

Source: Internet
Author: User
Tags integer socket port number

BGP is a dynamic routing Discovery protocol between autonomous systems, and its basic function is to automatically exchange loop-free routing information between autonomous systems. As with OSPF and RIP protocols that operate within autonomous zones, BGP is a class of EGP (Edge Gateway Protocol) protocol, while OSPF and protocol.

BGP was developed on the basis of the application of EGP. In the past, EGP has been used as a routing discovery protocol among autonomous regions and has been widely applied to backbone networks such as nfsnet. However, EGP is plagued by routing loop problems. BGP constructs the topology map of autonomous region by increasing the properties of the Autonomous Region (as) path in the routing information, thereby eliminating routing loops and implementing user-configured policies. At the same time, with the rapid development of Internet, the volume of routing table is increasing rapidly, and the exchange of routing information between autonomous regions is more and more large, which affects the performance of the network. BGP supports no type of interregional routing CIDR (classless interdomain Routing), which can effectively reduce the increasing routing table.

The BGP runtime is connected (using a socket) with the BGP partners outside the autonomous region and in the area respectively. Connections to partners in the region are called IBGP (Internal BGP) connections, and connections to BGP partners outside the autonomous region are called EBGP (External BGP) connections. The local BGP protocol uses different mechanisms for IBGP and EBGP partners.

1, the level of BGP protocol position

BGP uses the socket service to establish a connection with a port number of 179.

2. BGP message structure

BGP has 4 kinds of messages. respectively, Open,update,keepalive and notify. They have the same message header.

⑴ Message Header structure:

Marker: (16 bytes) authentication information

Length: (2 bytes) message lengths

Type: (1 bytes) Types of messages

0:open

1:update

2:notification

3:keepalive

⑵open Message structure:

The message header is structured as follows:

Version: (1 bytes) The originator of the BGP edition number

My autonomous System: (2-byte unsigned integer) local as number

Hold Time: (2-byte unsigned integer) originator recommended retention times

BGP Identifier: (4 bytes) Router identifier of the originator

Optparmlen: (1 bytes) The length of an optional parameter

Optional Parameters: (variable length) optional parameters

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.