当前位置:网站首页>Detailed explanation of BGP message
Detailed explanation of BGP message
2022-07-02 06:10:00 【Hot pot means red pot】
BGP message
BGP Packet There is 5 Two types of messages , Different types of messages have the same header (header)
Message name | effect | The moment of emergence |
---|---|---|
Open( establish ) | Used to negotiate parameters (BGP edition 、AS Number )+ Build a neighborhood | BGP TCP The first message after successful establishment |
Update( to update ) | Update message exchange routing information , send out + revoke | BGP After the peer relationship is established, there is a route to send or when the route changes |
Notification( notice ) | Error message , Used to interrupt BGP Connect | When BGP When an error is found in the run |
Keepalive( Remain active ) | Identify neighbors + Maintaining neighbors ( Refresh TCP Connect , Not allow TCP Connection is broken ) | 1、BGP The router receives the message sent by the opposite end Keepalive message |
2、 The peer state is set to established , At the same time, the subsequent regular sending keeps the connection | ||
router-refresh( Route Refresh ) | It is used to request the peer to resend the routing information after changing the routing policy | |
Premise is bgp The router should support the route refresh function | When the routing policy changes |
BGP Specific application of message
- BGP Use TCP Establishing a connection , The local listening port is 179. and TCP Connection establishment is the same ,BGP The establishment of a connection also requires a series of dialogues and handshakes .TCP Announce its port and other parameters through handshake negotiation ,BGP The parameters of handshake negotiation are :BGP edition 、BGP Connection retention time 、 Local router ID (Router ID)、 Authorization information, etc . It's all in Open Carry in the message .
- BGP After the connection is established , If there is a route to send , Then send Update Message notification to the opposite end .Update When message publishing route , Also carry the route attribute of this route , To help the opposite end BGP The protocol chooses the best route . In the local BGP When the route changes , To pass the Update News to inform BGP peers .
- After a period of routing information exchange , Local BGP And the opposite end BGP There are no new route announcements , Tend to stable state . At this time, send regularly Keepalive Message to keep BGP Validity of connection . For local BGP, If within the holding time , We haven't received any messages from the opposite end BGP news , That's what I think BGP The connection has been broken , Will disconnect this BGP Connect , And delete all learned from this peer BGP route .
- When the local BGP When an error is found in the run ( Such as opposite end BGP The local version does not support 、 Local BGP Received an illegal structure Update News, etc. ), To send Notification The announcement BGP peers . Local BGP sign out BGP When the connection , Also send Notification message .
BGP Message header
Marker( Mark ):16Byte, This tag field is used to detect BGP Loss of synchronization between peers , And the message verification is carried out when the verification function is supported . If the message type is Open or Open The message does not contain a validation message , The flag field will be set to all 1, otherwise , The value of the flag field is obtained by some calculations ( As part of the validation process )
Length( length ):2Byte Unsigned integer , Specifies the full length of the message , Including the head ,BGP The total length of the message is 19~4096Byte Between . Whole BGP The length of the message ,Header+Message+Data.
Type( type ):1Byte, identification BGP The type of message , There are several message types .
1-Open;2-Update;3-Notification;4-Keeplive;5-Route-refresh
OPEN Message
Open news : yes TCP The first message sent after the connection is established , For building BGP Connections between peers . The peer received Open Message and successful negotiation , Will send Keepalive The message confirms and keeps the connection valid . After the confirmation , Peer to peer can Update、Notification、Keepalive and Route-refresh The exchange of messages .
Version( edition ):1Byte, identification BGP The version used by the peer of , The default version is BGP-4, If the neighbor is running an earlier version , Then it will refuse Version4 The news of , So the version of the router will be changed to Version3 And send another Open news , Until the neighbors on both sides reach an agreement .
My Autonomous System( Local autonomous system ):2Byte,BGP The router AS Number , It is used to decide BGP The conversation is EBGP still IBGP, Range from 165535( At present, there are also 4Byte Of AS Number , Range from 14294967295).
Hold Time( Retention time ):2Byte, The maximum holding time of mutual negotiation between peers , It's usually Keepalive The time of the 3 times , By default, the holding time is 180s. Hold time is a counter , from 0 Increase to this value , Waiting to receive Keeplive( every other 60s Send it once ) perhaps Update message , After receiving, the time will be cleared , If it is not received within the holding time, it is considered that the neighbor is invalid . If BGP The holding time of negotiation between peers is inconsistent , A shorter time will be taken as the holding time . The minimum can be 0, In this case BGP Connection is always considered UP, Peers will not send Keeplive Message to detect whether the neighbor is invalid .
BGP Identifier(BGP identification ):4Byte,BGP The router Router ID, With IP In the form of an address , Used to identify BGP Router . stay VRP5.30 In the system , If you don't pass the order router id To configure , Then choose according to the following rules : optimization Loopback The largest address in the interface address is used as Router ID, without Loopback The interface is configured IP Address , From the configuration IP Select the largest physical interface of the address IP Address as Router ID.
Opt Parm Len(Optional Parameters Length):1Byte, The length of the optional parameter . If 0 It means that there are no optional parameters in the message
Optional Parameters: Variable length fields , be used for BGP List of optional parameters used in neighbor session negotiation . Each parameter is a ( Parameter type , Parameter length , Parameter values ) A triple , This field is used to publish support for some optional functions , For example, multi protocol expansion function , Route refresh capability , Four bytes AS Number and other functions .
UPDATE Message
Update Messages are used in BGP Routing information is passed between peers . Multiple reachable route information can be announced to the corresponding peers , Or multiple unreachable route information is revoked .Update The message consists of the following five parts :
Withdrawn Routes Length( Undo route length ):(2 Byte unsigned integer ) Unreachable route length , Express Withdrawn Routes The data length of the field . If Withdrawn Routes Length The field value is 0, said Withdrawn Routes The field has no data , stay Update Messages will not be displayed .
Withdrawn Routes( Undo routing ):( Variable length ) Undo routing . This field includes a series of IP Address prefix information , With <length,prefix> In the form of , such as <19,198.18.160.0> It means a 198.18.160.0 255.255.224.0 Network of .
Path Attribute Length( Path property length ):(2 Byte unsigned integer ) Route attribute length , Express Path Attribute The data length of the field . If Path Attribute Values for 0, said Path Attribute The field has no data , stay Update Messages will not be displayed
Path Attributes( Path properties ):( Variable length field ) Path properties . Each path attribute is composed of variable length triples :<attribute type Attribute types ,attribute length Attribute length ,attribute value Property value >, by BGP Provide the shortest path selection , Check the routing loop and the information that determines the routing strategy , The attribute type is a 2Byte The length of , Include 1Byte Attribute tags for ,1Byte Attribute type code field of .
NOTIFICATION Message
Notification The message is mainly used when an error occurs or the peer connection is closed , This message carries various error codes ( Such as timer timeout ), And error subcode and error message .
Errorcode: Error subcode .1Byte length , Provides specific information about the type of error .
Data: Depends on different error codes and error subcodes , Used to identify the cause of the error . Is a variable length field , By Notification Used as the cause of diagnostic errors . notes :Data The length of the field can be determined by the following formula : The length of the message =21+Data length (Notification The minimum message length is 21 Bytes , One of them includes the message header .)
** Header error subcode :
a The connection is asynchronous
b Wrong message length
c Wrong message type
** Open Message error subcode :
a Unsupported version number
b The wrong peer AS Number
c FALSE BGP ID
d Unsupported optional parameters
eRFC1771 Is defined as authentication failure ,RFC4271 Li expressed opposition to this .
f Unacceptable holding time (Hold Time)
** Update Message error subcode :
a Malformed attribute list
b Unrecognized recognized attributes
c Lack of recognized attributes
d Attribute flag bit error
e Attribute length error
f invalid Origin attribute
gRFC1771 It's defined as AS Routing loops ,RFC4271 Li expressed opposition to this .
h Invalid next hop attribute
i Optional attribute error
j Invalid network field
k Deformed AS_Path
** Holding time timeout :0
State machine error :0
End :0
KEEPALIVE Message
- Keepalive The message is mainly used to confirm the operation status between peer routers and the availability of links .
- Keepalive The composition of the message only includes one BGP Data header .
- Keepalive The exchange frequency of messages between peers is limited to ensuring that the timer of the other party does not time out
- When a router establishes with its neighbors BGP After the connection , Will be with Keepalive-Interval The set time interval is periodically sent to the peer Keepalive message , Indicates whether the connection can still be maintained .
- By default , send out Keepalive The time interval of is 60 second ,Hold Time yes 180 second . Every time I receive Keepalive The message will reset Hold Time Timer , Within the time interval of sending the message , If BGP Sent Update news , Will inhibit Keepalive Sending of messages . If Hold Time Timer timeout , Think of peers Down fall .
REFRESH Message
The main fields are explained as follows :
AFI(Address Family Identifier): Address family identifier (2 byte ). such as IPv4,IPv6,VPNv4,VPNv6 etc. .
Res(Reserved Field): Reserved area (1 byte ), The sender should set it to 0, The receiving party should ignore the information in this area .
SAFI(Subsequent Address Family Identifier): Subaddress Family Identifier (8 byte ). such as , unicast , Multicast .
In all BGP Router enable Route-refresh In case of ability , If BGP The entry routing strategy of has changed , Local BGP The router will publish to the peer Route-refresh news , The peer receiving this message will resend its routing information to the local BGP Router . such , Without interruption BGP In case of connection , Yes BGP Dynamically refresh the routing table , And apply the new routing strategy .
Use refresh bgp peer_address import That is, the sending of the message can be triggered , After the peer receives the message , It will send Update message , Send a complete routing message .
If you use the command refresh bgp peer_address export, Will be sent directly on the router Update Complete routing information , There is no need for route refresh Message .
边栏推荐
- 492. Construction rectangle
- Reading classic literature -- Suma++
- Contest3147 - game 38 of 2021 Freshmen's personal training match_ A: chicken
- Stc8h8k series assembly and C51 actual combat - serial port sending menu interface to select different functions
- Replace Django database with MySQL (attributeerror: 'STR' object has no attribute 'decode')
- 格式校验js
- Ros2 --- lifecycle node summary
- 复杂 json数据 js前台解析 详细步骤《案例:一》
- Servlet web XML configuration details (3.0)
- The real definition of open source software
猜你喜欢
memcached安装
Eco express micro engine system has supported one click deployment to cloud hosting
深度学习分类网络--Network in Network
谷歌出海创业加速器报名倒计时 3 天,创业人闯关指南提前收藏!
在uni-app中引入uView
Eco express micro engine system has supported one click deployment to cloud hosting
Deep learning classification network -- Network in network
步骤详解 | 助您轻松提交 Google Play 数据安全表单
TI毫米波雷达学习(一)
【C语言】简单实现扫雷游戏
随机推荐
Contest3147 - game 38 of 2021 Freshmen's personal training match_ F: Polyhedral dice
492. Construction rectangle
Shenji Bailian 3.53-kruskal
Regular expression summary
Can't the dist packaged by vite be opened directly in the browser
Generic classes and parameterized classes of SystemVerilog
LeetCode 78. 子集
Replace Django database with MySQL (attributeerror: 'STR' object has no attribute 'decode')
STC8H8K系列汇编和C51实战——串口发送菜单界面选择不同功能
Summary of MySQL constraints
经典文献阅读之--Deformable DETR
Zhuanzhuanben - LAN construction - Notes
Brain and cognitive neuroscience matlab psychoolbox cognitive science experimental design - experimental design 4
Reading classic literature -- Suma++
Shenji Bailian 3.54-dichotomy of dyeing judgment
经典文献阅读之--SuMa++
Deep learning classification network -- Network in network
Verifying downloaded files using sha256 files
图片裁剪插件cropper.js
Lucene Basics