当前位置:网站首页>Hcip day 10 (initial BGP border gateway protocol)
Hcip day 10 (initial BGP border gateway protocol)
2022-07-24 03:04:00 【Oranges love oranges】
List of articles
One 、BGP---- Border gateway protocol
AS— Autonomous systems — A series managed by a single institution or organization IP A collection of networks and their devices .
1、 The network range is too large , The agreement can't run , It needs to be divided :
2、 Autonomous Management
In order to distinguish and calibrate different AS, We have designed a number for each autonomous system -----AS Number -----16 Bit binary -----0 65535; among 0 and 65535 For reserved value , no need , therefore AS The real value range of No. is 1-65534; We will 64512-65534AS Known as private AS Number .----- Because of the traditional AS The number is not enough , So there is also an expanded version AS Number -----32 A composition ----- At present, the vast majority of devices also support the expanded version AS Number
EGP There was an agreement before the agreement —EGP, But because of its limited function , Later, it was optimized and improved on its basis , Generated BGP agreement , at present AS The most widely used agreement between is BGP agreement .
In the present IPV4 In the environment , Most widely used GBP The version is BGPV4. At present, there are already BGPV4+*.BGP4+ Also called MP-BGP— It can support the application of various address families .
In the absence of BGP In the case of an agreement , Only use republishing Technology , It can also be realized AS Sharing of routing information between . however , The reason why this scheme is not adopted , The reasons are as follows :
1、 There are defects in republishing — In multi-point republishing , Because of the seed measurement problem , It will inevitably lead to poor road selection
2、ASBR The ownership of the equipment .
BGP The way of transmitting routing information by yourself must be the same as RIP similar , By passing the routing entry information . The reason why topology information is not used , Mainly because :
1、 Topology information resources occupy a large amount , and BGP The quantity to be delivered is huge .
2、 Passing topology information will expose this AS Internal topology connection .
BGP----- No category (// Tape mask ) Path vector protocol
Distance vector ---- In Distance Vector Protocol , Distance is the embodiment of cost , Take the hops as the evaluation standard of the cost value , Consider a router as a unit to calculate the distance .
Distance vector is the concept of algorithm , because IGP The protocol itself needs to calculate the routing information of the unknown network segment by algorithm .
Path vector --- Will a AS As a whole
The path vector does not involve the algorithm , because BGP Only the calculated routing information is sent to others AS In , It is equivalent to only delivering the ready-made route without calculation .(// The porter of the route )
IGP— Lu Jia Xuan , Fast convergence , Less occupied resources
BGP The focus of the agreement
1、 Controllability —AS A lot of routing information needs to be transmitted between , The so-called controllable , It is more convenient to interfere with the route selection , It is easier to make routing strategies .
To ensure controllability ,BGP The cost value is discarded , In its place BGP When giving each route information , Added many path attributes . after , Sure Use these attributes to select the route . Because of the existence of many attributes , It will make our route selection more flexible and convenient , bring BGP The protocol has powerful maneuverability .
because BGP A lot of routing information needs to be transmitted , therefore , Its There can be no periodic update mechanism .BGP Only trigger updates exist .
2、 reliability ---- It is necessary to ensure the reliability of data transmission .BGP In order to ensure the reliability of transmission , Its transport layer protocol is directly selected TCP agreement , Use TCP Of 179 Port No .
IGP The agreement does not choose to use TCP Why :
1、TCP Low transmission efficiency
2、TCP Transmission takes a lot of resources
3、TCP The protocol can only realize unicast , therefore , Cannot send via multicast or broadcast ,
Lead to IGP The protocol cannot automatically discover neighbors , Can only be specified manually .
because BGP The choice is TCP agreement , therefore ,BGP You need to establish a neighbor relationship manually
BGP Because the transport layer uses TCP agreement , therefore , As long as TCP The protocol can be completed on the basis of normal session establishment BGP Building neighbors .----BGP Support non direct connection and neighbor building ( Prerequisite — The network can reach )----BGP The indirect neighbor building of is established in IGP( static state ) above .
stay BGP in , We will Neighbor relationship is called peer relationship .
EBGP Peer relationship —— If the two routers that establish the peer are located in different locations AS in , Then their relationship is called EBGP Peer relationship .
IBGP Peer relationship ---- If the two routers that establish the peer are located in different locations AS in , Then their relationship is called IBGP Peer relationship .
because ,EBGP Peers generally use direct connection to build neighbors , therefore ,EBGP In packets sent between peers TTL We set the value to 1.---- If you encounter EBGP Non direct connection and neighbor building are required between peers , You need to modify it manually TTL value .IBGP Peer relationship is AS The interior is generally non direct connection and neighbor building , therefore ,TTL Value is set to 255.
3、AS-BY-AS------ stay BGP among , We will AS As a whole .
stay BGP Load balancing is not supported in ,BGP If there are multiple paths to the target network segment ,BGP An optimal path will be selected and loaded into the routing table according to the path attribute , Without load balancing .
Two 、BGP Data packets of
BGP The transmission reliability of all data packets in the protocol is TCP Agreement to guarantee . all BGP Packets are based on TCP The established session channel is sent .
OSPF Of hello package ----- It can be found periodically , Building and keeping neighborhoods alive .
stay BGP in , The process of discovering neighbor relationships becomes manually specified , Mainly because TCP The protocol needs to establish a session channel , Then the data packets will be sent based on the channel .
open package :
establish BGP Peer relationship ( neighbor )--- The establishment of neighbor relationship cannot be the process of parameter negotiation ,
BGP Building neighborhoods requires OPEN Package to carry parameters , Compare and negotiate .`
AS Number :
When creating a neighbor relationship, you need to specify the location of the neighbor AS Number , This parameter will be carried in open Send to the other party in the message ,
The other side will compare this AS Number and local AS Whether the numbers are consistent , If the same , Then you can establish a normal neighbor relationship .
authentication —BGP Jianlin can also do authentication , After authentication, you will carry the authentication password , Both sides of the authentication password need to compare , If you are consistent, you can establish a normal neighborhood relationship .
ROUTE-ID:
Distinguish and calibrate routers , Also by 32 Bit binary structure , according to IP Address format .
1、 Manual configuration ;
2、 Automatic access to ( First, check whether the device has a loopback interface , If it exists, it will select loopback interface IP The biggest address is RID;
If there is no loopback interface , Select... In the physical interface IP The biggest address is RID.
RID Will be in open Carry... In your bag , After sending to the opposite end , The opposite end will detect this RID, If with local RID Different , Will be able to establish normal neighborhood relations .
It is specified to build a neighbor when manually establishing a neighbor relationship IP The address must match the received open The source in the bag IP Only when the address is the same can the neighbor relationship be established normally , otherwise , Neighbor relationship establishment failed .
holdtime-:
Time to live --- The default time is 180S, During the life guarantee period ,
If you don't receive the message sent by the other party Keeplive Packages or update package ,
Will disconnect BGP Neighborhood . This parameter is in open The message will be carried ,
however , Inconsistency between the two sides will not affect the establishment of neighbor relations ,
But in execution , This time must be consistent , The smaller of the two parties will be used .
Whether the router supports the refresh function will also become open A negotiation parameter carried in the message .
Keeplive package :
Life cycle ---- Cycle sending time = Keep alive 3/1, Default keep alive time 180s,
The default cycle sending time is 60s.
Besides keeping alive ,Keeplive The bag will also be open When the message negotiates parameters Temporarily act as confirmation package The role of .
TCP The purpose of confirmation is to ensure the reliability of data transmission , and Keeplive The purpose of message confirmation is to confirm and recognize the message sent by the other party open Parameters in the message .
update package :
Update package --- A packet that carries the routing information that needs to be passed .
Represents a route entry information , The parameters that need to be carried are mainly the target network number and subnet mask information , And path attributes .
In update package , There is an undo route entry field , The routing entries under this field will need to be deleted at the opposite end , It no longer needs to be expressed by means of toxic transmission .
notification package :
BGP An alarm mechanism designed in (// When the establishment fails , There will be an alarm ).
route-refresh package :
It is used to change the routing policy and request the peer to resend the routing information .( The premise is that both parties support the route refresh function )
3、 ... and 、BGP State machine
BGP The state machine of describes BGP Changes in state during peer establishment , because BGP This protocol can separate the neighbor establishment process from the routing sending and receiving process .
BGP State machine ----6 Kind of

IDLE--- Idle state --- The router starts BGP After the process , Will first be in idle state , When you manually specify the neighborhood ,BGP Will enter into a check link , Check the specified IP Whether the address is reachable in the local routing table , If it can reach , Will enter the next state .------connect
connect---- Connection status , This status is complete TCP The establishment of conversation .
After the session is established, enter opensent state , send out open message .
If it is not established successfully, enter active state , Try to rebuild TCP conversation .
In establishment TCP During conversation , Because both parties will actively initiate the process of establishing a session , And the final establishment is a two-way conversation , therefore , Finally, you only need to save a session channel , Select the method through the following open In the message RID Compare , Choose to keep RID Large devices initiate TCP conversation .
opensent---- Send local open message . Received from the opposite end open message , Check the parameters , after , If you confirm that the parameters are correct , Will reply Keeplive Message as acknowledgement .
openconfim---open Message confirmation status ---- The opposite end also receives a message sent locally open message , Then confirm according to the parameters inside , If confirmed, it will send Keeplive message . This paragraph received from the other party Keeplive After the message, it will enter the next state .
established---- Build state ---- Mark the BGP Establishment of peer relationship .

Four 、BGP Working process of
1、 be based on IGP Protocol implementation IP Can be up to
2、 Specify neighbor relationship , By three handshakes , establish TCP Session channel , After all BGP All packets will be based on TCP Session channel for delivery .
3、 Use open Message and Keeplive The message establishes the neighbor relationship . Then collect the neighbors into a table --- Neighborhood watch .
4、 adopt update Message transmission routing information . The routing entry information transmitted mainly includes the target network number , Mask information , And various path attributes . after , The device will record all the routing information sent and received by itself in a table ----BGP surface
5、 After the BGP The optimal path in the table is loaded into the routing table . The optimal path is selected by attributes .
6、 After convergence ,BGP Will be used periodically Keeplive Keep the message alive . The live time is... By default 180s, The default sending time of the cycle is 1/3, namely 60s.
7、 If an error message appears , Will use notification Send an alarm message .
8、 If there is a structural mutation , Will use update Trigger and update the message .
5、 ... and 、BGP The routing black hole of
because BGP The agreement supports indirect connection and neighbor building , Therefore, there may be BGP Protocol spanning is not running BGP The router of the protocol leads to BGP After routing , The control level can reach , But at the data level , After not running BGP The router of the protocol cannot pass , Form a routing black hole .
resolvent :
ways1、 stay R3 Admiral BGP The routing information of the protocol is republished to IGP among
ways2、 Directly in R4 Up operation BGP agreement
ways3、MPLS
To avoid routing black holes ,BGP Put forward Synchronization mechanism --------- That is, when a router from its own IBGP The peer learns a BGP When routing , He will not be able to tell himself EBGP peers , Unless he comes back from IGP We learned this route from the protocol .
6、 ... and 、BGP My guard ring
1、BGP The anti ring mechanism used ---- Horizontal segmentation mechanism
2、EBGP The horizontal division of ---- A special application in EBGP Between peers , Used to solve EBGP Possible loop problems between peers .
BGP The protocol will record the route in the routing entry AS Number
AS_PATH : Record AS A property of the path ( This attribute can be completed in addition to EBGP Outside the horizontal division of , It can also be used as the basis for choosing the road ), You can also choose the way .
The received BGP In the routing entry , Among them AS_PATH Properties of the , If there is a local AS Number , Then refuse to accept .

// When AS1 Send the network segment information to AS2, Routing information leaves AS1 At the moment of its AS_PATH Properties will +1, When the routing information leaves AS2 when , Will be in it AS_PATH with 21, When the routing information leaves AS3 when , Will be in it AS_PATH with 321, Back again AS1 when , Its discovery AS_PATH There's another one in it 1 , With your own AS_PATH Compare , that AS1 There will be no repeated forwarding .
AS_PATH------ Routing function

// When AS1 arrive AS3 when , Will experience AS1---->AS2----->AS3 This road , Its AS_PATH by 21, And the other way AS1---->AS3 Of AS_PATH The value of is 1 , that AS1 Preference will be given AS_PATH The path with the smallest value 2.
3、IBGP The horizontal division of ---- A special application in IBGP Between peers , Used to solve IBGP Possible loop problems between peers .
IBGP Horizontal segmentation ----- When a route from a IBGP Learn something from the peer BGP When routing , He will not be able to notify others in this route IBGP Peer relationship .(// namely R2 In learning R1 Information about , Send to R4, however R4 Cannot send to R3, This avoids the generation of loops )
because IBGP Horizontal segmentation limits , Lead to IBGP The routing information between peers can only pass one hop , In this case , May cause communication obstacles , Solution :
ways1、 Build a company IBGP Peer relationship
shortcoming : 1、 Building a whole neighborhood will lead to an increase in resource consumption ;
2、 It may reduce the scalability of the network .
ways2: Routing reflectors
ways3: The federal
边栏推荐
- Take you into the world of MySQL mvcc
- Unity 消息推送
- go log包
- SSM's technical forum includes front and back offices
- Microsoft win11/10 package manager Winget will support the installation of applications from zip files
- summernote富文本编辑器
- [hdlbits questions] Verilog language (2) vectors
- Unity message push
- To forge ahead on a new journey, the city chain science and technology carnival was grandly held in Xiamen
- 攻防世界WEB练习区(view_source、get_post、robots)
猜你喜欢

MySQL sub database and sub table and its smooth expansion scheme
![[management / upgrade] * 02. View the upgrade path * FortiGate firewall](/img/c7/da6db46d372e7462cd14852b662d6d.png)
[management / upgrade] * 02. View the upgrade path * FortiGate firewall

Ugui source code analysis - iclippable

Open source embedded sig in the openeuler community. Let's talk about its multi OS hybrid deployment framework

String.split()最详细源码解读及注意事项

攻防世界WEB练习区(weak_auth、simple_php、xff_referer)

Ugui source code analysis - imaskable

SSM家庭理财个人理财管理系统记账系统

Babylon.js cool canvas background animation JS special effects

Lcd1602——斌哥51
随机推荐
Do securities companies really have principal guaranteed financial products?
攻防世界WEB练习区(view_source、get_post、robots)
[management / upgrade] * 02. View the upgrade path * FortiGate firewall
CMT registration - Google Scholar ID, semantic scholar ID, and DBLP ID
kettle
Is it safe for qiniu to open an account? Is the Commission of 30000 reliable?
Symbol类型
Babylon.js cool canvas background animation JS special effects
openEuler 资源利用率提升之道 01:概论
Binary tree traversal
Unscramble the category and application principle of robot vision
Attack and defense world web practice area (webshell, command_execution, simple_js)
X Actual combat - Cloud Server
Hcip --- BGP comprehensive experiment
Daily gossip (I)
Summernote supports custom video upload function
(6) Decorator extension [email protected] Principle of use
Super complete PMP reference document summary
go errors
go strconv