当前位置:网站首页>Hcip day 11 (BGP agreement)

Hcip day 11 (BGP agreement)

2022-07-05 22:51:00 Enron tears

Catalog

1、BGP agreement ( Border gateway protocol )

IGP and EGP Characteristics

2、BGP Data packets of

1、OPEN package : Build a neighborhood

2、keeplive package

3、Updata package ( Update package )

4、Notification package

5、Route-refresh package

3、BGP State machine

IDLE state ( Idle state )

connect state

OPENsent state

OPENConfirm state

Established state

4、BGP Working process of


1、BGP agreement ( Border gateway protocol )

Internal gateway protocol (IGP), example RIP、OSPF.

External gateway protocol (EGP), example BGP.

Autonomous systems (AS), A series of managed by a single institution or organization IP A collection of networks and devices .

Divide AS The reason of autonomous system :

1、 The network range is too large , The agreement runs over .

2、 Autonomous Management .

    In order to facilitate the management of autonomous systems , We have designed one for each autonomous system AS Number . The AS The number one is made up of 16 Bit binary structure , Its value range is 1 - 65535,0 and 65535 Cannot be used for reservation , The usable range is 1 - 65534, And among them 64512 - 65534 Is set private AS Number , The rest is public AS Number .

    Because of the traditional AS The number is not enough , So at present, most devices support expanded AS Number , By 32 Is binary .

BGP The agreement is now in IPV4 In the environment BGPV4, At present, there are also BGPV4+( stay BGPV4 On the basis of , Multiple address families can be supported )

AS Re publishing can be used to obtain routing information from each other , However, there are problems with republishing as a solution :

1、 Poor route selection ( Republishing will wash away the cost value when importing routes ).

2、ASBR The question of belonging to .

BGP agreement --- Classless path vector protocol

No category : The subnet mask is carried when transmitting routing information .

Path vector :1、 The distance in the distance vector refers to that the protocol takes a router as a hop to calculate the cost value . The path vector is represented by a AS To convey information as a unit .2、 The distribution of distance vector protocol is divided according to the algorithm , however BGP There is no concept of algorithm in the protocol , because BGP The protocol does not need to calculate the route , Just pass the existing to your neighbors .

IGP and EGP Characteristics

IGP: Lu Jia Xuan , Fast convergence , Less occupied resources .

EGP: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 , Easier strategy , To make up for the lack of re release . In order to ensure the controllability of routing transmission , More convenient to interfere with route selection ,BGP The protocol discards the cost value , Instead, he designed many path attributes for routing information . You can select the route through the attribute , Make the routing process more flexible , More controllable .

2、 reliability :BGP In order to ensure the reliability of transmission , Direct selection TCP As the protocol of the transport layer, the protocol completes the sending and receiving of data , It uses TCP Of 179 Port no. .

Use TCP The problem with protocol communication is :

Transmission efficiency is reduced , Only unicast communication can be realized (TCP Need to establish a session ), Taking up resources will increase the use TCP After the agreement , You can't automatically discover neighbors for communication through broadcast or multicast .

BGP agreement :

BGP The protocol can realize non direct connection and neighbor building , The premise of non direct connection is that the network of both neighbors can reach ,BGP Indirect neighbor building is based on IGP On the basis of .

According to the establishment of neighborhood relationship , take BGP There are two kinds of neighbor relationships :

AS Between :EBGP peers , If the two routers that establish the peer are located in different locations AS in , Then their relationship is called EBGP Peer relationship .

AS Inside :IBGP peers , If the two routers establishing the peer are located in the same AS in , Then the relationship of items is called IBGP Peer relationship .

because EBGP Peers generally adopt the method of direct connection to build neighbors , So will EBGP In packets between peers TTL Value is set to 1, and IBGP Peers often need indirect connection to build neighbors , therefore IBGP In packets between peers TTL Value is set to 255. If EBGP Non direct neighbor building is required between peers , You need to modify it manually TTL value .

2、BGP Data packets of

OSPF Medium hello package : Cycle discovery , Building and keeping neighborhoods alive .

The task of discovering neighbors : stay BGP Manually specify the neighbor relationship to replace

The task of building neighbors : stay BGP Zhongyou OPEN Message to bear

The task of keeping neighbors alive : stay BGP Zhongyou Keeplive Message to bear

1、OPEN package : Build a neighborhood

AS Number : The number of neighbors declared when manually establishing a neighbor relationship AS Number . After receiving it, the opposite end will check whether it is consistent with the local AS No , If you are consistent, you will establish a normal neighbor relationship .

authentication :BGP You can also do authentication when building neighbors , You need to compare the authentication passwords of both parties , Inconsistencies make it impossible to establish neighborhoods .

Router-ID: Mainly distinguish and calibrate routers /OPEN The message carries RID The purpose of is to ensure that both sides RID atypism , Make sure it's unique , If you are the same, you can't establish a neighbor relationship .

RID Also by 32 Bit binary structure , And follow IP Format of address . There are two ways to get , Manual configuration and automatic acquisition .

