How can I flexibly use 'BGP' that supports the heart of the Internet?
Many people have seen the words 'IP address' and 'provider' when using the Internet. The Internet uses a large number of protocols such as
CoreBGP-Plugging in to BGP | Jordan Whited
BGP is a type of routing protocol that determines the destination of communication, and typical routing protocols include RIP and OSPF in addition to BGP. Since BGP is a protocol used in the center of the Internet, it is likely to be affected by misconfigurations. The failure that occurred in Cloudflare in July 2020 was also due to a BGP misconfiguration.
Cloudflare impacts large-scale failures that bring down 50% of the network, large sites such as Discord and Feedly-GIGAZINE
Routing protocols are roughly classified into a distance vector type in which the distance and direction to the destination are exchanged between adjacent routers, and a link state type in which all routers hold a route diagram of the entire network, and BGP is classified into a distance vector type. Protocol to be used. To be precise, path vector type route control, which is an extension of the distance vector type, is performed.
A router that operates BGP is called a 'BGP speaker', and BGP speakers can establish a 'BGP peer' and exchange route information to control the destination of communication automatically. BGP speakers interact with other BGP speakers via the following four messages.
-OPEN: A message sent to establish a BGP peer after establishing a TCP connection with an adjacent router (BGP neighbor).
-UPDATE: A message containing route information. Sent when the settings of the BGP speaker are changed.
-KEEPALIVE: Message to confirm whether communication with the BGP neighbor is possible.
-NOTIFICATION: A message reporting an error.
In addition, the establishment of BGP peers has the following six stages.
-Idle: A state in which BGP is set and nothing is done yet.
-Connect: Waiting for the establishment of a TCP connection with a BGP neighbor.
-Active: A state in which an attempt is being made to establish a TCP connection.
-OpenSent: Waiting for an OPEN message from a BGP neighbor. After receiving, if there is no problem, send KEEPALIVE message, and if there is a problem, send NOTIFICATION message.
-OpenConfirm: Waiting for KEEPALIVED or NOTIFICATION message from the BGP neighbor. If there is a problem receiving the KEEPALIVED message or if you receive the NOTIFICATION message, return to the Idle state.
-Established: A state in which a BGP peer is established and UPDATE messages can be sent and received.
In order to solve these problems, the paper '
Whited points out that the approach in The Case for Pluginized Routing Protocols is 'stimulating', but focuses only on receiving messages. Therefore, Whited developed the BGP library 'CoreBGP' that can be used in the entire application that supports BGP. CoreBGP is written in Go and has functions such as sending and verifying OPEN messages, processing received UPDATE messages, and sending UPDATE messages.
GitHub-jwhited/corebgp: CoreBGP is a BGP library written in Go that implements the BGP FSM with an event-driven, pluggable model.
CoreBGP will serve as the basis for a full-fledged BGP daemon, or simply as logging UPDATE messages. Code examples are
The concrete implementation of CoreBGP is as follows. 'Get Capabilities' that acquires information such as OPEN messages in the Connect state and...
'On Established' to exchange UPDATE messages in the Established state
You can use 'OnClose' that occurs when the state of the BGP piano is no longer Established.
Sample code using CoreBGP is also available, and you can process BGP messages by specifying the IP address, AS number, etc.
in Software, Posted by log1n_yi