CloudEngine 16800 V200R024C10 Configuration Guide - IP Unicast Routing

BGP Message Format

BGP Message Format

A BGP message consists of a BGP header and a data portion. BGP runs through messages, which use the same header format. These messages are transmitted through TCP (port 179). The maximum length of a message is 4096 octets, and the minimum length is 19 octets (including only the message header). The header of each BGP message is 19 bytes, consisting of three fields.

Message Header Format

These types of BGP messages have the same header format, as shown in Figure 9-3.

Figure 9-3 Message header format
Table 9-1 Fields in a BGP message header

Field

Length

Description

Marker

16 octets

Indicates whether the information synchronized between BGP peers is complete. This field is used for calculation in BGP authentication. If no authentication is used, the field is set to all 1s in binary format or all Fs in hexadecimal notation.

Length

2 octets (unsigned integer)

Indicates the total length of a BGP message (including the header), in octets. The length ranges from 19 octets to 4096 octets.

Type

1 octet (unsigned integer)

Indicates the type of message following the BGP message header.

  • Open
  • Update
  • Notification
  • Keepalive
  • Route-refresh

Open Message

Open messages are used for BGP connection establishment. If the value of the Type field in the message header is 1, this message is an Open message. Figure 9-4 shows the data portion following the Open message header.

Figure 9-4 Format of an Open message
Table 9-2 Description of each field in the Open message

Field

Length

Description

Version

1 octet (unsigned integer)

Indicates the BGP version number. For BGP-4, the value of the field is 4.

My Autonomous System

2 octets (unsigned integer)

Indicates the AS number of the message sender.

Hold Time

2 octets (unsigned integer)

Indicates the hold time set by the message sender, in seconds. BGP peers use this field to negotiate the interval at which Keepalive or Update messages are sent so that the peers can maintain the connection between them. Upon receipt of an Open message, the finite state machine (FSM) of a BGP speaker must compare the locally configured hold time with that carried in the received Open message. The FSM uses the smaller value as the negotiation result. The value of Hold Time can be 0 (no Keepalive message is sent) or greater than or equal to 3. The default value is 180.

BGP Identifier

4 octets (unsigned integer)

Router ID of the sender.

Opt Parm Len

1 octet (unsigned integer)

Indicates the length of the Optional Parameters field. If the value is 0, no optional parameters are used.

Optional Parameters

Variable

Indicates a list of optional BGP parameters, with each one representing a unit in TLV format.

0               7              15
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...
|  Parm.Type   | Parm.Length  |  Parm.Value (variable)
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...
  • Parm.Type: indicates the parameter type. The value is an unsigned integer and occupies 1 octet. The field is valid only if its value is 2, which indicates that a capability needs to be negotiated.
  • Parm.Length: indicates the length of Parameter Value. The value is an unsigned integer and occupies 1 octet.
  • Parm.Value: varies with Parm.Type. If the value of Parm.Type is 2, Parm.Value indicates the list of capabilities that can be negotiated. Each unit in the list is a TLV 3-tuple.

    +------------------------------+
    | Capability Code (1 octet)    |
    +------------------------------+
    | Capability Length (1 octet)  |
    +------------------------------+
    | Capability Value (variable)  |
    +------------------------------+
    • Capability Code: indicates a capability number and occupies 1 octet. If the value is 1, the address family capability is supported. If the value is 2, the route-refresh capability is supported.
    • Capability Length: indicates the length of Capability Value and occupies 1 octet.
    • Capability Value: varies with Capability Code.

      If the value of Capability Code is 1:

      Capability Value is a TLV 3-tuple and occupies 4 octets.

      0       7      15      23      31
      +-------+-------+-------+-------+
      |      AFI      | Res.  | SAFI  |
      +-------+-------+-------+-------+

      AFI: short for address family identifier and 2 octets in length. AFI is used with the subsequent AFI (SAFI) to determine the relationship between the network layer protocol and IP address. The encoding mode is the same as those in multiprotocol extensions. The value complies with the address family numbers defined in the related RFC protocol.

      Res: is reserved and 1 octet in length. It must be set to 0 by the sender and is ignored when it is received.

      SAFI: occupies 1 octet. SAFI is used with AFI to determine the relationship between the network layer protocol and IP address. The encoding mode is the same as those in multiprotocol extensions. The value complies with the address family numbers defined in the related RFC protocol.

      If the value of Capability Code is 2:

      The route-refresh capability is supported. The code of this capability is 2, the length is 0, and there is no value.

      Devices can process Route-refresh messages only after the route-refresh capability is negotiated successfully. By default, the IPv4 unicast and route-refresh capabilities are supported.

Open Message Extensions

With the enhancement of BGP capabilities, when a BGP session negotiates multiple capabilities, the length of an Open message may exceed 255 bytes. You can run the peer extended-open-message command to use the extended format of an Open message, which is shown in Figure 9-5.

Figure 9-5 Extended format of an Open message
Table 9-3 Description of each field in the extended format of an Open message

Field

Length

Description

Version

1 octet (unsigned integer)

Indicates the BGP version number. For BGP-4, the value of the field is 4.

