Border Gateway Protocol (BGP) is an Internet routing Protocol. BGP itself is not too complex, but those first involved in this field may be unfamiliar with this concept hidden behind Autonomous System routing. We hope that you can use this article to briefly understand the working principle of BGP and the problems it produces and can solve.
Through the last lecture on Internet routing, you should realize that routes in the Internet are divided into two parts: internal routes of autonomous systems controlled by the Internal Gateway Protocol (IGP), such as OSPF, and the border routing that connects Autonomous Systems (AS) is now using BGP ).
Each ISP on the Internet has at least one unique AS number, and broadcasts its network information to its peer-to-peer through BGP. BGP is a track vector protocol, because it broadcasts the path information required to reach a specific destination. BGP does not tell us how data packets are transmitted in the autonomous region or the entire network as OSPF does. BGP can also be called a distance vector protocol, because it is similar to distance vector protocol except for a few minor changes.
BGP itself is a layer-4 protocol that runs over TCP. Because BGP does not need to care about what TCP needs to handle, it is much simpler than OSPF. In any case, BGP is connection-oriented. It requires two peer-to-peer interconnection partners who manually configure the vro, and the two partners configure their own vrouters respectively, and then exchange route information. Through BGP peer-to-peer interconnection, the two ends (neighbors) are usually directly connected. However, some masochistic users prefer to establish BGP sessions between multi-hop peer-to-peer interconnection partners, which is no problem at all, because BGP uses TCP port 179 and does not rely on broadcast or local link multi-point transmission.
The BGP-4 (BGP-3 does not support classless Inter-Domain Routing CIDR) update package contains the following information: a network, a subnet, and some properties. We make routing decisions based on the attribute values (mainly AS-Path). For example, bgp update data packets may say: "I can access a network with numbers 8, 19, 2000, and 5 AS 1.1.1.0/12." The most important thing about BGP is that AS-Path itself uses a mechanism to prevent product routing loops, and the router does not import any routes already included in the AS-Path attribute.
For a vro, if you want to import a route and then tell it to a partner in the peer-to-peer relationship, you must before declaring this route, first, append your AS number to this AS-Path. Undoubtedly, AS the information of this route is spread more and more away from the source AS, it provides a feasible "path" to the source ". Generally (rather than always), the router selects the shortest path from. BGP only knows these paths based on the update information it receives. Unlike RIP, which is the same as distance vector protocol, BGP does not publish the entire route table. At the time of guidance, your peer-to-peer networking partner will hand over the entire route table, but after that everything will depend on the update information received.
Route update information is stored in the routing information library (RIB. The route table stores only one route for each destination, while RIB usually contains multiple paths to the same destination. Which route is stored in the routing table, that is, the path actually used depends on the router. When a route is withdrawn, you can retrieve another route entry from RIB to the same destination. RIB is only used to record the routes we may use. We will never inform peer-to-peer peers of an unused route because it may be an error message. We will only publish the routes in the routing table. If RIB receives information about a route that has been revoked and the route is only available in RIB, we do not need to send update information to peer-to-peer partners, instead, you only need to quietly delete it from RIB. The route entry of RIB will never expire, and it will be retained until we confirm that the route is invalid.
A large number of routes on the Internet are based on policies. Sometimes you purchase an expensive link that is used only when necessary, or you have a link that only sends data to a specific object. The "Community" attribute of BGP is often used to identify a group of routes. If you want your neighbors to know the secret information about a route, you can set a Community number before exporting these routes. These numbers are completely random, therefore, no matter what you send, you must negotiate with your partners in advance to determine the special significance of this number.
Another important attribute of BGP is the Multi-Exit Discriminator (MED ). This attribute is used to inform remote AS that we like a specified exit point, although we may have many exit points, which is very important to iBGP. IBGP is the internal network protocol version of the BGP protocol. We will introduce it in the next lecture.
To really understand the working principles of BGP, we need to spend some time talking about the problems that plague the Internet. This is very important.
First, we will encounter a big problem about the rapid growth of Route tables. If someone decides to break down an original 16-bit network into many smaller networks, they may broadcast hundreds of new routes first. At this time, each vro on the Internet will obtain each new route. People are often under pressure to summarize or merge multiple routes for publishing at a time. However, summarized routing is not always feasible. In particular, you want to divide a 19-bit network into 20-bit networks separated from two geographical locations. At present, the number of routes in the route table is nearly 200,000, and it once increased exponentially.
Second, we always worry that someone will "broadcast to the Internet ". If a large ISP suddenly decides to broadcast all its information and the ISP receives these routes, all data on the Internet will be sent to the small AS of the ISP. There is a simple solution called routing filtering. Vrouters are easy to set, so that your vro will not receive any route that you are not asking for, but many large ISPs will still receive "default" routes from peer-to-peer interconnection partners, however, these partners do not seem to be able to provide path interconnection services.
Finally, let's talk about flapping ). BGP has a mechanism to restrict abnormal routes. Tumble (or disappear) routes are generally not reliable enough. If the route is frequently replayed, the load on all the routes on the Internet will increase, because each time a route disappears and appears again, it takes time to update it. Causes the BGP peer-to-peer router to ignore all updates from the active peer-to-peer router. The ignore time of this vro increases exponentially with each flip. It is annoying to have link defects. Many Internet sites may take more than an hour to access, but this is necessary.
This time, we have briefly explained the principles of BGP. This knowledge is sufficient for you to correctly understand the protocol, but it is not comprehensive enough. If your job is to operate a BGP router, take some time to read the RFC documentation. Your equivalent interconnection partner will be very grateful to you.
Summary
BGP is a Path vector protocol that provides routing information of autonomous systems through its AS-Path attribute on the Internet.
Peer-to-Peer interconnection partners exchange route information by manually configuring routers, which establishes a TCP connection and uses the BGP protocol for conversation. BGP has no secrets.
Medium-sized enterprises usually adopt BGP to make their entire network a real multi-host network.
Network basics lecture 16: Internet routing and peer-to-peer networking
Network basics lecture 15: Advanced OSPF Routing Protocol
Network basics Lecture 14: OSPF routing protocol preliminary
Network basics lecture 13: routing information protocol (RIP)
Network basics lecture 12: Basic knowledge of routing protocols
Lecture 11 on basic network knowledge: Internet management architecture
Lecture 10 on basic network knowledge: TCP protocol understanding (advanced tutorial)
Lecture 9 on basic network knowledge: a preliminary understanding of the TCP protocol
Lecture 8 on basic network knowledge: a preliminary understanding of the IP protocol
Lecture 7: understanding and using ICMP protocol
Lecture 6 on basic network knowledge: Implementing subnets, including IPv6)
Lecture 5: Learning Spanning Tree Protocol
Lecture 4: understanding the data link layer
Network basics Lecture 3: Understanding OSI network layering
Network basics Lecture 2: Understanding subnet and CIDR
One of the basic network knowledge lectures: understanding the meaning of IPv4 addresses