当前位置:网站首页>BGP summary
BGP summary
2022-06-10 00:46:00 【xnasda】
BGP: Border gateway routing protocol
Classless path vector EGP agreement ; Work in AS Between ;
AS— Autonomous systems standard AS Number 16 Bit binary 0-65535
Expand AS Number 32 Bit binary
Path vector ( One AS For a jump )— Distance vector ( One router is one hop )
https://www.cidr-report.org
BGP The protocol itself does not generate routing , Instead, it forwards the routing entries generated from other protocols in the local routing table ;
AS There are a lot of BGP Neighborhood , And BGP The protocol does not calculate the best path ; So in BGP In the protocol, the administrator needs to carry out policies to interfere with routing ;
IGP Agreement pursuit :1、 acyclic ( Lu Jia Xuan ) 2、 Fast convergence 3、 Less occupied resources
EGP The pursuit of agreement 1: Controllable ( Administrators can facilitate policy interference and routing )
2、 reliability (BGP Protocol devices need to interact with a large number of routing entries , However, periodic update cannot be selected to occupy link resources , Therefore, only trigger updates can be performed ; And BGP In order to save cost in the agreement working environment , There must be indirect connections, and it is necessary to establish neighbor relations — Unicast neighbors )— be based on TCP Work - Three handshakes, four disconnects 4 A reliable transmission mechanism – TCP Can only work based on unicast
unicast — need IP Can be up to — rely on IGP BGP Carried on IGP above
3、AS-BY-AS With a AS For a jump ;
Two 、BGP characteristic :
1) Classless path vector ----- Upgraded version of distance vector —AS–BY–AS
2) Use unicast updates to send all information ; be based on TCP 179 Port operation
3) Incremental updating – Trigger only aperiodic
4) Have rich attributes to replace IGP Route selection based on measurement ---- Multiple parameter control protocol
5) You can implement a strong strategy for traffic in and out – Controllability
6) The default is not used for load balancing ----- Only one optimal path is generated through various routing rules
7)BGP Support authentication and aggregation ( Summary )
3、 ... and 、BGP Data packets be based on TCP Of 179 Port operation ; so BGP All data packets in the protocol need to be in tcp After the session is established , be based on TCP To ensure the transmission and reliability ;
First, through TCP Three handshakes to find a neighbor ;
Open Only responsible for the establishment of neighborhood relations , Normal receiving and sending can be done once ; carry route-id;
Keeplive Keep alive cycle 1min Query whether the neighbor relationship exists ; Actually keep alive TCP conversation ;hold time Default 3min
Update Carry routing entries Target network number + Various attributes
Notification Send and receive error data ;
Four 、BGP Working process of
1、 When the configuration is complete , Unicast between neighbors TCP Three handshakes , Target port 179, establish TCP Conversation ; After that all BGP Protocol packets are transmitted based on the session ;
After the session is established , Normal sending and receiving between neighbors once open Message establishment BGP The neighborhood of , Generate neighbor table ;
BGP Agreed open The message will carry the local RID— Generation method and OSPF Agreement ; Only local and all local neighbors need to be unique ;
After the neighbor relationship is established , The default for each 1min, Use keeplive Keep the neighborhood alive periodically ( Life cycle TCP conversation )
2、 After the neighbor relationship is established , The administrator can select the route entries obtained from any source in the local route table , towards BGP Declare in the agreement ; Use updata Packets are shared among neighbors ; Then generate BGP surface ;— Load all routing entries sent and received locally ;
The optimal path is loaded into the routing table by default ( The optimal - Just based on BGP Routing rules for , Not necessarily the best path ;BGP Load balancing is not supported by default )
3、 Convergence complete , only keeplive Keep the cycle alive ;
4、 If an error message appears , Neighbors will use Notification Message error reporting operation
5、 Structural mutation
1) newly added — Local use updata Inform all local neighbors , Provided that the route is not included by the issued aggregate route
2) To break off — Local use updata Inform all local neighbors , Provided that the route is not included by the issued aggregate route
Only all detailed routes contained in the aggregation entry are invalidated locally , Just tell neighbors to delete aggregation entries
3) Unable to communicate — hold time by 3min, continuity 3 I haven't received a neighbor's keeplive; Break the neighborhood 、TCP conversation , Delete all routes learned from the neighbor ;
5、 ... and 、 Noun
neighbor — Direct connection because BGP There is a demand for non direct neighbors in the protocol , so BGP Neighbors are called adjacency ;
EBGP Neighborhood ---- external BGP Neighborhood , The two adjacent equipment are in different positions AS in
IBGP Neighborhood ---- Inside BGP Neighborhood , The two adjacent devices are in the same AS in
6、 ... and 、BGP Routing black hole problem
The routing entry of non direct link neighbor building to the control level can be passed , Recursively calculate the route ;
The actual data level traffic is not running after BGP The router of the protocol cannot pass , In the end, there is no return
1、 Physics 、 Logical topology connection – Physical link direct connection 、 perhaps vpn
2、 Neighbors are connected – All devices in the network are running BGP
3、 BGP Republish to IGP(LAB)
4、 MPLS Multiprotocol label switching — The recommendation
7、 ... and 、BGP The anti ring mechanism of – Horizontal segmentation
1、EBGP Horizontal segmentation — solve EBGP The loop ;
Rely on BGP A property in the routing entry to prevent ring ;AS-PASH Path properties ;
BGP The protocol is in the process of transmitting routing entries , Will record all the AS The number of ;
EBGP Horizontal segmentation — In the received route entry , If there is a local AS No. will reject the entry into ;
2、IBGP Horizontal segmentation — solve IBGP The loop consists of a mechanism in
From a local IBGP Route entries learned from neighbors , Do not pass to other local IBGP neighbor ;
AS-BY-AS In a AS During the transfer of internal items , No properties will be modified by default ;
because BGP You can establish a neighbor relationship indirectly , So in a AS Inside , You can run with multiple computers BGP Protocol router establishment BGP Neighborhood , To stabilize the network ; So in a AS Internal operation BGP Agreed devices , Normal all exist EBGP neighbor ( Are connected to other devices at the same time AS)
stay IBGP Under the limitation of horizontal segmentation , Although avoid IBGP Loop generation of , But it also makes AS Internal in order to be able to pass routing entries , Must be established between two IBGP Neighborhood , Neighborhoods are rising exponentially , Huge amount of configuration ;
In the later stage, we can rely on the mechanism of breaking the horizontal segmentation to solve — The federal 、 Routing reflectors
8、 ... and 、 To configure
【1】 establish BGP Neighborhood
[r1]bgp 1 When starting, you need to define AS Number , There is no concept of multiple processes ; A device can only work in one AS Work in China
[r1-bgp]router-id 1.1.1.1 Recommended configuration RID;RID The generation rules of are the same as OSPF;
1、 Single chain EBGP Neighborhood
[r1-bgp]peer 12.1.1.2 as-number 2
Peer interface ip Address Where the opposite end is located AS Number
2、 establish IBGP Neighborhood ;– Due to a AS Most of the internal topology redundancy is rich , If you use a physical interface as a source 、 Objective IP Address establishment BGP neighbor , Will waste redundant resources ; It is recommended to use the loopback interface as the source / Objective ip Address ;
Stable / And multiple link resources can be used at the same time
Bear in mind : When using loopback address as source 、 Objective ip Address time ; And a loopback to define the target as the opposite end , You also need to change the source of this end to loopback , Otherwise, the local physical exit will be automatically used as the source ;
[r2-bgp]peer 3.3.3.3 connect-interface LoopBack 0
3、 Multilink EBGP Neighborhood
Loopback is recommended as the source 、 Target interface
1) IP Accessibility issues — Generally use static
[r4]ip route-static 5.5.5.0 24 45.1.1.2
[r4]ip route-static 5.5.5.0 24 54.1.1.2
2) establish EBGP Neighborhood
[r4]bgp 2
[r4-bgp]peer 5.5.5.5 as-number 3
[r4-bgp]peer 5.5.5.5 connect-interface LoopBack 0
3)TTL problem , Default IBGP Packets between neighbors TTL The value is 255,EBGP Between neighbors TTL The value is 1;
So if you use ring back to build EBGP Neighborhood ,TTL Not enough ; so , Must be modified
[r4-bgp]peer 5.5.5.5 ebgp-max-hop 2
After the configuration of both ends is completed , Between neighbors first TCP Three handshakes of , establish TCP Conversation ;
[r1]display tcp status
When TCP After the session is established , Send and receive between neighbors once open package ( carry RID), establish BGP The neighborhood of ; Generate neighbor table :
[r1]display bgp peer
BGP local router ID : 1.1.1.1
Local AS number : 1
Total number of peers : 1 Peers in established state : 1
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
12.1.1.2 4 2 5 6 0 00:03:22 Established 0
The number at the end of the table 0, Represents the number of routing entries learned from the neighbor ;
Nine 、 Announce routing
BGP The route declared by the protocol is the route information generated by any source in the local route table ;
At the announcement , The routing information in the local routing table can be selected one by one :
[r1]bgp 1
[r1-bgp]network 1.1.1.0 24
Bear in mind : At the announcement , The declared network number must be exactly the same as the record in the local routing table ;
When the configuration is declared complete , Locally generated BGP surface ;- Load and receive all locally BGP route
[r1]display bgp routing-table
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.0/24 0.0.0.0 0 0 i
state Target network number attribute
- You can use
good
Use i Identify the entry through local IBGP Neighbors learn
Only when an entry is available and excellent can it be transmitted to other local neighbors ; Can be loaded into the local routing table ;
Excellent conditions for entry :
1、 Synchronization problem — The current device synchronization rule is off by default , This problem doesn't need attention at present
Synchronization problem — Local must first notify IGP Learn the route , Through BGP Study
2、 Next hop unreachable problem — because AS-BY-AS The rules Make the next hop address in a AS Internal transfer , No modification by default ; Therefore, through local IBGP Routes learned by neighbors , Most of the next jump is not reachable
[r2]bgp 2
[r2-bgp]peer 3.3.3.3 next-hop-local R2 Route to 3.3.3.3 when , Change the next hop address to R2;
One 、 BGP The announcement problem :
If through BGP The routing entry delivered by the protocol is consistent with the entry target learned locally through other protocols , Will appear :
1、 This route acts as a link to other BGP The underlying route when neighbors establish neighbor relationship , So this one BGP Routing will not be optimal , Cannot pass or add table
2、 This route is not used to establish other routes BGP The routing of neighbors , No tables will be added locally , But it can convey , It belongs to excellent routing ;
example :R2 And R3 It's running OSPF, after R2 Learned R3 Of 32 Bit loopback host routing ;
Again R2 And R3 establish BGP The neighborhood of ; after R3 stay BGP The agreement declares 32 Bit loopback route , Then the entry arrives at R2 after , Will not be excellent ; --BGP Neighbor building routing and BGP The delivery routes of are the same ;
but R2 And R3 When building neighborhoods ,ospf take R3 Loop back to 32 Bit transfer , but BGP Use 24 Bit to pass the loopback route , So is equal to the BGP Build a neighborhood as 32 position ,bgp Pass it on to 24 position , Not the same route , Can be excellent , It can deliver , You can also add a watch ;
notes : The above problems will occur in Huawei equipment , but cisco Zhongruo bgp The delivery route has passed other routes in the local route table IGP Have , Will be marked as r-RIB Do not load — No tables are added locally , But it can convey ;
stay BGP When declared in the agreement , Is to declare any route in the local route table , Don't pay attention to how these items are generated ;
These routes will be carried by default cost It's worth it BGP In the routing entry of ; If the local will be declared locally BGP Route to local EBGP neighbor , Will carry these cost, Convenient for local EBGP The neighborhood AS Internal equipment routing , Of course, this route is entering other AS The measurement will not be modified ;
If it passes locally IBGP The neighbors learned BGP route , Superior and existing cost value , These routes are passed locally to the local EBGP Neighbor time , take cost Value return 0, Because these metrics are not locally generated ;
example :R2 And R1 by EBGP neighbor , that R2 Declare local passage OSPF Routing learned by the protocol 4.4.4.4/32 The measure is 2, Then this route is entering BGP The table carries the measure 2, Pass to R1,R1 Show this metric in the routing table , At the same time R1 Inside AS The time measurement does not change ;
In this topology R2 And R4 by IBGP neighbor , This article BGP Routing will also be R2 Pass to R4, but R4 Then pass the route to R4 Of EBGP Neighborhood R5 when , Reduce the measurement to 0; if R4 Also declare 4.4.4.4/32 This route , So pass it on to R5 Will carry R4 To the network segment cost value , Because only the local optimal route can be passed , Local claims are superior to those passed on by other neighbors BGP route ;
summary : There is EBGP Neighborhood ( Connect other AS) All of the BGP It is recommended that the equipment be declared internal AS The routing ;
Two 、 Reissue
BGP Protocol declared route , It is basically local IGP What we have learned as route ; A large number , If it is announced one by one , There is a large amount of configuration , But it is controllable ; You can also run at the same time BGP and igp The equipment , take IGP Agreement republished to BGP Agreement , To achieve batch route announcement effect ;
An announcement is equivalent to an article by article reissue , Republishing is equivalent to a batch of announcements ; Routing entries generated by both , Different origin properties , Other attributes are exactly the same by default ;
summary : There is EBGP Neighborhood ( Connect other AS) All of the BGP The equipment is recommended to be reissued IGP To BGP;
3、 ... and 、 Automatic summarization Default cisco And Huawei devices have turned off automatic summarization
Auto summary for BGP Pass normally network The route generated by the declaration has no effect ;
Only for from IGP Republish to BGP The routing entry of the has an impact ;— Route entries are sent in main class length , Do not carry cost value ;
[r1]bgp 1
[r1-bgp]summary automatic Turn on automatic summary , It is recommended to maintain the default off state
Four 、 Manual summary — polymerization
- Take advantage of BGP The characteristics of the announcement , Any route in the local routing table , Can be declared without paying attention to the source BGP in ;
There is no need to declare detailed routes one by one , First, manually static an empty interface anti ring route pointing to the summary network segment , Then announce it to BGP In the agreement ; from IGP The table declares that BGP Items in the agreement , Carry only the target network number and measurement value ;
The disadvantage of aggregation is to combine multiple network numbers into one , This results in accessing the entire aggregation network segment , Only unique paths exist ;
If under the premise of multi-path neighbor building , Will not be able to accurately choose the way ; Therefore, in large multi link networks, in order to better control routing , Must pass the aggregation entry at the same time , Then pass part of the detailed route at the best path ;
If you need to pass the aggregation entry at the same time , Pass part of the detailed route , Only after the declared empty interface route , Declare the required detailed routes one by one ;
The disadvantage of the above method is that the original detailed route cannot be carried cost value , Because it is declared that the static empty interface route is artificially added in the local route table ;
2) The standard BGP Route aggregation — First, manually announce the details one by one , Or republish routes in batches ;
Then perform aggregation configuration ; By default, an empty interface anti ring route is generated locally ;
[r2-bgp]aggregate 3.3.0.0 21 Aggregation and all detailed routes are sent
[r2-bgp]aggregate 3.3.0.0 21 detail-suppressed Suppress all detailed routes , Send only aggregate entries ;
The above operation method : If it is necessary to carry part of the detailed route while sending the aggregated items , Need to use policy
1、 Suppress list
[r2]ip ip-prefix ss permit 3.3.4.1 32
[r2]route-policy ss permit node 10
[r2-route-policy]if-match ip-prefix ss
[r2]bgp 2
[r2-bgp]aggregate 3.3.0.0 21 suppress-policy ss While passing aggregation entries , In inhibition 3.3.4.1/32 This is a detail , Other details are forwarded normally ;
2、 Use the routing strategy to directly manage the sending and receiving routes between neighbors
[r2]ip ip-prefix qq permit 3.3.3.3 32
[r2]route-policy qq deny node 10
[r2-route-policy]if-match ip-prefix qq
[r2-route-policy]q
[r2]route-policy qq permit node 20
[r2]bgp 2
[r2-bgp]aggregate 3.3.0.0 21
[r2-bgp]peer 12.1.1.1 route-policy qq export
3、 Directly use the prefix list to realize the function of the method
[r2]ip ip-prefix ww deny 3.3.3.3 32
[r2]ip ip-prefix ww permit 0.0.0.0 0 le 32
[r2]bgp 2
[r2-bgp]pe 12.1.1.1 ip-prefix ww export
5、 ... and 、 Conditional break IBGP Horizontal segmentation ;
IBGP Horizontal segmentation , Used to avoid being in a AS Internal by IBGP Loops between neighbors ;
The rules : From a iBGP Learned from neighbors BGP The route cannot be passed to the next IBGP neighbor ; because BGP Non direct link neighbor building capability , So you can AS Establish multiple neighbors internally to realize the role of connection relationship backup ; Therefore, a normal equipment only needs to operate bgp, Then it should be in AS The boundary of the , There is ebgp neighbor ;
All runs bgp The devices of the protocol will normally be transferred from other devices AS Learn the routing entry , Then share to the local AS, because IBGP Horizontal segmentation , Lead to local needs and all this AS Inside BGP Equipment setup IBGP Neighborhood ;
IBGP The number of neighborhoods has increased exponentially ;
The so-called conditional breaking means breaking IBGP When dividing horizontally , No loop can be generated ;–AS-BY-AS
1、 Routing reflectors – RR( Reflector )、 client 、 Non client ;
client 、 Non clients must be RR Of IBGP Neighborhood ; The three roles are built into a cluster ( Group );
There can be multiple devices in a cluster , But at least one cluster has one RR And a client ;
The rules :
1)RR From one EBGP Routes learned from neighbors can be shared with other local clients 、 Non client 、EBGP neighbor ;
2)RR Routes learned from a client's neighbor can be shared with other clients locally 、 Non client 、EBGP neighbor ;
3)RR Routes learned from a non client neighbor can be shared with other local clients 、EBGP; Cannot be shared with other non clients ;
notes : Reflected route , During reflection , Its properties do not change ; if RR The received entry is not good , It's not transitive , Will not be reflected ;
[r3-bgp]peer 2.2.2.2 reflect-client ibgp neighbor 2.2.2.2 Become a local client , At the same time, local become RR;
2、 The federal , Will be a big as Logic is multiple small as; Small AS Use private AS Number , Small AS Inter federal bepg Neighborhood , Can be like EBGP Same delivery route , But you can't modify the properties ; For non federal AS, Only big AS Number ;
1) All starts , Jianlin 、 Management is based on small AS No
2) All devices in the Federation need to declare their location AS Number
3) Small AS Between the ebgp Neighbors need to point to each other as Number
边栏推荐
- 二分查找(折半查找)总结
- Solution to the C language problem of the sum of two numbers
- IDC权威预测,中国制造业即将乘云而上
- OSPF实验
- Weights of complete binary tree of past real questions [10th] [provincial competition] [group B]
- Pta7-6 quietly follows
- Encryption, decryption and signature verification
- Enterprise worry free | apipost privatization deployment activity is about to start
- 试题 历届真题 完全二叉树的权值【第十届】【省赛】【B组】
- Pta7-5 Sina Weibo hot topics
猜你喜欢