My Autonomous System

2 octets (unsigned integer)

Indicates the AS number of the message sender.

Hold Time

2 octets (unsigned integer)

Indicates the hold time set by the message sender, in seconds. BGP peers use this field to negotiate the interval at which Keepalive or Update messages are sent so that the peers can maintain the connection between them. Upon receipt of an Open message, the finite state machine (FSM) of a BGP speaker must compare the locally configured hold time with that carried in the received Open message. The FSM uses the smaller value as the negotiation result. The value of Hold Time can be 0 (no Keepalive message is sent) or greater than or equal to 3. The default value is 180.

BGP Identifier

4 octets (unsigned integer)

Router ID of the sender.

Non-Ext OP Len.

1 octet (unsigned integer)

The value of this field is fixed at 255.

Non-Ext OP Type

1 octet (unsigned integer)

IANA has registered the optional parameter extension length type code 255 as an extended optional parameter type for BGP Open messages.

Extended Opt.Parm.Length

2 octets (unsigned integer)

Length of extended optional parameters.

Optional Parameters

Variable

Indicates a list of optional BGP parameters, with each one representing a unit in TLV format.

0               7               15              23
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Parm.Type    |           Parm.Length         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~              Parm.Value (variable)            ~
|                                               |
  • Parm.Type: indicates the parameter type. The value is an unsigned integer and occupies 1 octet. The field is valid only if its value is 2, which indicates that a capability needs to be negotiated.
  • Parm.Length: indicates the length of Parameter Value. The value is an unsigned integer and occupies 2 octets.
  • Parm.Value: varies with Parm.Type. If the value of Parm.Type is 2, Parm.Value indicates the list of capabilities that can be negotiated. Each unit in the list is a TLV 3-tuple.

    +------------------------------+
    | Capability Code (1 octet)    |
    +------------------------------+
    | Capability Length (2 octet)  |
    +------------------------------+
    | Capability Value (variable)  |
    +------------------------------+
    • Capability Code: indicates a capability number and occupies 1 octet. If the value is 1, the address family capability is supported. If the value is 2, the route-refresh capability is supported.
    • Capability Length: indicates the length of Capability Value and occupies 2 octets.
    • Capability Value: varies with Capability Code.

      If the value of Capability Code is 1:

      Capability Value is a TLV 3-tuple and occupies 4 octets.

      0       7      15      23      31
      +-------+-------+-------+-------+
      |      AFI      | Res.  | SAFI  |
      +-------+-------+-------+-------+

      AFI: is short for address family identifier and occupies 2 octets. AFI is used with the subsequent AFI (SAFI) to determine the relationship between the network layer protocol and IP address. The encoding mode is the same as those in multiprotocol extensions. The value complies with the address family numbers defined in the related RFC protocol.

      Res: is reserved and 1 octet in length. It must be set to 0 by the sender and is ignored when it is received.

      SAFI: occupies 1 octet and is used with the AFI to determine the relationship between the network layer protocol and the IP address.

      The value 2 of Capability Code indicates that the route refresh capability is supported. The code of this capability is 2, the length is 0, and there is no value.

      Devices can process Route-refresh messages only after the route-refresh capability is negotiated successfully. By default, the device supports IPv4 unicast and route-refresh capabilities.

Update Message

Update messages are used to transfer routing information between BGP peers. The value of the Type field in the header of an Update message is 2. The following figure shows the format of the Update message content following the header. Figure 9-6 shows the format of an Update message.

Figure 9-6 Format of an Update message
Table 9-4 Description of each field in the Update message

Field

Length

Description

Withdrawn Routes Length

2 octets (unsigned integer)

Indicates the length of the Withdrawn Routes field. If the value is 0, no route is withdrawn.

Withdrawn Routes

Variable

Contains a list of routes to be withdrawn. Each entry in the list contains the Length (1 octet) and Prefix (length-variable) fields.

  • Length: indicates the mask length of the route to be withdrawn. The value 0 indicates that all routes are matched.

  • Prefix: The prefix of the transmitted IP address must be represented by an integer byte. For example, consider the withdrawal of the route 192.168.200.200. The Prefix (in hexadecimal encoding) of the route varies according to different mask lengths:

Total Path Attribute Length

2 octets (unsigned integer)

Indicates the total length of the Path Attributes field. If the value is 0, no route or route attributes need to be advertised.

Path Attributes

Variable

Indicates a list of path attributes in the Update message. The type codes of the path attributes are arranged in ascending order. Each attribute is encoded as a TLV (<attribute type, attribute length, attribute value>).

Figure 9-7 Format of the BGP path attribute TLV

Attr.TYPE occupies two octets (unsigned integer), including the one-octet Flags field (unsigned integer) and the one-octet Type Code field (unsigned integer).

Figure 9-8 TLV structure-Type

Attr.Flags: occupies one octet (eight bits) and indicates the attribute flag. The meaning of each bit is as follows:

O (Optional bit): defines whether the attribute is optional. The value 1 indicates an optional attribute, whereas the value 0 indicates a well-known attribute.