Be careful : When receiving neighbor packets , The source IP The address must be the same as that of the manually specified neighbor IP Only when the address is known can we establish a normal neighbor relationship .( This address will be used as the source address for subsequent updates )

OPEN The message will also carry the keep alive time when establishing the neighbor relationship (hold time) This parameter , The default value of this parameter is 180S, namely 180S If you can't receive the message sent by the other party keeplive perhaps UPdate The package will determine BGP Link broken .--- This value is carried when both sides build neighbors , But it doesn't have to be the same . however , The execution must be the same , therefore , The smaller of the two will be selected as the execution time .

OPEN The message will also carry the relevant parameters of whether it supports the route refresh function

belt , Both parties negotiate , If all support , You can turn on the route refresh function .

2、keeplive package

Just complete the cycle maintenance ( Keep alive TCP conversation ), You don't need to carry too many parameters , It doesn't have too many functions .

keeplive The sending cycle of the message is the keeping alive time 1/3, The live time is... By default 180S, The default sending time of the cycle is 60S.keeplive The package has another function : After receiving it, the other party sends it to OPEN After the message , Act as a confirmation package temporarily .(TCP It has its own confirmation mechanism , It can ensure the reliability of transmission , The confirmation here is mainly to confirm OPEN Parameters carried in the message , If you agree with the other party's parameters , Will reply Keeplive Package to confirm .)

3、Updata package ( Update package )

Update packets that carry routing information , Including the target network segment and subnet mask information, as well as BGP Properties of .

stay UPdate There is an undo route field in the packet , We can directly route unreachable routes

The information is placed under this field for announcement , To achieve the purpose of transmitting failure information . Instead of

Need to look like RIP In that way, the transmission mode with poison is adopted .

4、Notification package

yes BGP An alarm mechanism designed , When BGP When an error is detected , It will alarm this high , Tell the opposite end where the error point is .

5、Route-refresh package

It is used to request the peer to resend the routing information after changing the routing policy .( In advance, both peers support route refresh )

3、BGP State machine

BGP Description of the state machine BGP State changes during peer establishment . because BGP The establishment of neighbor relationship and the release of routing can be completed separately .

IDLE state ( Idle state )

Just started BGP after , First in IDLE state , Then manually specify the neighbor relationship .

After manually specifying the neighbors ,BGP The inspection step will be started , It needs to confirm the specified IP Whether the address can be reached in the local routing table , If it can reach , Then I began to try in my resume TCP conversation , Go to the next state , If you can't reach , Will stay in IDLE state .

 

connect state

The status is TCP The status of the session connection . If TCP Session connection established successfully , entering OPENsent state , If TCP Session establishment failed , entering Active state , Try repeatedly to re-establish the session connection .

Be careful : stay TCP Session connection , Both sides will try to establish a connection , One side is successful , A two-way TCP Session channel . If both sides succeed , Then two two-way channels will appear , You will need to close one TCP passageway . Start sending later OPEN message , It will carry RID, The two sides will compare RID, Keep only RID Initiated by the big end TCP Connect ,RID Initiated by the small end TCP The connection channel will be disconnected .

 

OPENsent state

Start sending in this state OPEN message , The message carries the parameters required to establish the neighbor relationship . When received from the opposite end OPEN After the message , Will check the parameters inside . If the parameters are OK , Will reply with a keeplive As a confirmation , Go to the next state .

 

OPENConfirm state

namely OPEN Confirm the status , The opposite end receives the... From the local end OPEN After the message , Confirm that the parameters are correct and send keeplive Package to confirm . At this time, on behalf of both parties OPEN The parameters in the package are confirmed , And enter the next state .

 

Established state

This status indicates the establishment completion status , Marks the establishment of peer relationship .

As can be seen from the flow chart ,TCP If the connection fails, you will enter ACTIVE state , Try reconnecting , If the reconnection timeout, give up the reconnection , Judge the failure of neighbor relationship establishment , go back to IDLE state . In the whole process , Problems in any link , Will send Notification Package error reporting , Then return the status to IDLE state .

 

4、BGP Working process of

(1) be based on IGP( static state 、 Direct connection ) Realization IP Can be up to ;

(2) Specify neighbor relationship , Neighborhoods need to be established TCP Session channel .BGP All packets sent later are sent through TCP Session channel send , To ensure the reliability of its transmission ;

(3) Use OPEN Message and keeplive The message establishes the neighbor relationship , Generate neighbor table ;

(4) Use Updata Message sharing routing information , The information carries the target network segment number , Mask information and various attributes , Record all routing information collected and sent in one table , namely BGP surface .

(5) after , take BGP The optimal path in the table is loaded into the routing table .( Multiple routing messages may be received when reaching the same target network segment ,BGP Load only one ( There is no load balancing ) The best path , The optimal path is selected by attributes )

(6) After convergence , Will use keeplive The package is kept alive periodically , The default live time is 180S, The cycle sending time is 60S.

(7) If an error message appears , Will use notification Send an alarm message .( This error message may appear when the peer is established , It may also appear after .)

(8) If there is a result mutation , Will be sent directly UP Hit him 、 The message is updated .

 

原网站

版权声明
本文为[Enron tears]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140355092048.html