ECA-Net: Efficient Channel Attention for Deep Convolutional Neural Networks

Rhcsa day 3
力扣 旋转字符串 C语言 题解

go配置文件管理-viper

WPS how to adjust the position of text after merging cells

Disorder of flinksql
Palindromes of past real questions of test questions date [11th session] [provincial competition] [group B]

On cookies and sessions -- including cases and detailed notes

If function selection when determining whether it is empty

IDC权威预测,中国制造业即将乘云而上
随机推荐
二分查找(折半查找)总结
MySQL scheduled task (event scheduler)
Apply the latest ad and Txk patches
flutter pub get failed (66; Could not find a file named “pubspec.yaml“
Niuke.com: median in data flow
wps合并单元格后怎么将文字的位置进行调整
OSPF实验
win10怎么删除账户
wps合并单元格内容都保留在一个单元格怎么实现
Solution to the C language problem of force deduction self divisor
MySQL execution plan
BGP实验
[vscode] the problem that the vscode SFTP plug-in cannot be used after upgrading to version 1.59
if判斷是否為空時的函數選擇
The cornerstone mvcc mechanism of repeatable read isolation level
js 逻辑空分配双问号语法 、双竖杠语法 与 可选链语法
冒泡排序及优化 清楚直观 C语言
[docker]mysql scheduled backup
OSPF第一次实验
IDC authority predicts that China's manufacturing industry will soon take advantage of the cloud