T (Transitive bit): Defines whether the attribute is transitive. For an optional attribute, the value 1 indicates that the attribute is transitive, whereas the value 0 indicates that the attribute is non-transitive. For a well-known attribute, the value must be set to 1.

P (Partial bit): defines whether the attribute is partial. If the optional transitive attribute is partial, the value is set to 1; if the attribute is complete, the value is set to 0. For well-known attributes and for optional non-transitive attributes, the value must be set to 0.

E (Extended Length bit): defines whether the length (Attr. Length) of the attribute needs to be extended. If the attribute length does not need to be extended, the value is set to 0 and the Attr. Length is 1 octet. If the attribute length needs to be extended, the value is set to 1 and the Attr. Length is 2 octets.

U (Unused bits): Indicates that the lower-order 4 bits are not used. These bits must be set to 0s upon transmission and ignored upon receipt.

Attr.Type Code: indicates the attribute type code and occupies 1 octet (unsigned integer). For details about the type codes, see Table 9-5.

Attr.Value: Enter the attribute value based on the attribute type.

Network Layer Reachability Information (NLRI)

Variable

Indicates a list of IP address prefixes in the Update message. Each address prefix in the list is encoded as a 2-tuple LV (<prefix length, the prefix of the reachable route>). The encoding mode is the same as that used for Withdrawn Routes.

Table 9-5 Type codes of route attributes

Attribute Type Code

Attribute Value

1: Origin

IGP, EGP, or Incomplete

2: AS_Path

AS_Set, AS_Sequence, AS_Confed_Set, or AS_Confed_Sequence

3: Next_Hop

Next-hop IP address.

4: Multi_Exit_Disc

MED that is used to identify the optimal route for the traffic to enter an AS.

5: Local_Pref

Local_Pref that is used to identify the optimal route for the traffic to leave an AS.

6: Atomic_Aggregate

The BGP speaker selects the summary route rather than a specific route.

7: Aggregator

Router ID and AS number of the device that performs route summarization.

8: Community

Community attribute.

9: Originator_ID

Router ID of the originator of the reflected route.

10: Cluster_List

List of the RRs through which the reflected route passes.

14: MP_REACH_NLRI

Multiprotocol reachable NLRI.

15: MP_UNREACH_NLRI

Multiprotocol unreachable NLRI.

16: Extended Communities

Extended community attribute.

Notification Message

Notification messages are used to notify BGP peers of errors in a BGP process. The value of the Type field in the header of a Notification message is 3. Figure 9-9 shows the format of a Notification message.

Figure 9-9 Format of a Notification message
Table 9-6 Description of each field in the Notification message

Field

Length

Description

Error code

1 octet

Indicates an error type. The value 0 indicates a non-specific error type. For details about the error codes, see Table 9-7.

Error subcode

1 octet

Specifies the number of an error detail. The number of a non-specific error detail is 0.

Data

Variable

Indicates the error data.

Table 9-7 Description of the BGP error codes

Error Code

Error Subcode

1: message header error

1: Connections are not synchronized.

2: Incorrect message length.

3: Incorrect message type.

2: Open message error

1: Unsupported version number.

2: Incorrect peer AS.

3: Incorrect BGP identifier.

4: Unsupported optional parameter.

5: Authentication failure.

6: Unacceptable hold time.

7: Unsupported capability.

3: Update message error

1: Malformed attribute list.

2: Unrecognized well-known attribute.

3: Missing well-known attribute.

4: Incorrect attribute flag.

5: Incorrect attribute length.

6: Invalid Origin attribute.

7: AS routing loop.

8: Invalid Next_Hop attribute.

9: Incorrect optional attribute.

10: Invalid network field.

11: Malformed AS_Path.

4: The hold timer expires.

0: No special error subcode is defined.

5: FSM error

1: An unexpected message is received in the OpenSent state.

2: An unexpected message is received in the OpenConfirm state.

3: An unexpected message is received in the Established state.

6: Cease

1: The number of prefixes exceeded the maximum.

2: Administrative shutdown.

3: The peer is deleted.

4: Administrative reset.

5: The connection fails.

6: Other configurations change.

7: Connection conflict.

8: Resource shortage.

9: The BFD session is interrupted.

Keepalive Message

Keepalive messages are used to maintain BGP connections. The value of the Type field in the header of a Keepalive message is 4. Each Keepalive message has only a BGP header; it does not have a data portion. Therefore, the total length of each Keepalive message is fixed at 19 octets.

Route-refresh Message

Route-refresh messages are used to dynamically request a BGP route advertiser to re-send Update messages. The value of the Type field in the header of a Route-refresh message is 5. Figure 9-10 shows the format of a Route-refresh message.

Figure 9-10 Format of a Route-refresh message
Table 9-8 Description of each field in the Route-refresh message

Field

Length

Description

AFI

2 octets (unsigned integer)

Indicates the address family ID, which is defined the same as that in Open messages.

Res.

1 octet (unsigned integer)

Must be all 0s. The field is ignored upon receipt.

SAFI

1 octet (unsigned integer)

Is defined the same as that in Open messages.