NetEngine 8000 M14K, M14, M8K, M8, M4, 8000E M14 M8, 8100 M14 M8 V800R022C00SPC600 Configuration Guide
BGP Configuration
- BGP Description
- Overview of BGP
- Understanding BGP
- BGP Fundamentals
- BGP Message Format
- BGP Route Processing
- Community Attribute
- Large-Community Attribute
- AIGP
- Entropy Label
- BGP Routing Loop Detection
- BGP Peer Group and Dynamic Peer Group
- BGP Confederation
- Route Reflector
- Route Server
- BGP VPN Route Leaking
- MP-BGP
- BGP Security
- BGP GR
- BFD for BGP
- BGP Peer Tracking
- BGP 6PE
- BGP ORF
- VPN ORF
- BGP Auto FRR
- BGP NSR
- BGP Dynamic Update Peer-Group
- 4-Byte AS Number
- Fake AS Number
- BMP
- BGP Best External
- BGP Add-Path
- Route Dampening
- Suppression on BGP Peer Flapping
- BGP Recursion Suppression in Case of Next Hop Flapping
- BGP-LS
- BGP RPD
- BGP Multi-instance
- BGP SR LSP
- BGP Configuration
- BGP Overview
- Configuration Precautions for BGP
- Configuring Basic BGP Functions
- Configuring the Format of BGP 4-Byte AS Numbers
- Configuring BGP Route Attributes
- Setting the BGP Preference
- Setting a PrefVal for BGP Routes
- Setting the Default Local_Pref Attribute for the Local Device
- Configuring MED Attributes for BGP Routes
- Configuring the Next_Hop Attribute
- Setting the AS_Path Attribute
- Configuring AIGP Attributes for Routes
- Configuring Attr_Set Attribute Encapsulation or Parsing
- Verifying the BGP Route Attribute Configuration
- Configuring BGP Routing Policies
- Configuring BGP XPL
- Configuring BGP Route Summarization
- Configuring BGP to Generate a Summary Default Route
- Configuring a BGP Peer Group
- Configuring a BGP Route Reflector
- Configuring a Route Reflector and Specifying Clients
- (Optional) Disabling Route Reflection Between Clients Through the RR
- (Optional) Setting the Cluster ID of a Route Reflector
- (Optional) Preventing a Device from Adding BGP Routes to the IP Routing Table
- (Optional) Enabling an RR to Modify Route Attributes Using an Export Policy
- Verifying the BGP Route Reflector Configuration
- Configuring a BGP Confederation
- Configuring BGP Community Attributes
- Configuring the BGP Large-Community Attribute
- Configuring Prefix-based BGP ORF
- Adjusting the BGP Network Convergence Speed
- Configuring a Dynamic BGP Peer Group
- Configuring a BGP Device to Send a Default Route to Its Peer
- Configuring a Device to Advertise BGP Supernet Unicast Routes to BGP Peers
- Configuring BGP Load Balancing
- Configuring BGP LSP Load Balancing
- Configuring a BGP SR LSP
- Configuring Path MTU Auto Discovery
- Configuring BGP Route Recursion to the Default Route
- Configuring BGP Next Hop Recursion Based on a Route-Policy
- Configuring AIGP value on a Route-Policy
- Configuring the POPGO Function
- Configuring the Device to Perform the Label Pop-go Action for Packets Carrying the Label Added to Each Received Non-labeled Unicast Route
- Configuring conversion from BGP IPv4 Unicast Routes to Labeled Routes
- Configuring BFD for BGP
- Configuring BGP Peer Tracking
- Configuring BGP Auto FRR
- Configuring Delayed Response to BGP Next Hop Recursion Changes
- Setting a Specified Peer or Each Peer in a Peer Group as an Independent Update Peer-Group
- Configuring a Delay in Releasing Obtained Labels in a BGP LSP FRR Switchover Scenario
- Configuring the Route Server Function
- Configuring the BGP GR Helper
- Enabling GR for BGP Peers
- Configuring BGP Best-external
- Configuring BGP Add-Path
- Configuring BMP
- Configuring BGP Route Dampening
- Configuring Suppression on BGP Peer Flapping
- Configuring Flapping Suppression Involved in BGP Next Hop Recursion
- Configuring BGP-LS
- Configuring the Entropy Label Capability for a BGP LSP
- Configuring BGP RPD
- Configuring IBGP Peers to Establish MPLS Local IFNET Tunnels
- Configuring the YANG Management Mode of BGP
- Improving BGP Security
- Configuring BGP Extensions
- Configuring BGP Multi-Instance
- Maintaining BGP
- Resetting BGP Connections
- Clearing BGP Statistics
- Configuring BGP to Record Peer Status Changes and Event Information
- Disabling the PAF Restriction for the Feature Indicating Whether the Number of Received BGP Routes Exceeds the Upper Limit
- Configuring a Mode in Which BGP Path Attributes Are Processed
- Setting a Priority That Determines the Disconnection Order of a BGP Peer Relationship If Memory Overload Occurs
- Enabling BGP to Discard New Routes If a Memory Exception Occurs
- Configuring Whitelist Session-CAR for BGP
- Configuring Whitelist Session-CAR for BMP
- Configuring Whitelist Session-CAR for RPKI
- Configuring Micro-Segment CAR for BGP
- BGP Route Selection Rules
- Route Processing on the BGP router
- Route Selection Rules
- BGP Routing Table
- Route Attributes
- (Optional) Configuring BGP to Ignore the Reachability of the Next Hops of Received BGP VPNv4 Routes
- Configuring BGP to Preferentially Select the Routes with Next Hops Recursing to SRv6 TE Policies
- Configuring BGP to Preferentially Select the Prefix Routes That Are Learned from VPNv4, VPNv6, or EVPN Peers and Are Leaked to a VPN Instance
- Configuration Examples for BGP
- Example for Configuring Basic BGP Functions
- Example for Configuring BGP to Interact with an IGP
- Example for Configuring the MED Attribute to Control Route Selection
- Example for Configuring an AS_Path Filter
- Example for Configuring BGP RRs
- Example for Configuring a BGP Confederation
- Example for Configuring the BGP Community Attribute
- Example for Configuring Prefix-based BGP ORF
- Example for Configuring BGP Route Dampening
- Example for Configuring BGP Default Route Advertisement
- Example for Configuring BGP Load Balancing
- Example for Configuring BGP Next Hop Recursion Based on a Routing Policy
- Example for Configuring Routing Policies to Control BGP Route Advertisement and Acceptance
- Example for Configuring BFD for BGP
- Example for Configuring BGP Auto FRR
- Example for Configuring BGP ADD-PATH
- Example for Configuring BGP Keychain Authentication
- Example for Configuring BGP-LS
- Example for Configuring BGP RPD
- Example for Configuring Dynamic BGP Peer Groups
- Example for Configuring BGP Multi-Instance
- Example for Configuring a BGP SR LSP
- Example for Configuring a BGP Virtual Link
- Example for Configuring BGP Routing Loop Detection
BGP Description
Overview of BGP
Definition
Border Gateway Protocol (BGP) is a dynamic routing protocol used between autonomous systems (ASs).
As three earlier-released versions of BGP, BGP-1, BGP-2, and BGP-3 are used to exchange reachable inter-AS routes, establish inter-AS paths, avoid routing loops, and apply routing policies between ASs.
Currently, BGP-4 is used.
As an exterior routing protocol on the Internet, BGP has been widely used among Internet service providers (ISPs).
BGP has the following characteristics:
Unlike an Interior Gateway Protocol (IGP), such as Open Shortest Path First (OSPF) and Routing Information Protocol (RIP), BGP is an Exterior Gateway Protocol (EGP) which controls route advertisement and selects optimal routes between ASs rather than discovering or calculating routes.
BGP uses Transport Control Protocol (TCP) as the transport layer protocol, which enhances BGP reliability.
BGP selects inter-AS routes, which poses high requirements on stability. Therefore, using TCP enhances BGP's stability.
BGP peers must be logically connected through TCP. The destination port number is 179 and the local port number is a random value.
BGP supports Classless Inter-Domain Routing (CIDR).
When routes are updated, BGP transmits only the updated routes, which reduces bandwidth consumption during BGP route distribution. Therefore, BGP is applicable to the Internet where a large number of routes are transmitted.
BGP is a distance-vector routing protocol.
BGP is designed to prevent loops.
Between ASs: BGP routes carry information about the ASs along the path. The routes that carry the local AS number are discarded to prevent inter-AS loops.
Within an AS: BGP does not advertise routes learned in an AS to BGP peers in the AS to prevent intra-AS loops.
BGP provides many routing policies to flexibly select and filter routes.
BGP provides a mechanism that prevents route flapping, which effectively enhances Internet stability.
BGP can be easily extended.
BGP4+ Definition
As a dynamic routing protocol used between ASs, BGP4+ is an extension of BGP.
Traditional BGP4 manages IPv4 routing information but does not support the inter-AS transmission of packets encapsulated by other network layer protocols (such as IPv6).
To support IPv6, BGP4 must have the additional ability to associate an IPv6 protocol with the next hop information and network layer reachable information (NLRI).
Two NLRI attributes that were introduced to BGP4+ are as follows:
Multiprotocol Reachable NLRI (MP_REACH_NLRI): carries the set of reachable destinations and the next hop information used for packet forwarding.
Multiprotocol Unreachable NLRI (MP_UNREACH_NLRI): carries the set of unreachable destinations.
The Next_Hop attribute in BGP4+ is in the format of an IPv6 address, which can be either a globally unique IPv6 address or a next hop link-local address.
Using multiple protocol extensions of BGP4, BGP4+ is applicable to IPv6 networks without changing the messaging and routing mechanisms of BGP4.
Purpose
BGP transmits route information between ASs. It, however, is not required in all scenarios.
BGP is required in the following scenarios:
On the network shown in Figure 1-1686, users need to be connected to two or more ISPs. The ISPs need to provide all or part of the Internet routes for the users. Routers, therefore, need to select the optimal route through the AS of an ISP to the destination based on the attributes carried in BGP routes.
The AS_Path attribute needs to be transmitted between users in different organizations.
Users need to transmit VPN routes through a Layer 3 VPN. For details, see the HUAWEI NetEngine 8100 M14/M8, NetEngine 8000 M14K/M14/M8K/M8/M4 & NetEngine 8000E M14/M8 series Feature Description - VPN.
Users need to transmit multicast routes and construct a multicast topology. For details, see the HUAWEI NetEngine 8100 M14/M8, NetEngine 8000 M14K/M14/M8K/M8/M4 & NetEngine 8000E M14/M8 series Feature Description - IP Multicast.
BGP is not required in the following scenarios:
Users are connected to only one ISP.
The ISP does not need to provide Internet routes for users.
ASs are connected through default routes.
Understanding BGP
BGP Fundamentals
BGP Operating Modes
BGP runs in either of the following modes on the process the router, as shown in Figure 1-1687:
Internal BGP (IBGP)
External BGP (EBGP)
When BGP runs within an AS, it is called IBGP; however, when it runs between ASs, it is called EBGP.
Roles in Transmitting BGP Messages
Speaker: Any router that sends BGP messages is called a BGP speaker. The speaker receives or generates new routing information and then advertises the routing information to other BGP speakers. After receiving a route from another AS, the BGP speaker compares the route with its local routes. If the route is better than its local routes, or the route is new, the speaker advertises it to all its other remote BGP speakers except the one that has advertised the route.
Peer: BGP speakers that exchange messages with each other are called peers.
BGP Messages
BGP runs by sending five types of messages: Open, Update, Notification, Keepalive, and Route-refresh.
Open: first message sent after a TCP connection is set up. An Open message is used to set up a BGP peer relationship. After a peer receives the Open message and negotiation between the local device and peer succeeds, the peer sends a Keepalive message to confirm and maintain the peer relationship. Then, the peers can exchange Update, Notification, Keepalive, and Route-refresh messages.
Update: This type of message is used to exchange routes between peers. An Update message can advertise multiple reachable routes with the same attributes and can be used to delete multiple unreachable routes.
An Update message can be used to advertise multiple reachable routes that share the same set of attributes. These attributes are applicable to all destinations (expressed by IP prefixes) in the network layer reachability information (NLRI) field of the Update message.
An Update message can be used to withdraw multiple unreachable routes. Each route is identified by its destination address (using the IP prefix), which identifies the routes previously advertised between BGP speakers.
An Update message can be used only to delete routes. In this case, it does not need to carry the route attributes or NLRI. When an Update message is used only to advertise reachable routes, it does not need to carry information about routes to be withdrawn.
Notification: If BGP detects an error, it sends a Notification message to its peers. The BGP connections are then torn down immediately.
Keepalive: BGP periodically sends Keepalive messages to peers to ensure the validity of BGP connections.
Route-refresh: This type of message is used to request that peers re-send all reachable routes to the local device.
If all BGP devices are enabled with the route-refresh capability and an import routing policy changes, the local device sends Route-refresh messages to its peers. Upon receipt, the peers re-send their routing information to the local device. This ensures that the local BGP routing table is dynamically updated and the new routing policy is used without tearing down BGP connections.
BGP Finite State Machine
The BGP Finite State Machine (FSM) has six states: Idle, Connect, Active, OpenSent, OpenConfirm, and Established.
Three common states during the establishment of BGP peer relationships are Idle, Active, and Established.
In the Idle state, BGP denies all connection requests. This is the initial status of BGP.
In the Connect state, BGP decides subsequent operations after a TCP connection is established.
In the Active state, BGP attempts to set up a TCP connection. This is the intermediate status of BGP.
In the OpenSent state, BGP is waiting for an Open message from the peer.
In the OpenConfirm state, BGP is waiting for a Notification or Keepalive message.
In the Established state, BGP peers can exchange Update, Route-refresh, Keepalive, and Notification messages.
The BGP peer relationship can be established only when both BGP peers are in the Established state. Both peers send Update messages to exchange routes.
BGP Processing
BGP adopts TCP as its transport layer protocol. Therefore, a TCP connection must be available between the peers. BGP peers negotiate parameters by exchanging Open messages to establish a BGP peer relationship.
After the peer relationship is established, BGP peers exchange BGP routing tables. BGP does not require a periodic update of its routing table. Instead, Update messages are exchanged between peers to update their routing tables incrementally if BGP routes change.
BGP sends Keepalive messages to maintain the BGP connection between peers.
If BGP detects an error (for example, it receives an error message), BGP sends a Notification message to report the error, and the BGP connection is torn down accordingly.
BGP Attributes
BGP route attributes are a set of parameters that describe specific BGP routes, and BGP can filter and select routes based on these attributes. BGP route attributes are classified into the following four types:
Well-known mandatory: This type of attribute can be identified by all BGP devices and must be carried in Update messages. Without this attribute, errors occur in the routing information.
Well-known discretionary: This type of attribute can be identified by all BGP devices. As this type of attribute is optional, it is not necessarily carried in Update messages.
Optional transitive: This indicates the transitive attribute between ASs. A BGP device may not recognize this type of attribute, but will still accept messages carrying it and advertise them to other peers.
Optional non-transitive: If a BGP device does not recognize this type of attribute, the device ignores it and does not advertise messages carrying it to other peers.
The most common BGP route attributes are as follows:
Origin, which is a well-known mandatory attribute
The Origin attribute defines the origin of a BGP route and has the following three types:
IGP: This type of attribute has the highest priority. IGP is the Origin attribute for routes obtained through an IGP in the AS from which the routes originate. For example, the Origin attribute of the routes imported to the BGP routing table using the network command is IGP.
EGP: This type of attribute has the second highest priority. The Origin attribute of the routes obtained through EGP is EGP.
Incomplete: This type of attribute has the lowest priority and indicates the routes learned through other modes. For example, the Origin attribute of the routes imported by BGP using the import-route command is Incomplete.
AS_Path, which is a well-known mandatory attribute
The AS_Path attribute records the numbers of all ASs through which a route passes from the local end to the destination in the distance-vector order.
When a BGP speaker advertises a local route:
When advertising the route beyond the local AS, the BGP speaker adds the local AS number to the AS_Path list and then advertises this attribute to peer routers through Update messages.
When advertising the route within the local AS, the BGP speaker creates an empty AS_Path list in an Update message.
When a BGP speaker advertises a route learned from the Update message of another BGP speaker:
When advertising the route beyond the local AS, the BGP speaker adds the local AS number to the far left side of the AS_Path list. From the AS_Path attribute, the BGP device that receives the route learns the ASs through which the route passes to the destination. The number of the AS closest to the local AS is placed on the far left side of the list, and the other AS numbers are listed next to the former in sequence.
When advertising the route within the local AS, the BGP speaker does not change its AS_Path attribute.
The AS_Path attribute has four types: AS_Sequence, AS_Set, AS_Confed_Sequence, and AS_Confed_Set.- AS_Sequence: ordered set of ASs that the route in an Update message has traversed to reach the destination.
- AS_Set: unordered set of ASs that the route in an Update message has traversed to reach the destination. The AS_Set attribute is used in route summarization scenarios. After route summarization, the device records the unordered set of AS numbers because it cannot sequence the numbers of ASs through which specific routes pass. Regardless of how many AS numbers an AS_Set contains, BGP considers the AS_Set length to be 1 during route selection.
- AS_Confed_Sequence: ordered set of member ASs in the local confederation that an Update message has traversed.
- AS_Confed_Set: unordered set of member ASs in the local confederation that an Update message has traversed. This type is primarily used for route summarization in a confederation.
The AS_Confed_Sequence and AS_Confed_Set attributes are used to prevent routing loops and select routes among the member ASs in a confederation.
Next_Hop, which is a well-known mandatory attribute
Different from the Next_Hop attribute in an IGP, the Next_Hop attribute in BGP is not necessarily the IP address of a peer router. In most cases, the Next_Hop attribute complies with the following rules:
When advertising a route to an EBGP peer, a BGP speaker sets the Next_Hop of the route to the address of the local interface used to establish the EBGP peer relationship.
When advertising a locally generated route to an IBGP peer, a BGP speaker sets the Next_Hop of the route to the address of the local interface used to establish the IBGP peer relationship.
When advertising a route learned from an EBGP peer to an IBGP peer, a BGP speaker does not change the Next_Hop of the route.
MED, which is an optional non-transitive attribute
The MED is transmitted only between two neighboring ASs, and the AS that receives the MED does not advertise it to a third AS.
Similar to the metric used by an IGP, the MED is used to determine the optimal route when traffic enters an AS. If the router running BGP obtains multiple routes from different EBGP peers and these routes have the same destination but different next hops, the device selects the route with the smallest MED value.
Local_Pref attribute, which is a well-known discretionary attribute
The Local_Pref attribute indicates the preference of a BGP route on the router. It is valid only between IBGP peers and is not advertised to other ASs.
The Local_Pref attribute determines the optimal route for the traffic that leaves an AS. When a BGP router obtains multiple routes to the same destination address but with different next hops through IBGP peers, the route with the largest Local_Pref value is selected.
BGP Message Format
A BGP message consists of a BGP header and a data portion. BGP runs by sending five types of messages: Open, Update, Notification, Keepalive, and Route-refresh. These messages use the same header format. BGP messages are transmitted based on TCP (port 179). The message length varies from 19 octets to 4096 octets. The header of each BGP message is 19 octets, consisting of three fields.
Message Header Format
The five types of BGP messages have the same header format. Figure 1-1688 shows the format of 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 ones 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 BGP message type, which has five values.
|
Open Message
Open messages are used to establish BGP connections. The value of the Type field in the header of an Open message is 1. Figure 1-1689 shows the 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) |
Indicates the router ID of the message 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 | Parameter Value (variable) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...
|
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. Figure 1-1690 shows the format of an Update message without the header.
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.
|
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 path attribute is encoded as a TLV (<attribute type, attribute length, attribute value>) of variable length. Figure 1-1691 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 1-1692 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 1-671. 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. |
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 1-1693 shows the format of a Notification message without the header.
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 1-673. |
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. |
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 |
0: No special error subcode is defined. |
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 1-1694 shows the format of a Route-refresh message without the header.
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. |
BGP Route Processing
Figure 1-1695 shows how BGP processes routes. BGP routes can be imported from other protocols or learned from peers. To reduce the routing size, you can configure route summarization for optimal routes. In addition, you can configure route-policies and apply them to route import, receipt, or advertisement to filter routes or modify route attributes.
For details about route import, see Route Import; for details about BGP route selection rules, see BGP Route Selection; for details about route summarization, see Route Summarization; for details about advertising routes to BGP peers, see BGP Route Advertisement.
For details about import or export policies, see "Routing Policies" in NetEngine 8100 M, NetEngine 8000E M, NetEngine 8000 M Feature Description — IP Routing.
For details about BGP load balancing, see Load Balancing Among BGP Routes.
Route Import
BGP itself cannot discover routes. Therefore, it needs to import other protocol routes, such as IGP routes or static routes, to the BGP routing table. Imported routes can be transmitted within an AS or between ASs.
- The Import mode enables BGP to import routes by protocol type, such as RIP, OSPF, IS-IS, static routes, and direct routes.
- The Network mode imports a route with the specified prefix and mask to the BGP routing table, which is more precise than the Import mode.
BGP Route Selection
- Prefers the routes that do not recurse to an SRv6 TE Policy in the Graceful Down state (the SRv6 TE Policy is in the delayed deletion state).
- Prefers routes in descending order of Valid, Not Found, and Invalid after BGP origin AS validation results are applied to route selection in a scenario where the device is connected to a Resource Public Key Infrastructure (RPKI) server.
Prefers routes without bit errors.
If the bestroute bit-error-detection command is run, BGP preferentially selects routes without bit error events.
- Prefers the peer routes with an IPv4 or IPv6 next hop address or remotely leaked routes.
If the bestroute nexthop-priority ipv4 high-level command is run, BGP prefers the routes with an IPv4 next hop address.
If the bestroute nexthop-priority ipv6 high-level command is run, BGP prefers the routes with an IPv6 next hop address.
- Prefers the prefix routes that are learned from VPNv4/VPNv6 or EVPN and then are leaked to a VPN instance.
If the bestroute address-family-priority vpnv4 high-level command is run, BGP compares the VPN address family types of routes when selecting the optimal route, and the IPv4 prefix routes leaked from VPNv4 take precedence over the IPv4 prefix routes leaked from EVPNv4.
If the bestroute address-family-priority evpnv4 high-level command is run, BGP compares the VPN address family types of routes when selecting the optimal route, and the IPv4 prefix routes leaked from EVPNv4 take precedence over the IPv4 prefix routes leaked from VPNv4.
If the bestroute address-family-priority vpnv6 high-level command is run, BGP compares the VPN address family types of routes when selecting the optimal route, and the IPv6 prefix routes leaked from VPNv6 take precedence over the IPv6 prefix routes leaked from EVPNv6.
If the bestroute address-family-priority evpnv6 high-level command is run, BGP compares the VPN address family types of routes when selecting the optimal route, and the IPv6 prefix routes leaked from EVPNv6 take precedence over the IPv6 prefix routes leaked from VPNv6.
Prefers the route with the largest PrefVal value.
PrefVal is Huawei-specific. It is valid only on the device where it is configured.
- Prefers the routes with next hops recursing to SRv6 tunnels, and prefers the routes with next hops recursing to SRv6 TE Policies over the routes with next hops recursing to SRv6 BE tunnels.
If the bestroute nexthop-recursive-priority srv6-te-policy command is run, the routes with next hops recursing to SRv6 TE Policies are preferentially selected.
Prefers the route with the largest Local_Pref value.
If a route does not carry Local_Pref, the default value 100 takes effect during BGP route selection. To change the value, run the default local-preference command.
Prefers a locally originated route to a route learned from a peer.
Locally originated routes include routes imported using the network or import-route command, as well as manually and automatically generated summary routes.- Prefers a summary route over a non-summary route.
- Prefers a route obtained using the aggregate command over a route obtained using the summary automatic command.
- Prefers a route imported using the network command over a route imported using the import-route command.
Prefers a route that carries the Accumulated Interior Gateway Protocol Metric (AIGP) attribute.
- The priority of a route that carries the AIGP attribute is higher than the priority of a route that does not carry the AIGP attribute.
- If two routes both carry the AIGP attribute, the route with a smaller AIGP attribute value plus IGP metric of the recursive next hop is preferred over the other route.
- Prefers the route with the shortest AS_Path.
- The AS_CONFED_SEQUENCE and AS_CONFED_SET are not included in the AS_Path length.
- During route selection, a device assumes that an AS_SET carries only one AS number regardless of the actual number of ASs it carries.
- If the bestroute as-path-ignore command is run, BGP no longer compares the AS_Path attribute.
After the load-balancing as-path-ignore command is run, the routes with different AS_Path values can load-balance traffic.
Prefers the route with the Origin type as IGP, EGP, and Incomplete in descending order.
- Prefers the route with the smallest MED value.
If the bestroute med-plus-igp command is run, BGP preferentially selects the route with the smallest sum of MED multiplied by a MED multiplier and IGP cost multiplied by an IGP cost multiplier.
- BGP compares the MEDs of only routes from the same AS (excluding confederation sub-ASs). MEDs of two routes are compared only when the first AS number in the AS_Sequence (excluding AS_Confed_Sequence) of one route is the same as its counterpart in the other route.
- If a route does not carry MED, BGP considers its MED as the default value (0) during route selection. If the bestroute med-none-as-maximum command is run, BGP considers its MED as the largest MED value (4294967295).
- If the compare-different-as-med command is run, BGP compares MEDs of routes even when the routes are received from peers in different ASs. If the ASs use the same IGP and route selection mode, you can run this command. Otherwise, do not run this command because a loop may occur.
- If the deterministic-med command is run, routes are no longer selected in the sequence in which they are received.
Prefers local VPN routes, LocalCross routes, and RemoteCross routes in descending order.
LocalCross routes indicate the routes that are leaked between local VPN instances or routes imported between public network and VPN instances.
If the ERT of a VPNv4 route in the routing table of a VPN instance on a PE matches the IRT of another VPN instance on the PE, the VPNv4 route is added to the routing table of the latter VPN instance. This route is called a LocalCross route. If the ERT of a VPNv4 route learned from a remote PE matches the IRT of a VPN instance on the local PE, the VPNv4 route is added to the routing table of that VPN instance. This route is called a RemoteCross route.
Prefers EBGP routes over IBGP routes among the routes learned from peers. In the VPNv4, EVPN, and VPNv6 address families, the routes sent by the local VRF take precedence over the routes learned from peers.
- Prefers the VPNv4, EVPN, and VPNv6 routes learned from peers.
If the peer high-priority command is run, the device preferentially selects the VPNv4, EVPN, and VPNv6 routes learned from IPv4 or IPv6 peers.
- Prefers the routes that are learned from VPNv4 or VPNv6 peers and are then leaked to a VPN instance and that carry IPv4 or IPv6 next hop addresses.
If the bestroute nexthop-priority ipv4 command is run, the device preferentially selects the routes that are learned from VPNv4 or VPNv6 peers and are then leaked to a VPN instance and that carry IPv4 next hop addresses.
If the bestroute nexthop-priority ipv6 command is run, the device preferentially selects the routes that are learned from VPNv4 or VPNv6 peers and are then leaked to a VPN instance and that carry IPv6 next hop addresses.
Prefers the route that recurses to an IGP route with the smallest cost.
If the bestroute igp-metric-ignore command is run, BGP no longer compares the IGP cost.
Prefers the route with the shortest Cluster_List.
By default, Cluster_List takes precedence over Router ID during BGP route selection. To enable Router ID to take precedence over Cluster_List during BGP route selection, run the bestroute routerid-prior-clusterlist command.
Prefers the route advertised by the router with the smallest router ID.
After the bestroute router-id-ignore command is run, BGP does not compare router IDs during route selection.
If each route carries an Originator_ID, the originator IDs rather than router IDs are compared during route selection. The route with the smallest Originator_ID is preferred.
Prefers the route learned from the peer with the smallest IP address.
If BGP Flow Specification routes are configured locally, the first configured BGP Flow Specification route is preferentially selected.
Prefers the locally imported route in the RM routing table.
If a direct route, static route, and IGP route are imported, BGP preferentially selects the direct route, static route, and IGP route in descending order.
Prefers the Add-Path route with the smallest recv pathID.
Prefers the remotely leaked route with the smallest RD.
Prefers locally received routes over the routes imported between VPN and public network instances.
Prefers the route that was learned the earliest.
For details about BGP route attributes, see BGP Attributes.
For details about BGP route selection, see Figure 1-1696.
Route Summarization
On a large-scale network, the BGP routing table can be very large. Route summarization can reduce the size of the routing table.
Route summarization is the process of summarizing specific routes with the same IP prefix into a summary route. After route summarization, BGP advertises only the summary route rather than all specific routes to BGP peers.
- Automatic route summarization: takes effect on the routes imported by BGP. With automatic route summarization, the specific routes for the summarization are suppressed, and BGP summarizes routes based on the natural network segment and sends only the summary route to BGP peers. For example, 10.1.1.1/32 and 10.2.1.1/32 are summarized into 10.0.0.0/8, which is a Class A address.
- Manual route summarization: takes effect on the local BGP routes. With manual route summarization, users can control the attributes of the summary route and determine whether to advertise the specific routes.
IPv4 supports both automatic and manual route summarization, whereas IPv6 supports only manual route summarization.
BGP Route Advertisement
- When there are multiple valid routes, a BGP speaker advertises only the optimal route to its peers.
- A BGP speaker advertises the routes learned from EBGP peers to all BGP peers, including EBGP peers and IBGP peers.
- A BGP speaker does not advertise the routes learned from an IBGP peer to other IBGP peers.
- Whether a BGP speaker advertises the routes obtained from an IBGP peer to its EBGP peers depends on the BGP-IGP synchronization state.
- A BGP speaker advertises all BGP optimal routes to new peers after peer relationships are established.
Community Attribute
A community attribute is a route tag used to identify BGP routes with the same characteristics. A community attribute is expressed by a set of 4-byte values. The community attributes on the NetEngine 8100 M, NetEngine 8000E M, NetEngine 8000 M are expressed in two formats: hexadecimal format (aa:nn) and decimal integer format (community number). The two formats can be converted to each other, as shown in Figure 1-1697.
aa:nn: aa indicates an AS number and nn indicates the community identifier defined by an administrator. The value of aa or nn ranges from 0 to 65535, which is configurable. For example, if a route is from AS 100 and the community identifier defined by the administrator is 1, the community is 100:1.
Community number: It is an integer ranging from 0 to 4294967295. As defined in standard protocols, numbers from 0 (0x00000000) to 65535 (0x0000FFFF) and from 4294901760 (0xFFFF0000) to 4294967295 (0xFFFFFFFF) are reserved.
Community attributes simplify the application, maintenance, and management of route-policies and allow a group of BGP devices in multiple ASs to share a route-policy. The community attribute is a route attribute. It is transmitted between BGP peers and is not restricted by the AS. Before advertising a route with the community attribute to peers, a BGP peer can change the original community attribute of this route.
The peers in a peer group share the same policy, while the routes with the same community attribute share the same policy.
In addition to well-known community attributes, you can use a community filter to define extended community attributes to flexibly control route-policies.
Well-known Community Attributes
Table 1-675 lists well-known BGP community attributes.
Community Name |
Community Identifier |
Description |
---|---|---|
Internet |
0 (0x00000000) |
By default, all routes belong to the Internet community. A route with this attribute can be advertised to all BGP peers. |
No_Export |
4294967041 (0xFFFFFF01) |
A route with this attribute cannot be advertised beyond the local AS. |
No_Advertise |
4294967042 (0xFFFFFF02) |
A route with this attribute cannot be advertised to any other BGP peers. |
No_Export_Subconfed |
4294967043 (0xFFFFFF03) |
A route with this attribute cannot be advertised beyond the local AS or to other sub-ASs. |
Usage Scenario
On the network shown in Figure 1-1698, EBGP connections are established between DeviceA and DeviceB, and between DeviceB and DeviceC. If the No_Export community attribute is configured on DeviceA in AS 10 and DeviceA sends a route with the community attribute to DeviceB in AS20, DeviceB does not advertise the route to other ASs after receiving it.
Large-Community Attribute
A BGP community attribute is a set of destination addresses that have the same characteristics. The attribute is expressed as a list of one or more 4-byte values. Generally, the community attribute on the NetEngine 8100 M, NetEngine 8000E M, NetEngine 8000 M is in the format of aa:nn, where aa indicates an Autonomous System Number (ASN) and nn indicates an attribute ID defined by the network administrator. Due to the use of 4-byte ASNs, the BGP community attribute can no longer accommodate both an ASN and attribute ID. In addition, the community attribute offers limited flexibility because only one attribute ID is available. To address these shortcomings, the Large-Community attribute is defined. This attribute extends and can be used together with the community attribute. The Large-Community attribute is a set of one or more 12-byte values, each of which is in the format of Global Administrator:LocalData1:LocalData2.
The Global Administrator field is intended to represent a complete 4-byte ASN, but it can also be set to a value other than an ASN. Global Administrator, LocalData1, and LocalData2 are unsigned integers each ranging from 0 to 4294967295. The administrator can set Global Administrator, LocalData1, and LocalData2 according to requirements.
The Large-Community attribute can represent a 2-byte or 4-byte ASN, and has two 4-byte LocalData IDs. This allows an administrator to apply route-policies more flexibly. For example, the Large-Community attribute can be set to ME:ACTION:YOU or ASN:Function:Parameter.
Networking Application
On the network shown in Figure 1-1699, Device B establishes an EBGP peer relationship with each of Device A and Device C. By setting the Large-Community attribute to 20:4:30 on Device B, you can disable the routes on Device A from being advertised to AS30.
AIGP
Background
The Accumulated Interior Gateway Protocol Metric (AIGP) attribute is an optional non-transitive Border Gateway Protocol (BGP) path attribute. The attribute type code assigned by the Internet Assigned Numbers Authority (IANA) for the AIGP attribute is 26.
Routing protocols, such as IGPs that have been designed to run within a single administrative domain, generally assign a metric to each link, and then choose the path with the smallest metric as the optimal path between two nodes. BGP, designed to provide routing over a large number of independent administrative domains, does not select paths based on metrics. If a single administrative domain (AIGP domain) consists of several BGP networks, it is desirable for BGP to select paths based on metrics, just as an IGP does. The AIGP attribute enables BGP to select paths based on metrics.
Related Concepts
An AIGP administrative domain is a set of autonomous systems (ASs) in a common administrative domain. The AIGP attribute takes effect only in an AIGP administrative domain.
Implementation
AIGP Attribute Origination
AIGP Attribute Delivery
- If B does not support the AIGP attribute or does not have the AIGP capability enabled for a peer, B ignores the AIGP attribute and does not transmit the AIGP attribute to other BGP peers.
- If B supports the AIGP attribute and has the AIGP capability enabled for a peer, B can modify the AIGP attribute of the route only after B has set itself to be the next hop of the route. The rules for modifying the AIGP attribute are as follows:
- If the BGP peer relationship between A and B is established over an IGP route, or a static route that does not require recursion, B uses the metric value of the IGP or static route plus the received AIGP attribute value as the new AIGP attribute value and sends the new AIGP attribute to other peers.
- If the BGP peer relationship between A and B is established over a BGP route, or a static route that requires recursion, route recursion is performed when B sends data to A. Each route recursion involves a recursive route. B uses the sum of the metric values of the recursive routes plus the received AIGP attribute value as the new AIGP attribute value and sends the new AIGP attribute to other peers.
Role of the AIGP Attribute in BGP Route Selection
- If BGP cannot determine the optimal route based on Route-type, BGP compares the AIGP attributes. If this method still cannot determine the optimal route, BGP proceeds to compare the AS_Path attributes.
- The priority of a route that carries the AIGP attribute is higher than the priority of a route that does not carry the AIGP attribute.
- If all routes carry the AIGP attribute, the route with the smallest AIGP attribute value plus the IGP metric value of the recursive next hop is preferred over the other routes.
Usage Scenario
The AIGP attribute is used to select the optimal route in an AIGP administrative domain.
The AIGP attribute can be transmitted between BGP unicast peers as well as between BGP VPNv4/VPNv6 peers. Transmitting the AIGP attribute between BGP VPNv4/VPNv6 peers allows L3VPN traffic to be transmitted along the path with the smallest AIGP attribute value.
On the inter-AS IPv4 VPN Option B network shown in Figure 1-1701, BGP VPNv4 peer relationships are established between PEs and ASBRs. Two paths with different IGP costs exist between PE1 and PE2. If you want the PEs to select a path with a lower IGP cost to carry traffic, you can enable the AIGP capability in the BGP VPNv4 address family view and configure a route policy to add the same AIGP initial value to BGP VPNv4 routes. Take PE1 as an example. After this configuration, PE1 receives two BGP VPNv4 routes destined for CE2 from ASBR1 and ASBR2, and the BGP VPNv4 route sent by ASBR1 has a lower AIGP value. If higher-priority route selection conditions of the routes are the same, PE1 preferentially selects the BGP VPNv4 route with a lower AIGP value so that traffic can be transmitted over the PE1 -> ASBR1 -> ASBR3 -> PE2 path.
Benefits
After the AIGP attribute is configured in an AIGP administrative domain, BGP selects paths based on metrics, just as an IGP. Consequently, all devices in the AIGP administrative domain use the optimal routes to forward data.
Entropy Label
A BGP entropy label is used only to improve load balancing performance. It is not assigned through protocol negotiation and is not used to forward packets. An entropy label can be generated through BGP negotiation to improve load balancing during traffic forwarding. A well-known entropy label (label 7) is added to the inner layer of the BGP LSP label, and then a random label is added to the inner layer of the BGP LSP label.
Background
As user networks and the scope of network services continue to expand, load-balancing techniques are used to improve bandwidth between nodes. If tunnels are used for load balancing, transit nodes (P) obtain IP content carried in MPLS packets as a hash key. If a transit node cannot obtain the IP content from MPLS packets, the transit node can only use the top label in the MPLS label stack as a hash key. The top label in the MPLS label stack cannot differentiate underlying-layer protocols in packets in detail. As a result, the top MPLS labels are not distinguished when being used as hash keys, resulting in load imbalance. Per-packet load balancing can be used to prevent load imbalance but results in disorder. This drawback adversely affects user experience. The entropy label feature can solve the preceding problems and improve load balancing performance.
Implementation
On the network shown in Figure 1-1702, load balancing is performed on ASBRs (transit nodes) and the result is uneven. To achieve even load balancing, you can configure the entropy label capability of the BGP LSP.
The entropy label is generated by the ingress solely for the purpose of load balancing. To help the egress LSR distinguish the entropy label generated by the ingress LSR from application labels, label 7 is added before an entropy label in the MPLS label stack.
The ingress generates an entropy label and encapsulates it into the MPLS label stack. If packets are not encapsulated with MPLS labels on the ingress, the ingress can easily obtain IP or Layer 2 protocol data for use as a hash key. If the ingress detects the entropy label capability enabled for tunnels, the ingress uses IP information carried in packets to compute an entropy label, adds it to the MPLS label stack, and advertises it to an ASBR. The ASBR uses the entropy label as a hash key to load-balance traffic and does not need to parse IP data inside MPLS packets.
The entropy label is pushed into packets by the ingress and removed by the egress. Therefore, the egress needs to notify the ingress of the support for the entropy label capability.
- Egress: If the egress can parse an entropy label, the egress adds the entropy label to Path Attributes in BGP routes and then advertises the BGP routes to notify upstream nodes, including the ingress of the local entropy label capability.
- Transit node: A transit node needs to be enabled with the entropy label advertisement capability so that the transit node can advertise the BGP routes to notify upstream nodes of the local entropy label capability.
- Ingress: determines whether to add an entropy label into packets to improve load balancing based on the entropy label capability advertised by the egress.
Usage Scenario
- In Figure 1-1702, entropy labels are used when load balancing is performed among transit nodes.
- On the network shown in Figure 1-1703, the BGP labeled routes exchanged between PE1 and ASBR1 are sent through an RR. If the RR needs to advertise the entropy label attribute, BGP LSP Entropy label attribute advertisement needs to be enabled between the RR and PE1, and between the RR and ASBR1. The RR also needs to be enabled to forward BGP LSP entropy labels. If the RR is not enabled to forward BGP LSP entropy labels, it discards the BGP LSP entropy labels carried in routes.
Benefits
Entropy labels help achieve more even load balancing.
BGP Routing Loop Detection
Fundamentals of BGP Routing Loop Detection
Once a routing loop occurs on a Layer 3 network, packets cannot be forwarded, which may cause losses to carriers or users.
To detect potential routing loops on the network, BGP defines the Loop-detection attribute. The fundamentals of BGP routing loop detection are as follows:
- After BGP routing loop detection is enabled, the local device generates a random number, adds the Loop-detection attribute to the routes to be advertised to EBGP peers or the locally imported routes to be advertised to peers, and encapsulates the attribute with the random number and the local vrfID. The local vrfID is automatically generated and globally unique. In the public network scenario, the vrfID is 0. In the private network scenario, the vrfID is automatically generated after a VPN instance is created. When OSPF/IS-IS routes are imported to BGP, the routing loop attributes of the OSPF/IS-IS routes are inherited.
- When the local device receives a route with the Loop-detection attribute from another device, the local device performs the following checks:
- Compares the Loop-detection attribute of the received route with the combination of the vrfID and random number that are locally stored.
- If they are the same, the local device determines that a routing loop occurs.
- If they are different, the local device determines that no routing loop occurs, and the route participates in route selection.
- Checks whether the received route has a routing loop record.
Routing loop records are affected by the following commands:
- For the routes that already have routing loop records before routing loop alarms are cleared using the clear route loop-detect bgp alarm command, the records always exist.
- For the routes that have routing loop records but no longer carry the routing loop attribute of the local device after routing loop alarms are cleared using the clear route loop-detect bgp alarm command, the records of these routes are deleted.
- If the undo route loop-detect bgp enable command is run, the routing loop records of all looped routes are deleted.
- If a route has a routing loop record, a routing loop once occurred. Such a route is considered to be a looped route even if it does not carry the routing loop attribute of the local device.
- If there is no routing loop record and the Loop-detection attribute of the received route is different from the combination of the vrfID and random number that are locally stored, the local device determines that no routing loop occurs, and the route participates in route selection normally.
- If there is no routing loop record but the Loop-detection attribute of the received route is the same as the combination of the vrfID and random number that are locally stored, the local device determines that a routing loop occurs.
- Compares the Loop-detection attribute of the received route with the combination of the vrfID and random number that are locally stored.
- If a routing loop is detected and the looped route is selected, the local device reports an alarm to notify the user of the routing loop risk, enters the loop prevention state, and performs the following operations:
- Preferentially selects non-looped routes when the BGP routing table contains multiple routes with the same destination as the looped route.
- Increases the MED value and reduces the local preference of the looped route when advertising it.
- After the device processes a looped route, the routing loop may be resolved. If the routing loop persists, you need to locate the cause of the loop and resolve the loop. As the device cannot detect when the loop risk is eliminated, the routing loop alarm will not be cleared automatically. To manually clear the alarm after the loop risk is eliminated, you can run a related command.
Implementation
The Loop-detection attribute is a private BGP attribute. It uses a reserved value (type=255) to implement routing loop detection in some scenarios. Figure 1-1704 shows the Loop-detection attribute TLV, and Table 1-676 describes the fields in it.
Currently, the Loop-detection attribute is supported only in the BGP IPv4 public network, BGP IPv4 private network, BGP IPv6 public network, BGP IPv6 private network, BGP VPNv4, and BGP VPNv6 address families.
Field |
Description |
---|---|
Attr.Flags |
Attribute flag, which occupies one byte (eight bits). 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 |
Attribute type, which occupies one byte. The value is an unsigned integer, with the initial value being 0xFF. |
Attr.Length |
Length of the attribute. |
Attr.Value |
The value is 0x0030FBB8. It is Huawei's organizationally unique identifier (OUI) and is used for vendor identification. |
BGP also defines a sub-TLV for Attr.Value to identify the device that detects a routing loop. Figure 1-1705 shows the sub-TLV, and Table 1-677 describes the fields in the sub-TLV.
A maximum of four Loop-detection attribute sub-TLVs can be carried. If more than four sub-TLVs exist, they are overwritten according to the first-in-first-out rule.
Field |
Description |
---|---|
Attr.Type |
The value is 0xFF. |
Attr.Length |
Length of the attribute. The value is 0x08, 0x10, 0x18, or 0x20. |
Attr.Value |
0 31 63 +-------------+-------------+ | vrfID | Random number | +-------------+-------------+ vrfID specifies a system-allocated VPN ID. The value ranges from 0 to 0xFFFFFFFF. NOTE:
For BGP VPNv4 and BGP VPNv6 routes, the system only checks the random number when determining whether a routing loop occurs; that is, it does not check the vrfID. |
Application Scenarios
BGP routing loops may occur in the following scenarios. You are advised to enable BGP routing loop detection during network planning.
- On the network shown in Figure 1-1706, DeviceA and DeviceC belong to AS 100, and DeviceB belongs to AS 200. An export policy is configured on DeviceB to delete the original AS numbers from the routes to be advertised to DeviceC. After receiving a BGP route that originates from DeviceC, DeviceA advertises the route to DeviceB, which then advertises the route back to DeviceC. As a result, a BGP routing loop occurs on DeviceC. After BGP routing loop detection is enabled on the entire network, DeviceC adds Loop-detection attribute 1 to the BGP route (locally imported) before advertising the route to DeviceA. After receiving the route, DeviceA adds Loop-detection attribute 2 to the route before advertising the route to DeviceB (EBGP peer). After receiving the route, DeviceB adds Loop-detection attribute 3 to the route before advertising the route to DeviceC (EBGP peer). After receiving the Loop-detection attributes, DeviceC discovers that these attributes contain Loop-detection attribute 1 which was added by itself, and then reports a routing loop alarm.
- On the network shown in Figure 1-1707, DeviceA resides in AS 100; DeviceB resides in AS 200; DeviceC and DeviceD reside in AS 300. An export policy is configured on DeviceD to delete the original AS numbers from the routes to be advertised to DeviceB. In this scenario, a BGP routing loop occurs on DeviceB.
- On the network shown in Figure 1-1708, the PE advertises a VPN route through VPN1, and then receives this route through VPN1, indicating that a routing loop occurs on the PE.
- On the network shown in Figure 1-1709, DeviceA, DeviceB, and DeviceC belong to AS 100. An IBGP peer relationship is established between DeviceA and the RR, between the RR and DeviceB, and between the RR and DeviceC. OSPF runs on DeviceB and DeviceC. DeviceB is configured to import BGP routes to OSPF, and DeviceC is configured to import OSPF routes to BGP. An export policy is configured on DeviceA to add AS numbers to the AS_Path attribute for the routes to be advertised to the RR. After receiving a BGP route from DeviceA, the RR advertises this route to DeviceB. DeviceB then imports the BGP route to convert it to an OSPF route and advertises the OSPF route to DeviceC. DeviceC then imports the OSPF route to convert it to a BGP route and advertises the BGP route to the RR. When comparing the route advertised by DeviceA and the route advertised by DeviceC, the RR prefers the one advertised by DeviceC as it has a shorter AS_Path than that of the route advertised by DeviceA. As a result, a stable routing loop occurs.
To address this problem, enable BGP routing loop detection on DeviceC. After BGP routing loop detection is enabled, DeviceC adds Loop-detection attribute 1 to the BGP route imported from OSPF and advertises the BGP route to the RR. After receiving this BGP route, the RR advertises it (carrying Loop-detection attribute 1) to DeviceB. As OSPF routing loop detection is enabled by default, when the BGP route is imported to become an OSPF route on DeviceB, the OSPF route inherits the routing loop attribute of the BGP route and has an OSPF routing loop attribute added as well before the OSPF route is advertised to DeviceC. Upon receipt of the OSPF route, DeviceC imports it to convert it to a BGP route. Because BGP routing loop detection is enabled, the BGP route inherits the routing loop attributes of the OSPF route. Upon receipt of the route, DeviceC finds that the received route carries its own routing loop attribute and therefore determines that a routing loop has occurred. In this case, DeviceC generates an alarm, and reduces the local preference and increases the MED value of the route before advertising the route to the RR. After receiving the route, the RR compares this route with the route advertised by DeviceA. Because the route advertised by DeviceC has a lower local preference and a larger MED value, the RR preferentially selects the route advertised by DeviceA. The routing loop is then resolved.
When the OSPF route is transmitted to DeviceC again, DeviceC imports it to convert it to a BGP route, and the route carries only the OSPF routing loop attribute added by DeviceB. However, DeviceC still considers the route as a looped route because the route has a routing loop record. In this case, the RR does not preferentially select the route after receiving it from DeviceC. Then routes converge normally.
This function is not supported in the following scenarios:
- When BGP is configured to advertise the default route, the Loop-detection attribute is not added to the default route.
- When BGP Add-Path is configured, the Loop-detection attribute is not added to routes.
- When the route server function is configured, the Loop-detection attribute is not added to the routes advertised by the server.
- The Loop-detection attribute is not added to the received routes to be advertised to IBGP peers.
BGP Peer Group and Dynamic Peer Group
A peer group is a set of peers with the same policies. After a peer is added to a peer group, the peer inherits the configurations of this peer group. If the configurations of the peer group change, the configurations of all the peers in the group change accordingly. A large number of BGP peers may exist on a large-scale BGP network. If many of the BGP peers need the same policies, some commands need to be run repeatedly for each peer. To simplify the configuration, you can configure a peer group. Each peer in a peer group can be configured with unique policies to advertise and receive routes.
However, multiple BGP peers can change frequently on some BGP networks, causing the establishment of BGP peer relationships to change accordingly. If you configure peers in static mode, you must frequently add or delete peer configurations on the local device, which increases the maintenance workload. To address this problem, configure the dynamic BGP peer function to enable BGP to listen for BGP connection requests from a specified network segment, dynamically establish BGP peer relationships, and add these peers to the same dynamic peer group. This spares you from adding or deleting BGP peer configurations in response to each change in dynamic peers, reducing the workload of network maintenance.
Application
On the network shown in Figure 1-1710, an EBGP peer relationship is established between Device A and Device B and between Device A and Device C, and an IBGP peer relationship is established between Device A and Device D and between Device A and Device E.
Device B and Device C are on the same network segment (10.1.0.0/16). In this case, you can configure a dynamic peer group on Device A to listen for BGP connection requests from this network segment. After the dynamic peer group is configured, Device B and Device C are dynamically added to this peer group, and the devices to be deployed on this network segment will also be dynamically added to the peer group when they request to establish BGP peer relationships with Device A. This process helps reduce the network maintenance workload. In addition, you can configure another dynamic peer group on Device A so that Device D and Device E are dynamically added to this peer group.
BGP Confederation
Besides RR, BGP confederation can also reduce IBGP connections in an AS. It divides an AS into several sub-ASs. Fully meshed IBGP connections are established in each sub-AS, and fully meshed EBGP connections are established between sub-ASs.
In Figure 1-1711, there are multiple BGP routers in AS 200. To reduce the number of IBGP connections, AS 200 is divided into three sub-ASs: AS 65001, AS 65002, and AS 65003. In AS 65001, fully meshed IBGP connections are established between the three routers.
BGP speakers outside a confederation such as Router F in AS 100, do not know the existence of the sub-ASs (AS 65001, AS 65002, and AS 65003) in the confederation. The confederation ID is the AS number that is used to identify the entire confederation. For example, AS 200 in Figure 1-1711 is the confederation ID.
Applications and Limitations
The confederation needs to be configured on each router, and the router that joins the confederation must support the confederation function.
BGP speakers need to be reconfigured when a network in non-confederation mode switches to confederation mode. As a result, the logical topology changes accordingly.
On large-scale BGP networks, the RR and confederation can both be used.
Route Reflector
Fully meshed connections need to be established between IBGP peers to ensure the connectivity between IBGP peers. If there are n routers in an AS, n x (n-1)/2 IBGP connections need to be established. When there are a lot of IBGP peers, network resources and CPU resources are greatly consumed. Route reflection can solve the problem.
In an AS shown in Figure 1-1712, one router functions as a Route Reflector (RR), with some other routers as its clients. The clients establish IBGP connections with the RR. The RR and its clients form a cluster. The RR reflects routes among clients, and BGP connections do not need to be established between the clients.
A BGP peer that functions as neither an RR nor a client is called a non-client. A non-client must establish fully meshed connections with the RR and all the other non-clients.
Application
After receiving routes from peers, an RR selects the optimal route based on BGP route selection rules and advertises the optimal route to other peers based on the following rules:
If the optimal route is from a non-client IBGP peer, the RR advertises the route to all clients.
If the optimal route is from a client, the RR advertises the route to all non-clients and clients.
If the optimal route is from an EBGP peer, the RR advertises the route to all clients and non-clients.
An RR is easy to configure because it only needs to be configured on the router that needs to function as an RR, and clients do not need to know whether they are clients.
On some networks, if fully meshed connections have already been established among clients of an RR, they can exchange routing information directly. In this case, route reflection among the clients through the RR is unnecessary and occupies bandwidth. For example, on the NetEngine 8100 M, NetEngine 8000E M, NetEngine 8000 M, route reflection through the RR can be disabled, but the routes between clients and non-clients can still be reflected. By default, route reflection between clients through the RR is enabled.
On the NetEngine 8100 M, NetEngine 8000E M, NetEngine 8000 M, an RR can change various attributes of BGP routes, such as the AS_Path, MED, Local_Pref, and community attributes.
Originator_ID
Originator_ID and Cluster_List are used to detect and prevent routing loops.
The Originator_ID attribute is four bytes long and is generated by an RR. It carries the router ID of the route originator in the local AS.
When a route is reflected by an RR for the first time, the RR adds the Originator_ID attribute to this route. The Originator_ID attribute is used to identify the router that originates the route. If a route already carries the Originator_ID attribute, the RR does not create a new one.
After receiving the route, a BGP speaker checks whether the Originator_ID is the same as its router ID. If Originator_ID is the same as its router ID, the BGP speaker discards this route.
Cluster_List
To prevent routing loops between ASs, a BGP router uses the AS_Path attribute to record the ASs through which a route passes. Routes with the local AS number are discarded by the router. To prevent routing loops within an AS, IBGP peers do not advertise routes learned from the local AS.
With RR, IBGP peers can advertise routes learned from the local AS to each other. However, the Cluster_List attribute must be deployed to prevent routing loops within the AS.
An RR and its clients form a cluster. In an AS, each RR is uniquely identified by a Cluster_ID.
To prevent routing loops, the RR uses the Cluster_List attribute to record the Cluster_IDs of all RRs through which a route passes.
Similar to an AS_Path, which records all the ASs through which a route passes, a Cluster_List is composed of a series of Cluster_IDs and records all RRs through which a route passes. The Cluster_List is generated by the RR.
Before an RR reflects a route between its clients or between its clients and non-clients, the RR adds the local Cluster_ID to the head of the Cluster_List. If a route does not carry any Cluster_List, the RR creates one for the route.
After the RR receives an updated route, it checks the Cluster_List of the route. If the RR finds that its cluster ID is included in the Cluster_List, the RR discards the route. If its cluster ID is not included in the Cluster_List, the RR adds its cluster ID to the Cluster_List and then reflects the route.
Backup RR
To enhance network reliability and prevent single points of failure, more than one route reflector needs to be configured in a cluster. The route reflectors in the same cluster must share the same Cluster_ID to prevent routing loops. Therefore, the same Cluster_ID must be configured for all RRs in the same cluster.
With backup RRs, clients can receive multiple routes to the same destination from different RRs. The clients then apply BGP route selection rules to choose the optimal route.
On the network shown in Figure 1-1713, RR1 and RR2 are in the same cluster. An IBGP connection is set up between RR1 and RR2. The two RRs are non-clients of each other.
If Client 1 receives an updated route from an external peer, Client 1 advertises the route to RR1 and RR2 through IBGP.
After receiving the updated route, RR1 adds the local Cluster_ID to the top of the Cluster_List of the route and then reflects the route to other clients (Client 1, Client 2, and Client 3) and the non-client (RR2).
After receiving the reflected route, RR2 checks the Cluster_List and finds that its Cluster_ID is contained in the Cluster_List. In this case, it discards the updated route and does not reflect it to its clients.
If RR1 and RR2 are configured with different Cluster_IDs, each RR receives both the routes from its clients and the updated routes reflected by the other RR. Therefore, configuring the same Cluster_ID for RR1 and RR2 reduces the number of routes that each RR receives and memory consumption.
The application of Cluster_List prevents routing loops among RRs in the same AS.
Multiple Clusters in an AS
Multiple clusters may exist in an AS. RRs are IBGP peers of each other. An RR can be configured as a client or non-client of another RR. Therefore, the relationship between clusters in an AS can be configured flexibly.
For example, a backbone network is divided into multiple reflection clusters. Each RR has other RRs configured as its non-clients, and these RRs are fully meshed. Each client establishes IBGP connections only to the RR in the same cluster. In this manner, all BGP peers in the AS can receive reflected routes. Figure 1-1714 shows the networking.
Hierarchical Reflector
Hierarchical reflectors are usually deployed if RRs need to be deployed. On the network shown in Figure 1-1715, the ISP provides Internet routes for AS 100. Two EBGP connections are established between the ISP and AS 100. AS 100 is divided into two clusters. The four routers in Cluster 1 are core routers.
Two Level-1 RRs (RR-1s) are deployed in Cluster 1, which ensures the reliability of the core layer of AS 100. The other two routers in the core layer are clients of RR-1s.
One Level-2 RR (RR-2) is deployed in Cluster 2. RR-2 is a client of RR-1.
Route Server
The route server function is similar to the RR function in IBGP scenarios and allows devices to advertise routes to their clients (ASBR devices) without changing route attributes, such as AS_Path, Nexthop, and MED. With the route server function, EBGP full-mesh connections are not required among the ASBR devices, which reduces network resource consumption.
Application
In some scenarios on the live network, to achieve network traffic interworking, EBGP full-mesh connections may be required. However, establishing full-mesh connections among devices that function as ASBRs is costly and places high requirements on the performance of the devices, which adversely affects the network topology and device expansion. In Figure 1-1717, the route server can advertise routes to all its EBGP peers, without requiring EBGP full-mesh connections among ASBRs. Therefore, the route server function reduces network resource consumption.
BGP VPN Route Leaking
Remote route leaking: After a PE receives a BGP VPNv4/VPNv6 route from a remote PE, the local PE matches the export target (ERT) of the route against the import targets (IRTs) configured for local VPN instances. If the match succeeds, the device converts the BGP VPNv4/VPNv6 route to a BGP VPN route and adds the BGP VPN route to the routing table of the VPN instance.
Local route leaking: A PE matches the ERT of a BGP VPN route in a local VPN instance against the IRTs configured for other local VPN instances. If the ERT matches the IRT of a local VPN instance, the PE adds the BGP VPN route to the routing table of this local VPN instance. Locally leaked routes include locally imported routes, summary routes, and routes learned from VPN peers.
If the routes to be imported from the IP routing table are load balancing routes, regardless of IGP routes or static routes, only the first route is imported.
Local route leaking means that imported routes are copied to the routing tables of other VPN instances.
After receiving the BGP VPNv4 routes from PE2, PE3, and PE4, PE1 adds them to the BGP VPNv4 routing table.
PE1 converts the BGP VPNv4 routes to BGP VPN routes by removing their RDs, adds the BGP VPN routes to the routing table of the VPN instance, selects an optimal route from the BGP VPN routes based on BGP route selection rules, and adds the optimal BGP VPN route to the IP VPN instance routing table.
MP-BGP
Conventional BGP-4 manages only IPv4 unicast routing information, and inter-AS transmission of packets of other network layer protocols, such as multicast, is limited.
To support multiple network layer protocols, the Internet Engineering Task Force (IETF) extends BGP-4 to MP-BGP. MP-BGP is forward compatible. Specifically, routers supporting BGP extensions can communicate with the routers that do not support BGP extensions.
MP-BGP maintains both unicast and multicast routes. It stores them in different routing tables to separate unicast routing information from multicast routing information.
MP-BGP supports both unicast and multicast address families and can build both the unicast routing topology and multicast routing topology.
Most unicast routing policies and configuration methods supported by BGP-4 can be applied to multicast, and unicast and multicast routes can be maintained according to these routing policies.
Extended Attributes
BGP-4 Update packets carry three IPv4-related attributes: NLRI (Network Layer Reachable Information), Next_Hop, and Aggregator. Aggregator contains the IP address of the BGP speaker that performs route summarization.
To support multiple network layer protocols, BGP-4 needs to carry network layer protocol information in NLRI and Next_Hop. MP-BGP introduces the following two route attributes:
MP_REACH_NLRI: indicates the multiprotocol reachable NLRI. It is used to advertise a reachable route and its next hop.
MP_UNREACH_NLRI: indicates the multiprotocol unreachable NLRI. It is used to delete an unreachable route.
The preceding two attributes are optional non-transitive. Therefore, the BGP speakers that do not support MP-BGP will ignore the information carried in the two attributes and do not advertise the information to other peers.
Address Families
The Address Family Information field consists of a 2-byte Address Family Identifier (AFI) and a 1-byte Subsequent Address Family Identifier (SAFI).
BGP uses address families to distinguish different network layer protocols. For the values of address families, see relevant standards. The NetEngine 8100 M, NetEngine 8000E M, NetEngine 8000 M supports multiple MP-BGP extension applications, such as VPN extension and IPv6 extension, which are configured in their respective address family views.
The supported address families are subject to the device.
- For details about how to configure BGP in the IPv4 address family view, see "BGP Configuration." The BGP-IPv4 unicast address family has the following functions:
- Maintains public network BGP peers and transmits public network IPv4 routing information. When the BGP-IPv4 unicast address family transmits public network IPv4 routes, the SAFI is 1.
- Transmits public network labeled IPv4 routes. This function is mainly used in inter-AS BGP/MPLS IP VPN Option C or inter-AS BGP/MPLS IPv6 VPN Option C scenarios. When the BGP-IPv4 unicast address family transmits public network labeled IPv4 routes, the SAFI is 4.
- For details about how to configure BGP in the IPv6 address family view, see "BGP4+ Configuration." The BGP-IPv6 unicast address family has the following functions:
- Maintains public network IPv6 BGP peers and transmits public network IPv6 routing information. When the BGP-IPv6 unicast address family transmits public network IPv6 routes, the SAFI is 1.
- Transmits labeled IPv6 routes in 6PE scenarios. When the BGP-IPv6 unicast address family transmits labeled IPv6 routes, the SAFI is 4.
- Multicast-related address family views, such as the BGP-IPv4 multicast address family view, BGP-MVPN address family view, BGP-IPv6 MVPN address family view, and BGP-MDT address family view, can transmit inter-AS routing information and are mainly used in MBGP, BIER, NG MVPN, BIERv6, and Rosen MVPN scenarios. For details about its application in multicast, see HUAWEI NetEngine 8100 M14/M8, NetEngine 8000 M14K/M14/M8K/M8/M4 & NetEngine 8000E M14/M8 seriesRouter Configuration Guide - IP Multicast.
- The BGP-IPv4 multicast address family is used to configure multicast BGP (MBGP) peers. When a multicast source and receivers are located in different autonomous systems (ASs), an inter-AS multicast distribution tree needs to be established. MBGP can be used to transmit inter-AS routing information for multicast.
- BGP-MVPN address family view: BGP A-D MVPN has two modes: MDT-SAFI A-D and MCAST-VPN SAFI A-D. In both BGP A-D MVPN modes, MVPN configurations, including RDs and Share-Group addresses, are transmitted between BGP peers to discover PE peer information. In this manner, MVPN services can run on public network tunnels based on PIM-SSM MDTs. Of the two modes, the MCAST-VPN SAFI A-D mode has a broader definition, supports more extensions, and carries more MVPN attributes and information for establishing public network tunnels. Therefore, the MCAST-VPN SAFI A-D mode can be used to support the next-generation MVPN.
- The BGP-MDT address family is mainly used in PIM-SSM scenarios. It is used to transmit Share-Group source and group information on PEs through BGP sessions between the PEs. The following problems may occur in actual applications: To deploy PIM SSM on the public network, you must know the source address. The Share-Group is configured on a PE, but the PE does not know the multicast source addresses (addresses of MT interfaces) corresponding to the Share-Groups on other PEs. All PEs in a multicast domain (MD) select an interface address that is used to establish the public network BGP peer relationship as the multicast source IP address.
- VPN-related address family views, such as the BGP-VPNv4 address family view, BGP-VPNv6 address family view, BGP-VPN instance view, BGP multi-instance VPN instance view, BGP-L2VPN-AD address family view, and BGP-L2VPN-AD address family view, are mainly used in BGP/MPLS IP VPN, VPWS, and VPLS scenarios. For details, see HUAWEI NetEngine 8100 M14/M8, NetEngine 8000 M14K/M14/M8K/M8/M4 & NetEngine 8000E M14/M8 seriesRouter Feature Description - VPN.
- The BGP-VPNv4 address family is mainly used to establish BGP VPNv4 peer relationships between PEs to exchange VPNv4 routes in BGP/MPLS IP VPN scenarios. In BGP VPNv4 extension, after a PE receives a CE's local VPN routes, the PE adds a route distinguisher (RD) and an export route target (ERT) to these routes and exchanges VPN routes with other PEs through BGP VPNv4 peer relationships. Routes of different VPNs are distinguished by RD on the public network, and import of routes from different CEs is controlled by RT. A PE maintains only the routing information about the VPNs that are directly connected to the PE but does not maintain all VPN routes on the service provider network.
- The BGP-VPNv6 address family is mainly used in BGP/MPLS IPv6 VPN scenarios where PEs establish BGP VPNv6 peer relationships to exchange VPNv6 routes. In BGP VPNv6 extension, after a PE receives a CE's local IPv6 routes, the PE adds an RD and an RT to the routes and exchanges VPN routes with its BGP VPNv6 peers. Routes of different VPNs are distinguished by RD on the public network, and import of routes from different CEs is controlled by RT. A PE maintains only the routing information about the VPNs that are directly connected to the PE but does not maintain all VPN routes on the service provider network.
- The BGP VPN instance IPv4 address family is mainly used in BGP/MPLS IP VPN scenarios where PEs and CEs use BGP to exchange VPN IPv4 routes.
- The BGP VPN instance IPv6 address family is mainly used in BGP/MPLS IPv6 VPN scenarios where PEs and CEs use IPv6 BGP to exchange VPN IPv6 routes.
- The BGP-L2VPN address family is used to manage L2VPN label blocks. MPLS/L2VPN can be implemented in multiple modes. BGP can be used as the exchange signaling. Similar to MPLS L3VPN, MPLS/L2VPN allows PEs to automatically discover L2VPN nodes and transmit VPN information through BGP sessions and use VPN targets to differentiate VPNs.
- The BGP L2VPN-AD address family is mainly used to configure BGP AD VPLS. In this address family, information about BGP AD VPLS members is exchanged. BGP AD VPLS combines the advantages of multiple VPLS signaling modes. It uses extended BGP messages to discover VSI members and uses LDP FEC 129 to negotiate PW establishment to implement automatic VPLS PW deployment.
- VPLS is a point-to-multipoint L2VPN service provided on a public network. The BGP-VPLS address family is mainly used in VPLS scenarios. After BGP peer relationships are established in the BGP-VPLS address family view of PEs, BGP is used to exchange VPLS label block information.
- The BGP-VPN-Target address family is mainly used to configure VPN ORF. VPN ORF enables a PE to receive only desired routes, which reduces the pressure on the routing tables of the PE, the intra-AS RR, and inter-AS ASBR.
- EVPN-related address families, such as the BGP-EVPN address family view and BGP multi-instance EVPN address family view, are mainly used to configure BGP EVPN peers and apply to EVPN VPLS, EVPN VPWS, and EVPN L3VPN. EVPN is a VPN technology used for Layer 2 network interworking. EVPN is similar to BGP/MPLS IP VPN. EVPN defines a new type of BGP network layer reachability information (NLRI), called the EVPN NLRI. The EVPN NLRI defines new types of BGP EVPN routes to implement MAC address learning and advertisement between Layer 2 networks at different sites. For details, see HUAWEI NetEngine 8100 M14/M8, NetEngine 8000 M14K/M14/M8K/M8/M4 & NetEngine 8000E M14/M8 seriesRouter Feature Description - VPN - EVPN Feature Description.
- The BGP IPv4 SR Policy address family view and BGP IPv6 SR Policy address family view are mainly used in Segment Routing MPLS and Segment Routing IPv6 scenarios. For details, see HUAWEI NetEngine 8100 M14/M8, NetEngine 8000 M14K/M14/M8K/M8/M4 & NetEngine 8000E M14/M8 seriesRouter Feature Description - Segment Routing.
- Flow-related address family views, such as the BGP-Flow address family view, BGP-Flow VPNv4 address family view, BGP-Flow VPNv6 address family view, BGP-Flow VPN instance IPv4 address family view, and BGP-Flow VPN instance IPv6 address family view are mainly used to defend against DoS/DDoS attacks and improve network security and availability. For details, see HUAWEI NetEngine 8100 M14/M8, NetEngine 8000 M14K/M14/M8K/M8/M4 & NetEngine 8000E M14/M8 seriesRouter Feature Description - Security - BGP Flow Specification Feature Description.
- The BGP-labeled address family view and BGP-labeled-VPN instance IPv4 address family view are mainly used for carrier configuration using the BGP label distribution solution. For details, see HUAWEI NetEngine 8100 M14/M8, NetEngine 8000 M14K/M14/M8K/M8/M4 & NetEngine 8000E M14/M8 seriesRouter Configuration - VPN - BGP/MPLS IP VPN Configuration and HUAWEI NetEngine 8100 M14/M8, NetEngine 8000 M14K/M14/M8K/M8/M4 & NetEngine 8000E M14/M8 seriesRouter Configuration - VPN - EVPN Configuration.
- The BGP-LS address family view is mainly used to summarize the topology information collected by an IGP and send the information to the upper-layer controller. For details, see HUAWEI NetEngine 8100 M14/M8, NetEngine 8000 M14K/M14/M8K/M8/M4 & NetEngine 8000E M14/M8 seriesRouter Feature Description - BGP Feature Description - BGP-LS.
BGP Security
BGP Authentication
BGP can work properly only after BGP peer relationships are established. Authenticating BGP peers can improve BGP security. BGP supports the following authentication modes:
MD5 authentication
BGP uses TCP as the transport layer protocol. Message Digest 5 (MD5) authentication can be used when establishing TCP connections to improve BGP security. MD5 authentication sets the MD5 authentication password for the TCP connection, and TCP performs the authentication. If the authentication fails, the TCP connection cannot be established.
The encryption algorithm used for MD5 authentication poses security risks. Therefore, you are advised to use an authentication mode based on a more secure encryption algorithm.
Keychain authentication
Keychain authentication is performed at the application layer. It prevents service interruptions and improves security by periodically changing the password and encryption algorithms. When keychain authentication is configured for BGP peer relationships over TCP connections, BGP messages as well as the process of establishing TCP connections can be authenticated. For details about keychain, see "Keychain" in HUAWEI NetEngine 8100 M14/M8, NetEngine 8000 M14K/M14/M8K/M8/M4 & NetEngine 8000E M14/M8 series Feature Description - Security.
- TCP-AO authentication
The TCP authentication option (TCP-AO) is used to authenticate received and to-be sent packets during TCP session establishment and data exchange. It supports packet integrity check to prevent TCP replay attacks. TCP-AO authentication improves the security of the TCP connection between BGP peers and is applicable to the network that requires high security.
BGP GTSM
During network attacks, attackers may simulate BGP messages and continuously send them to the router. If the messages are destined for the router, it directly forwards them to the control plane for processing without validating them. As a result, the increased processing workload on the router's control plane results in high CPU usage. The Generalized TTL Security Mechanism (GTSM) defends against attacks by checking the time to live (TTL) value in each packet header. TTL refers to the maximum number of routers through which a packet can pass.
GTSM checks whether the TTL value in each IP packet header is within a pre-defined range, which protects services above the IP layer and improves system security.
After a GTSM policy of BGP is configured, an interface board checks the TTL values of all BGP messages. According to actual networking requirements, you can set the default action (to drop or pass) that GTSM will take on the messages whose TTL values are not within a pre-defined range. If a valid TTL range is specified based on the network topology and the default action that GTSM will take is set to drop, the BGP messages whose TTL values are not within the valid range are discarded directly by the interface board upon receipt. This prevents bogus BGP messages from consuming CPU resources.
You can enable the logging function so that the device can record information about message dropping in logs. The recorded logs facilitate fault locating.
BGP RPKI
Resource Public Key Infrastructure (RPKI) ensures BGP security by verifying the validity of the BGP route source AS or route advertiser.
Attackers can steal user data by advertising routes that are more specific than those advertised by carriers. RPKI can resolve this problem. For example, if a carrier has advertised a route destined for 10.10.0.0/16, an attacker can advertise a route destined for 10.10.153.0/24, which is more specific than 10.10.0.0/16. According to the longest match rule, the route 10.10.153.0/24 is preferentially selected for traffic forwarding. As a result, the attacker succeeds in illegally obtaining user data.
To solve the preceding problems, you can configure Route Origin Authorization (ROA) and regional validation to ensure BGP security.
ROA
ROA stores the mapping between prefix addresses and the origin AS and checks whether the routes with a specified IP address prefix are valid by verifying the AS number.
In Figure 1-1721, a connection is created between Device B and the RPKI server. Device B can download the ROA database from the RPKI database and verify the mapping between 10.1.1.0/24 and AS 100. When AS 200 receives a route with the prefix 10.1.1.0/24 from AS 100 and AS 300, it compares the origin AS with that in the ROA database. If they are the same, the route is considered valid. If they are different, the route is considered invalid. The route to 10.1.1.0/24 learned from AS 100 is valid because it matches the ROA database, and the route advertisement from the origin AS 100 is considered valid. The route to 10.1.1.0/24 learned from AS 300 is invalid because it does not match the ROA database, and the route advertisement from the origin AS 300 is considered invalid.
If no RPKI server is available, a static ROA database can be configured for Device B. In this way, ROA validation can be implemented based on the static ROA database, without relying on an RPKI server, thereby preventing route hijacking to a certain extent.
The ROA validation results for received routes are as follows:
- Valid: indicates that the route advertisement from the origin AS to the specified IP address prefix is valid.
- Invalid: indicates that the route advertisement from the origin AS to the specified IP address prefix is invalid and that the route is not allowed to participate in route selection.
- Not Found: indicates that the origin AS does not exist in the ROA database and that the route participates in route selection.
In addition, ROA validation can be applied to the routes to be advertised to an EBGP peer, which prevents route hijacking. In Figure 1-1722, Device B is configured to perform ROA validation on the routes to be advertised. Before advertising a route that matches the export policy to an EBGP peer, Device B performs ROA validation on the route by matching the origin AS of the route against that of the corresponding route in the ROA database. If the route is not found in the ROA database, the validation result is Not Found. If the route is found in the ROA database and the origin AS of the route is the same as that of the corresponding route in the ROA database, the validation result is Valid. If the origin AS of the route is different from that of the corresponding route in the ROA database, the validation result is Invalid. If the validation result is Valid, the route is advertised by default. If the validation result is Not Found, the route is not advertised by default. If the validation result is Invalid, the route is not advertised by default and an alarm is generated; the alarm is cleared when all routes with the validation result of Invalid are withdrawn.
Regional validation
Regional validation: Users can manually configure regions by combining multiple trusted ASs into a region and combining multiple regions into a regional confederation. Regional validation controls route selection results by checking whether the routes received from EBGP peers in an external region belong to the local region. This prevents intra-region routes from being hijacked by attackers outside the local region, and ensures that hosts in the local region can securely access internal services.
Regional validation applies to the following typical scenarios: regional validation scenario and regional confederation validation scenario.
- As shown in Figure 1-1723, AS 1, AS 2, and AS 3 belong to a carrier's network, and AS 3 connects to AS 100 of another carrier's network. The user accesses the server at 10.1.0.0/16 in AS 2 through AS 1. In normal cases, the user accesses the server through the path AS 1 -> AS 3 -> AS 2. If an attacker forges a route 10.1.1.0/24 in AS 100, the user-to-server traffic will be illegally obtained by the attacker because the route advertised by the attacker is more specific. To solve this problem, configure regional validation on the border device of AS 3 to combine AS 1, AS 2, and AS 3 into region 1. AS 3 receives the attack route from AS 100, and the route source is AS 2, indicating that the route belongs to the local region. However, as the route is received from the BGP peer outside region 1, the route is considered illegal by regional validation. As a result, the route is set to be invalid, or the preference of the route is reduced.
- As shown in Figure 1-1724, AS 1, AS 2, and AS 3 belong to a carrier's network, and AS 4 and AS 5 belong to a partner carrier's network. Both AS 3 and AS 4 are connected to AS 100 of another carrier. The user accesses the server at 10.1.0.0/16 in AS 5 through AS 1. In normal cases, the user accesses the server through the path AS 1 -> AS 3 -> AS 4 -> AS 5. If an attacker forges a route 10.1.1.0/24 in AS 100, the user-to-server traffic will be illegally obtained by the attacker because the route advertised by the attacker is more specific. To solve this problem, configure regional validation on the border device of AS 3. Specifically, combine AS 1, AS 2, and AS 3 into region 1, and AS 4 and AS 5 into region 2, and then group the regions 1 and 2 into regional confederation 1. AS 3 receives the attack route from AS 100, and the route source is AS 5, indicating that the route belongs to the local regional confederation. However, as the route is received from the BGP peer outside the regional confederation, the route is considered illegal by regional validation. As a result, the route is set to be invalid, or the preference of the route is reduced.
SSL/TLS Authentication
Secure Sockets Layer (SSL) is a security protocol that protects data privacy on the Internet. Transport Layer Security (TLS) is a successor of SSL. TLS protects data integrity and privacy by preventing attackers from eavesdropping the data exchanged between a client and server. To ensure data transmission security on a network, SSL/TLS authentication can be enabled for BGP message encryption.
BGP GR
Graceful restart (GR) is one of the high availability (HA) technologies, which comprise a series of comprehensive technologies such as fault-tolerant redundancy, link protection, faulty node recovery, and traffic engineering. As a fault-tolerant redundancy technology, GR ensures normal forwarding of data during the restart of routing protocols to prevent interruption of key services. Currently, it has been widely applied to the active/standby switchover and system upgrade.
GR is usually used when the active route processor (RP) fails because of a software or hardware error, or used by an administrator to perform the active/standby switchover.
You are not advised to configure both BFD and BGP GR on the same device. If both are configured and a BFD session detects a fault on an interface, the session exits GR. As a result, traffic forwarded based on GR is interrupted, which may cause network problems.
Prerequisite for Implementation
On a traditional device, a processor implements both control and forwarding. The processor finds routes based on routing protocols, and maintains the routing table and forwarding table of the device. Mid-range and high-end devices generally adopt the multi-RP structure to improve forwarding performance and reliability. The processor in charge of routing protocols is located on the main control board, whereas the processor responsible for data forwarding is located on the interface board. The design helps to ensure the continuity of packet forwarding on the interface board during the restart of the main processor. The technology that separates control from forwarding satisfies the prerequisite for GR implementation.
Currently, a GR-capable device must have two main control boards. In addition, the interface board must have an independent processor and memory.
Related Concepts
GR Restarter: indicates a device that performs an active/standby switchover triggered by the administrator or a failure. A GR Restarter must support GR.
- Force-Quit timer: indicates the timer used to exit GR forcibly in a scenario where the device cannot exit GR automatically due to internal errors.
- Protection timer: indicates the timer used for protection in a scenario where no peers are up.
- Wait-All-Peer-Up timer: indicates the timer used for waiting for all peers to go up in a scenario where some peers are not up.
- Selection-Deferral timer: indicates the timer used for protection in a scenario where a Helper does not send End-of-RIB (EOR) messages.
- EOR Timer: indicates the maximum period during which a GR Restarter waits for EOR messages from a GR Helper. If a GR Restarter does not receive any EOR message from a GR Helper within the EOR timer, the GR Restarter selects routes based on the existing routes.
GR Helper: indicates a peer of a GR Restarter. A GR Helper must support GR.
- GR timer: indicates the period during which a GR Helper retains the topology information or routes obtained from a GR Restarter after the GR Helper finds that the GR Restarter is down.
- EOR timer: indicates the maximum period during which a GR Helper waits for EOR messages from a GR Restarter. If a GR Helper does not receive any EOR message from a GR Restarter within the EOR timer, the GR Helper selects routes based on the existing routes.
GR session: indicates a session, through which a GR Restarter and a GR Helper negotiate GR capabilities.
EOR: indicates a type of BGP message used to notify a peer that the first route upgrade after BGP session establishment is complete.
Fundamentals
During BGP peer relationship establishment, devices negotiate GR capabilities by sending supported GR capabilities to each other.
When detecting that the GR Restarter is down, the GR Helper starts the GR timer and waits for the Restarter to go up.
- Before the GR timer expires, the device retains the routes and forwarding entries related to the GR Restarter until the GR Restarter goes up. The process then goes to Step 3.
- When the GR timer expires, the device deletes the routes and forwarding entries related to the GR Restarter and exits the GR Helper state.
- After the GR Restarter goes up, the GR Helper receives routes from the GR Restarter and starts the EOR timer. The GR Helper exits the GR Helper state and ages the routes related to the GR Restarter when one of the following conditions is met:
- The GR Helper receives an EOR message from the GR Restarter, and the EOR timer is deleted.
- The EOR timer expires but the GR Helper fails to receive an EOR message from the GR Restarter.
Fundamentals of a BGP GR Restarter are as follows:
When a BGP process is restarted, a GR-capable device enters the GR Restarter state, starts the Protection timer and Force-Quit timer, and waits for BGP peer relationships to be reestablished.
- After the first BGP peer relationship is established, the Protection timer is deleted, and the process goes to Step 2.
- No BGP peer relationship is established, and the Protection timer expires. In this case, the GR Restarter state exits.
- The GR Restarter continues to wait for the remaining BGP peer relationships to be established, receives routes and EOR messages from the BGP peers with which BGP peer relationships have been established, starts the Wait-All-Peer-Up Timer and Selection-Deferral Timer, and waits for the establishment of all BGP peer relationships and EOR messages. The GR Restarter starts route selection when one of the following conditions is met:
- The BGP peer relationships are established, and the GR Restarter receives EOR messages from the peers.
- The Wait-All-Peer-Up timer expires.
- The Selection-Deferral timer expires.
- After the GR restarter completes route selection, it re-advertises routes to its BGP peers and exits the GR restarter state.
GR Reset
Currently, BGP does not support dynamic capability negotiation. Therefore, each time a capability in an address family (such as the IPv4, IPv6, VPNv4, and VPNv6 address families) is enabled or disabled on a BGP speaker, a BGP speaker tears down existing sessions with the peer and renegotiates capabilities.
In some scenarios, BGP IPv4 unicast peer sessions have been established and IPv4 services are running properly. If a BGP peer relationship in another address family is established based on this session, the BGP IPv4 unicast peer relationship will be re-established, affecting IPv4 services. To solve the preceding problem, the NetEngine 8100 M, NetEngine 8000E M, NetEngine 8000 M provides the function of resetting a BGP connection in GR mode.
With the function of resetting a BGP connection in GR mode, if a BGP peer relationship in another address family is established based on an IPv4 BGP unicast peer session, BGP enters the GR state and renegotiates BGP capabilities with its peer. Throughout the entire process, BGP re-establishes the BGP IPv4 unicast peer session but retains the original routing entries. The forwarding module forwards packets based on the routing entries, thereby ensuring that IPv4 services are not interrupted.
Benefits
Through BGP GR, the forwarding is not interrupted. In addition, the flapping of BGP occurs only on the peers of the GR Restarter, and does not occur in the entire routing domain. This is important for BGP that needs to process a large number of routes.
BFD for BGP
BGP periodically sends Keepalive messages to a peer to monitor its status, but this mechanism takes an excessively long time, more than 1 second, to detect a fault. If data is transmitted at Gbit/s rates, such a lengthy detection period will result in a large amount of data being lost, making it impossible to meet the high reliability requirements of carrier-grade networks.
To address this issue, BFD for BGP has been introduced. Specifically, BFD is used to quickly detect faults on links between BGP peers (usually within milliseconds) and notify BGP of the faults, thereby accelerating BGP route convergence.
You are not advised to configure both BFD and BGP GR on the same device. If both are configured and a BFD session detects a fault on an interface, the session exits GR. As a result, traffic forwarded based on GR is interrupted, which may cause network problems.
Fundamentals
On the network shown in Figure 1-1725, DeviceA and DeviceB belong to AS 100 and AS 200, respectively. An EBGP connection is established between the two routers.
BFD is used to monitor the BGP peer relationship between DeviceA and DeviceB. If the link between them becomes faulty, BFD can quickly detect the fault and notify it to BGP.
On the network shown in 2, indirect multi-hop EBGP connections are established between DeviceA and DeviceC and between DeviceB and DeviceD; a BFD session is established between DeviceA and DeviceC; a BGP peer relationship is established between DeviceA and DeviceB; the bandwidth between DeviceA and DeviceB is low. If the original forwarding path DeviceA->DeviceC goes faulty, traffic that is sent from DeviceE to DeviceA is switched to the path DeviceA->DeviceB->DeviceD->DeviceC. Due to low bandwidth on the link between DeviceA and DeviceB, traffic loss may occur on this path.
BFD for BGP TTL check applies only to the scenario in which DeviceA and DeviceC are indirectly connected EBGP peers.
To prevent this issue, you can set a TTL value on DeviceC for checking the BFD session with DeviceA. If the number of forwarding hops of a BFD packet (TTL value in the packet) is smaller than the TTL value set on DeviceC, the BFD packet is discarded, and BFD detects a session down event and notifies BGP. DeviceA then sends BGP Update messages to DeviceE for route update so that the traffic forwarding path can change to DeviceE->DeviceF->DeviceB->DeviceD->DeviceC. For example, the TTL value for checking the BFD session on DeviceC is set to 254. If the link between DeviceA and DeviceC fails, traffic sent from DeviceE is forwarded through the path DeviceA->DeviceB->DeviceD->DeviceC. In this case, the TTL value in a packet decreases to 252 when the packet reaches DeviceC. Since 252 is smaller than the configured TTL value 254, the BFD packet is discarded, and BFD detects a session down event and notifies BGP. DeviceA then sends BGP Update messages to DeviceE for route update so that the traffic forwarding path can change to DeviceE->DeviceF->DeviceB->DeviceD->DeviceC.
BGP Peer Tracking
BGP peer tracking provides quick detection of link or peer faults for BGP to speed up network convergence. If BGP peer tracking is enabled on a local device and a fault occurs on the link between the device and its peer, BGP peer tracking can quickly detect that routes to the peer are unreachable and notify BGP of the fault, thereby achieving rapid convergence.
Compared with BFD, BGP peer tracking is easy to configure because it needs to be configured only on the local device rather than on the entire network. Although both are fault detection mechanisms, BGP peer tracking is implemented at the network layer, whereas BFD is implemented at the link layer. For this reason, BGP peer tracking provides a slower convergence performance than BFD, making it inapplicable to services that require a rapid convergence, such as voice services.
Networking
BGP peer tracking can quickly detect link or peer faults by checking whether routes to peers exist in the IP routing table. If no route is found in the IP routing table based on the IP address of a BGP peer (or a route exists but is unreachable, for example, the outbound interface is a Null0 interface), the BGP session goes down, achieving fast BGP route convergence. If a reachable route can be found in this case, the BGP session does not go down.
On the network shown in Figure 1-1727, IGP connections are established between DeviceA, DeviceB, and DeviceC, a BGP peer relationship is established between DeviceA and DeviceC, and BGP peer tracking is configured on DeviceA. If the link between DeviceA and DeviceB fails, the IGP performs fast convergence first. As no route is found on DeviceA based on the IP address of DeviceC, BGP peer tracking detects that no reachable route to DeviceC is available and then notifies BGP on DeviceA of the fault. As a result, DeviceA terminates the BGP connection with DeviceC.
- If a default route exists on DeviceA and the link between DeviceA and DeviceB fails, BGP peer tracking will not terminate the peer relationship between DeviceA and DeviceC. This is because DeviceA can find the default route in the IP routing table based on the peer's IP address.
- If DeviceA and DeviceC establish an IBGP peer relationship, you are advised to enable BGP peer tracking on both devices to ensure that the peer relationship can be terminated soon after a fault occurs.
- If establishing a BGP peer relationship depends on IGP routes, you need to configure how long BGP peer tracking waits after detecting peer unreachability before it terminates the BGP connection. The configured length of time should be longer than the IGP route convergence time. Otherwise, before IGP route flapping caused by intermittent disconnection is suppressed, the BGP peer relationship may have been terminated. This results in unnecessary BGP convergence.
BGP 6PE
Background
With the wide application of IPv6 technologies, more and more separate IPv6 networks emerge. IPv6 provider edge (6PE), a technology designed to provide IPv6 services over IPv4 networks, allows service providers to provide IPv6 services without constructing new IPv6 backbone networks. The 6PE solution connects separate IPv6 networks using MPLS tunnels on IPv4 networks. The 6PE solution implements IPv4/IPv6 dual stack on the PEs of Internet service providers (ISPs) and uses MP-BGP to assign labels to IPv6 routes. In this manner, the 6PE solution connects separate IPv6 networks over IPv4 tunnels between PEs.
Related Concepts
Intra-AS 6PE: Separate IPv6 networks are connected to the same AS. PEs in the AS exchange IPv6 routes through MP-IBGP peer relationships.
Inter-AS 6PE Option B (with ASBRs as PEs): ASBRs in different ASs exchange IPv6 routes through MP-EBGP peer relationships.
Inter-AS 6PE Option B: ASBRs in different ASs exchange IPv6 labeled routes through MP-EBGP peer relationships.
Inter-AS 6PE Option C: PEs in different ASs exchange IPv6 labeled routes through multi-hop MP-EBGP peer relationships.
Intra-AS 6PE
Figure 1-1728 shows intra-AS 6PE networking. 6PE runs on the edge of an ISP network. PEs that connect to IPv6 networks use the IPv4/IPv6 dual stack. PEs and CEs exchange IPv6 routes using the IPv6 EBGP or an IGP. PEs exchange routes with each other and with Ps using an IPv4 routing protocol. PEs need to establish tunnels to transparently transmit IPv6 packets. The tunnels mainly include MPLS label switched paths (LSPs) and MPLS Local Ifnet tunnels. By default, LSPs are preferentially selected. If no LSPs are available, MPLS Local Ifnet tunnels are used.
Figure 1-1729 shows an intra-AS 6PE scenario where CE2 sends routes to CE1 and CE1 sends a packet to CE2. I-L indicates the inner label, whereas O-L indicates the outer tunnel label. The outer tunnel label is allocated by MPLS and is used to divert packets to the BGP next hop. The inner label indicates the outbound interface of the packets or the CE to which the packets belong.
- CE2 sends an intra-AS IPv6 route to PE2, its EBGP peer.
- Upon receipt of the IPv6 route from CE2, PE2 changes the next hop of the route to itself, assigns an inner label to the route, and sends the IPv6 labeled route to PE1, its IBGP peer.
- Upon receipt of the IPv6 labeled route from PE2, PE1 recurses the route to a tunnel and delivers information about the route to the forwarding table. Then, PE1 changes the next hop of the route to itself, removes the label from the route, and sends the ordinary IPv6 route to CE1, its EBGP peer.
- CE1 sends an ordinary IPv6 packet to PE1 over a public network IPv6 link.
- Upon receipt of the IPv6 packet from CE1, PE1 searches its forwarding table based on the destination address of the packet, encapsulates the packet with the inner label and outer tunnel label, and sends the IPv6 packet with two labels to PE2 over a public network tunnel.
- Upon receipt of the IPv6 packet with two labels, PE2 removes the two labels and forwards the packet to CE2 over an IPv6 link based on the destination address of the packet.
The route and packet transmission processes show that CEs are unaware of whether the public network is an IPv4 or IPv6 network.
Inter-AS 6PE
Inter-AS 6PE Option B (with ASBRs as PEs)
Figure 1-1730 shows the networking of inter-AS 6PE Option B (with ASBRs as PEs). Inter-AS 6PE Option B (with ASBRs as PEs) is similar to intra-AS 6PE. The only difference is that in the former scenario, ASBRs (shown in Figure 1-1730) establish an EBGP peer relationship. The route and packet transmission processes in an inter-AS 6PE Option B scenario (with ASBRs as PEs) are also similar to those in an intra-AS 6PE scenario. For details, see Figure 1-1729.
Inter-AS 6PE Option B
Figure 1-1731 shows inter-AS 6PE Option B networking. ASBRs exchange labeled routes with each other and with PEs using an IPv4 routing protocol. Tunnels must be established between each PE and the ASBR in the same AS and between ASBRs to transparently transmit IPv6 packets. The tunnels between ASBRs mainly include MPLS LSPs, MPLS Local Ifnet tunnels, GRE tunnels, and MPLS TE tunnels. By default, LSPs are preferentially selected. If no LSPs are available, MPLS Local Ifnet tunnels are used. To use MPLS TE or GRE tunnels, configure a tunnel policy on the ASBRs.
Figure 1-1732 shows the inter-AS 6PE Option B scenario where CE2 sends routes to CE1 and CE1 sends packets to CE2. I-L indicates the inner label, whereas O-L indicates the outer tunnel label.
The route transmission process in an inter-AS 6PE Option B scenario is as follows:- CE2 sends an intra-AS IPv6 route to PE2, its EBGP peer.
- Upon receipt of the IPv6 route from CE2, PE2 changes the next hop of the route to itself, assigns an inner label to the route, and sends the IPv6 labeled route to ASBR2, its IBGP peer.
- Upon receipt of the IPv6 labeled route from PE2, ASBR2 recurses the route to a tunnel and delivers the route to the forwarding table. Then, ASBR2 changes the next hop of the route to itself, allocates a new inner label to the route, and sends the route to ASBR1, its EBGP peer.
- Upon receipt of the IPv6 labeled route from ASBR2, ASBR1 recurses the route to a tunnel and delivers the route to the forwarding table. Then, ASBR1 changes the next hop of the route to itself, allocates a new inner label to the route, and sends the route to PE1, its IBGP peer.
- Upon receipt of the IPv6 labeled route from ASBR1, PE1 recurses the route to a tunnel and delivers the route to the forwarding table. Then, PE1 changes the next hop of the route to itself, removes the label from the route, and sends the ordinary IPv6 route to CE1, its EBGP peer.
The packet forwarding process in an inter-AS 6PE Option B scenario is as follows:- CE1 sends an ordinary IPv6 packet to PE1 over a public network IPv6 link.
- Upon receipt of the IPv6 packet from CE1, PE1 searches its forwarding table based on the destination address of the packet, encapsulates the packet with the inner label and outer tunnel label, and sends the IPv6 packet with two labels to ASBR1 over an intra-AS public network LSP.
- Upon receipt of the packet from PE1, ASBR1 removes the two labels from the packet, searches its forwarding table based on the destination address of the packet, encapsulates the packet with a new inner label and outer tunnel label, and sends the IPv6 packet to ASBR2 over an inter-AS public network tunnel.
- Upon receipt of the packet from ASBR1, ASBR2 removes the two labels from the packet, searches its forwarding table based on the destination address of the packet, encapsulates the packet with a new inner label and outer tunnel label, and sends the IPv6 packet to PE2 over an intra-AS public network LSP.
- Upon receipt of the IPv6 packet with two labels, PE2 removes the two labels and forwards the packet to CE2 over an IPv6 link based on the destination address of the packet.
Inter-AS 6PE Option C
Figure 1-1733 shows inter-AS 6PE Option C networking. The difference between inter-AS 6PE Option B and inter-AS 6PE Option C is as follows: in an inter-AS 6PE Option C scenario, PEs establish a multi-hop MP-EBGP peer relationship, exchange labeled routes using an IPv4 routing protocol, and transparently transmit IPv6 packets over an end-to-end BGP LSP between the PEs.Two inter-AS 6PE Option C solutions are available, depending on the establishment methods of end-to-end LSPs. In an inter-AS 6PE Option C scenario, PEs establish a multi-hop MP-EBGP peer relationship to exchange IPv6 labeled routes and establish an end-to-end BGP LSP to transmit IPv6 packets. The way in which the end-to-end BGP LSP is established does not matter much to inter-AS 6PE Option C and therefore is not described here.
Figure 1-1734 shows the inter-AS 6PE Option C scenario where CE2 sends routes to CE1 and CE1 sends packets to CE2. I-L indicates an inner label, B-L indicates a BGP LSP label, and O-L indicates an outer tunnel label.In Figure 1-1734, the following two assumptions are made for clearer description:- An MPLS local Ifnet tunnel is established between the two ASBRs.
- MPLS does not use the penultimate hop popping (PHP) function.
The route transmission process in an inter-AS 6PE Option C scenario is as follows:- CE2 sends an intra-AS IPv6 route to PE2, its EBGP peer.
- Upon receipt of the IPv6 route from CE2, PE2 changes the next hop of the route to itself, assigns an inner label to the route, and sends the IPv6 labeled route to PE1, its MP-EBGP peer.
- Upon receipt of the IPv6 labeled route from PE2, PE1 recurses the route to a tunnel and delivers information about the route to the forwarding table. Then, PE1 changes the next hop of the route to itself, removes the label from the route, and sends the ordinary IPv6 route to CE1, its EBGP peer.
The packet forwarding process in an inter-AS 6PE Option C scenario is as follows:- CE1 sends an ordinary IPv6 packet to PE1 over a public network IPv6 link.
- Upon receipt of the IPv6 packet from CE1, PE1 searches its forwarding table based on the destination address of the packet, changes the next hop of the packet, encapsulates the packet with an inner label, a BGP LSP label, and an outer tunnel label, and sends the IPv6 packet to P1 over an intra-AS public network tunnel.
- Upon receipt of the IPv6 packet from PE1, P1 removes the outer label, adds a new outer label to the packet, and forwards the packet with three labels to ASBR1 over an intra-AS public network tunnel.
- Upon receipt of the IPv6 packet from P1, ASBR1 removes the outer label and BGP LSP label, encapsulates a new BGP LSP label into the IPv6 packet, and forwards the IPv6 packet with two labels to ASBR2 over the inter-AS public network tunnel.
- Upon receipt of the IPv6 packet from ASBR1, ASBR2 removes the BGP LSP label, encapsulates the packet with a new outer label, and forwards the IPv6 packet with two labels to P2 over an intra-AS public network tunnel.
- Upon receipt of the IPv6 packet from ASBR2, P2 removes the outer label from the packet, encapsulates the packet with a new outer label, and forwards the packet with two labels to PE2 over an intra-AS public network tunnel.
- Upon receipt of the IPv6 packet with two labels, PE2 removes the two labels and forwards the packet to CE2 over an IPv6 link based on the destination address of the packet.
Usage Scenario
Each 6PE mode has its advantages and usage scenarios. Intra-AS 6PE applies to scenarios where separate IPv6 networks connect to the same AS. Inter-AS 6PE applies to scenarios where separate IPv6 networks connect to different ASs. Table 1-678 lists the usage scenarios of inter-AS 6PE.
Mode |
Characteristic |
Usage Scenario |
---|---|---|
Inter-AS 6PE Option B (with ASBRs as PEs) |
Advantage: The configuration is simple and similar to that for intra-AS 6PE, and additional inter-AS configuration is not required. Disadvantage: The scalability is poor. ASBRs must manage information about all IPv6 labeled routes, which increases the performance requirements on the ASBRs. |
It applies to small networks where different IPv6 networks connect to ASBRs in different ASs. This mode is especially applicable to the scenario where a small number of ASs are spanned. |
Inter-AS 6PE Option B |
Advantage: MPLS tunnels are established segment by segment, reducing management costs. Disadvantage: Information about IPv6 labeled routes is stored and advertised by ASBRs in different ASs. When a large number of IPv6 labeled routes exist, the ASBRs are overburdened and are likely to become fault points. |
It applies to an inter-AS Option B public network with multi-segment tunnels established between PEs in different ASs that are connected to separate IPv6 networks. |
Inter-AS 6PE Option C |
Advantage: IPv6 labeled routes are directly exchanged between the ingress and egress PEs and do not need to be stored or forwarded by transit devices. Information about IPv6 labeled routes is managed by PEs only, and ASBRs are no longer route capacity bottlenecks. Disadvantage: Maintaining an end-to-end BGP LSP connection is costly. |
It applies to an inter-AS Option C public network with E2E tunnels established between PEs in different ASs that are connected to separate IPv6 networks. This solution is recommended when multiple ASs are spanned. |
Benefits
6PE offers the following benefits:
Easy maintenance: All configurations are performed on PEs, and IPv6 networks are unaware of the IPv4 network. The existing IPv4 network is used to carry IPv6 services, simplifying network maintenance.
Low network construction cost: Carriers can make full use of the existing MPLS network resources and provide IPv6 services for users without upgrading the network. 6PE devices can also provide various types of services, such as IPv6 VPN and IPv4 VPN services.
BGP ORF
Outbound Route Filtering (ORF) is used to enable a BGP device to send the local routing policy to its BGP peer. The peer can use the local routing policy to filter out unwanted routes before route advertisement.
In most cases, users expect the carrier to send them only the routes they require. Therefore, the carrier needs to maintain a separate outbound policy for each user. ORF allows carriers to send only required routes to each user without maintaining a separate outbound policy for each user. ORF supports on-demand route advertisement, which greatly reduces bandwidth consumption and the manual configuration workload.
Prefix-based ORF, defined in standard protocols, can be used to send prefix-based inbound policies configured by users to a carrier through Route-Refresh packets. The carrier then filters out unwanted routes before route advertisement based on the received inbound policies, which prevents users from receiving a large number of unwanted routes and saves resources.
Applications
On the network shown in Figure 1-1735, DeviceA and DeviceB are directly connected, and prefix-based ORF is enabled on them; after negotiating the prefix-based ORF capability with DeviceB, DeviceA adds the local prefix-based inbound policy to a Route-Refresh packet and then sends the Route-Refresh packet to DeviceB. DeviceB uses the information in the packet to work out an outbound policy to advertise routes to DeviceA.
As shown in Figure 1-1736, DeviceA and DeviceB are clients of the RR in the domain. Prefix-based ORF is enabled on all three NEs. After negotiating prefix-based ORF with the RR, DeviceA and DeviceB add the local prefix-based inbound policies Route-Refresh packets and then send the packets to the RR. Based on the Route-Refresh packets, the RR uses the information in the Route-Refresh packets to work out the outbound policies to reflect routes to DeviceA and DeviceB.
VPN ORF
Based on the unified BGP multi-service transport framework, VPN outbound route filtering (ORF) enables RT-MEM-NLRI (VPN ORF route information) to guide route advertisement between VPNv4/VPNv6/NG MVPN/L2VPN-AD peers.
ORF applies a local routing policy to the outbound interface of a peer so that the peer advertises only desired routes to the local device.
VPN ORF enables PEs to receive only wanted routes, reducing pressure on the routing table capacity of route reflectors (RRs) and autonomous system boundary routers (ASBRs).
Background
As networks develop, users keep increasing. The broadcast export policies used by carriers no longer meet user requirements. Users want to receive only required routes, but it is costly for carriers to maintain an export policy for each user. ORF allows users to receive only desired routes, without requiring the carrier to maintain an export policy for each user. In this case, the ORF can meet the requirements of users and carriers.
Related Concepts
- RT-MEM-NLRI: VPN ORF route.
- PE: provider edge
- RR: route reflector
- ASBR: autonomous system boundary router
Implementation
PEs with VPN instances bound send to their BGP peers VPN ORF routes carrying desired import route targets (IRTs) and the original AS number. Based on the VPN ORF routes, the peers generate an export policy for each corresponding PE so that the PE receives only desired routes. This reduces the burden on the PEs.
After VPN ORF is enabled, BGP peer relationships are established in the VPN-Target address family view. In Figure 1-1737, after BGP peer relationships are established between the RR and PE1 and between the RR and PE3, the peers negotiate the VPN ORF capability, PE1 and PE3 send VPN ORF routes carrying required import route targets (IRTs) and original AS number to their VPN ORF peers. The VPN ORF peers construct export policies based on the VPN ORF routes. After receiving the routes with targets 1:1 and 2:2 from PE1, the RR advertises only the routes with the target 1:1 to PE3. After receiving the routes with targets 1:1 and 3:3 from PE3, the RR advertises only the routes with the target 1:1 to PE1.
Usage Scenario
- Intra-AS scenario where a VPN RR has clients
- Inter-AS VPN scenario
- Scenario where some routers do not support VPN ORF
- Intra-AS scenario where an RR has clients and non-clients
Benefits
Reduced bandwidth consumption (because less routes are advertised)
Reduced configuration workload
BGP Auto FRR
As a protection measure against link failures, BGP Auto fast reroute (FRR) is applicable to networks with primary and backup links. With BGP Auto FRR, traffic can be switched between two BGP peers or two next hops within sub-seconds.
With BGP Auto FRR, if a peer has multiple routes with the same prefix that are learned from different peers, it uses the optimal route as the primary link to forward packets and the sub-optimal route as a backup link. If the primary link fails, the peer rapidly notifies other peers that the BGP route has become unreachable and then switches traffic from the primary link to the backup link.
Application
On the network shown in Figure 1-1738, DeviceY advertises a learned BGP route to DeviceB and DeviceC in AS 100; DeviceB and DeviceC then advertise the route to the corresponding RR, which then reflects the route to DeviceA. In this case, DeviceA receives two routes whose next hops are DeviceB and DeviceC. Then, DeviceA selects a route based on a configured routing policy. Assume that the route sent by DeviceB is preferred. The route received through Link B functions as a backup link.
If a node along Link A fails or a fault occurs on Link A, the next hop of the route from DeviceA to DeviceB becomes unavailable. If Auto FRR is enabled on DeviceA, the forwarding plane then quickly switches DeviceA-to-DeviceY traffic to Link B, which ensures uninterrupted traffic transmission. In addition, DeviceA performs route reselection based on prefixes. Consequently, it selects the route sent by DeviceC and then updates its FIB.
BGP NSR
The BGP non-stop routing (NSR) technique ensures the control plane connection to peers and uninterrupted traffic transmission on the forwarding plane if the BGP control plane fails because of active main board (AMB) failures.
Background
Carriers have increasing demands for IP network reliability. Conventional non-stop forwarding (NSF) and graceful restart (GR) techniques cannot prevent traffic interruptions if a peer does not support GR or multiple peers fail simultaneously during a GR process. Traffic is interrupted temporarily before the GR process is complete because a GR-enabled router cannot obtain routing information from or establish control plane connections to its peers during the GR process.
NSR can be used to ensure uninterrupted traffic transmission and retain control plane connections if a software or hardware fault occurs on the control plane of a router. In addition, the fault is transparent to the control planes of its peers.
Related Concepts
- High availability (HA): supports data backup between the AMB and standby main board (SMB).
- NSR: allows a standby control plane to take over traffic from an active control plane if the active control plane fails, preventing the control planes of peers from detecting the fault.
- NSF: enables a node to use the GR mechanism to ensure uninterrupted transmission during an AMB/SMB switchover.
- AMB and SMB: run control plane processes.
Implementation
BGP forwarding entries
BGP control blocks
The AMB and SMB must be installed on an NSR-enabled node to support NSR.
Batch backup
The AMB backs up BGP data in batches to the SMB immediately after the SMB starts.
Real-time backup
The SMB backs up BGP data in real time and receives packets with the AMB simultaneously.
Switchover
If the AMB fails, the SMB takes over services. The SMB retains uninterrupted operation of both the control and forwarding planes because data is synchronous between the AMB and SMB.
For details about NSR, see "Uninterruptible Service Technology" in Feature Description - Reliability.
Other Usages
An NSR device can function as a GR Helper. The GR Helper communicates with NSR-disabled devices and responds to peers' GR requests during an AMB/SMB switchover.
Usage Scenario
- NSR is enabled on a node (for example, PE3 shown in Figure 1-1739) with multiple links among which traffic is load-balanced. NSR helps to prevent traffic interruptions caused by a single point of failure. Figure 1-1739 shows a typical networking for NSR application.
- NSR minimizes the impact of control plane faults and prevents route flapping on heavily loaded networks.
Benefits
- NSR ensures the uninterrupted operation of the forwarding plane and allows a standby control plane to retain connections between a local router and its peers if the local BGP control plane fails.
- With NSR, BGP routers can work independently without the assistance of peers. Even though control planes of multiple BGP routers fail, NSR can still ensure the AMB/SMB switchover on each router.
BGP Dynamic Update Peer-Group
As the routing table increases in size and the network topology increases in complexity, BGP needs to be able to support more peers. When the router needs to send a large number of routes to many BGP peers and most of the peers share the same configuration, if the router groups each route and then send the route to each peer, the efficiency is low.
To improve the efficiency of route advertisement, BGP uses the dynamic update peer-group mechanism. The BGP peers with the same configurations are placed in an update peer-group. These routes are grouped once and then sent to all peers in the update peer-group, improving the grouping efficiency exponentially.
Without the update peer-group feature, a route to be sent has to be grouped separately for each peer. With the update peer-group feature, routes are grouped uniformly and then sent separately. Each route to be sent is grouped only once and then sent to all peers in the update peer-group, which improves the grouping efficiency and forwarding performance exponentially. When a large number of peers and routes exist, BGP dynamic update peer-groups greatly improve the BGP route grouping and forwarding performance.
Usage Scenario
The BGP dynamic update peer-groups feature is applicable to the following scenarios:
Scenario with an international gateway
Scenario with an RR
Scenario where routes received from EBGP peers need to be sent to all IBGP peers
The preceding scenarios have in common that the router needs to send routes to a large number of BGP peers, most of which share the same configuration. This situation is most evident in the networking shown in Figure 1-1741. In addition, when there are a large number of peers and routes, the packet sending efficiency is a performance bottleneck.
The update peer-group feature can overcome this bottleneck. After the feature is applied, each routing update is grouped only once, and the generated Update message is sent to all peers in the group. For example, an RR has 100 clients and needs to reflect 100,000 routes to them. If the RR groups routing updates per peer, it needs to group 100,000 routing updates 100 times (a total of 10 million) before sending Update messages to the 100 clients. The update peer-group feature improves performance 100-fold, because the 100,000 routing updates need to be grouped only once.
4-Byte AS Number
Purpose
2-byte autonomous system (AS) numbers used on networks range from 1 to 65535, and the available AS numbers are close to exhaustion as networks expand. Therefore, the AS number range needs to be extended. 4-byte AS numbers ranging from 1 to 4294967295 can address this problem. New speakers that support 4-byte AS numbers can co-exist with old speakers that support only 2-byte AS numbers.
Definition
4-byte AS numbers are extended from 2-byte AS numbers. Border Gateway Protocol (BGP) peers use a new capability code and optional transitive attributes to negotiate the 4-byte AS number capability and transmit 4-byte AS numbers. This mechanism enables communication between new speakers and between old speakers and new speakers.
To support 4-byte AS numbers, an open capability code 0x41 is defined in a standard protocol for BGP connection negotiation. 0x41 indicates that the BGP speaker supports 4-byte AS numbers.
- AS4_Path coded 0x11
- AS4_Aggregator coded 0x12
If a new speaker with an AS number greater than 65535 communicates with an old speaker, the old speaker needs to set the peer AS number to AS_TRANS. AS_TRANS is a reserved AS number with the value being 23456.
Related Concepts
New speaker: a BGP peer that supports 4-byte AS numbers
Old speaker: a BGP peer that does not support 4-byte AS numbers
New session: a BGP connection established between new speakers
Old session: a BGP connection established between a new speaker and an old speaker, or between old speakers
Fundamentals
When a new speaker sends an Update message carrying an AS number greater than 65535 to an old speaker, the new speaker uses AS4_Path and AS4_Aggregator to assist AS_Path and AS_Aggregator in transferring 4-byte AS numbers. AS4_Path and AS4_Aggregator are transparent to the old speaker. In the networking shown in Figure 1-1745, before the new speaker in AS 2.2 sends an Update message to the old speaker in AS 65002, the new speaker replaces each 4-byte AS number (2.2, 1.1, 65001) with 23456 in AS_Path. Therefore, the AS_Path carried in the Update message is (23456, 23456, 65001), and the carried AS4_Path is (2.2, 1.1, 65001). After the old speaker in AS 65002 receives the Update message, it transparently transmits the message to other ASs.
When the new speaker receives an Update message carrying AS_Path, AS4_Path, AS_Aggregator, and AS4_Aggregator from the old speaker, the new speaker uses the reconstruction algorithm to reconstruct the actual AS_Path and AS_Aggregator. On the network shown in Figure 1-1745, after the new speaker in AS 65003 receives an Update message carrying AS_Path (65002, 23456, 23456, 65001) and AS4_Path (2.2, 1.1, 65001) from the old speaker in AS 65002, the new speaker reconstructs the actual AS_Path (65002, 2.2, 1.1, 65001).
Format of 4-byte AS numbers
A 4-byte AS number can be an integer or in dotted notation. The system stores 4-byte AS numbers as unsigned integers, regardless of their formats. 4-byte AS numbers in dotted notation are in the format of X.Y. The formula of the conversion between 4-byte AS numbers for the two formats is as follows: Integer 4-byte AS number = X x 65536 + Y. For example, the 4-byte AS number in dotted notation 2.3 can be converted to the integer 4-byte AS number 131075 (2 x 65536 + 3).
The NetEngine 8100 M, NetEngine 8000E M, NetEngine 8000 M supports 4-byte AS numbers of both formats. The 4-byte AS numbers displayed in the configuration files are in the format configured by users.
By default, the 4-byte AS numbers displayed in the display and debugging command outputs are in dotted notation, regardless of the configured format. If the default display format of 4-byte AS numbers is changed from dotted notation to integer using a command, the 4-byte AS numbers will be displayed as integers automatically.
If you adjust the display format of 4-byte AS numbers, the matching results of AS_Path regular expressions and extended community filters are affected. Specifically, if the display format of 4-byte AS numbers is changed when an AS_Path regular expression or extended community filter is used as an export or import policy, the AS_Path regular expression or extended community filter needs to be reconfigured. If reconfiguration is not performed, routes cannot match the export or import policy, and a network fault occurs.
Benefits
4-byte AS numbers alleviate AS number exhaustion and therefore are beneficial to carriers who need to expand the network scale.
Fake AS Number
In the acquisition and merger scenarios between carriers, if the acquiree and the acquirer are located in different ASs, the BGP peers of the acquiree need to be migrated to the AS of the acquirer. However, during network migration, the customer of the acquiree may not want to have local BGP configurations modified right away or at all. As a result, the BGP peer relationships may be interrupted for a long time.
In Figure 1-1746, the AS number of carrier A is 100, whereas the AS number of carrier B is 200. Device A belongs to carrier B. Then carrier A acquires carrier B. In this case, the AS number of device A needs to be changed from 200 to 100. Because device A already has a BGP peer relationship established with device B in AS 300 using AS 200, device A's AS number used to establish the BGP peer relationship needs to be changed to 100. The carrier of AS 100 and the carrier of AS 300 then need to communicate about the change. In addition, the AS number configured on device A and peer AS number configured on device B may not be changed at the same time, which will lead to a lengthy interruption of the BGP peer relationship between the two devices. To ensure a smooth merger, you can run the peer fake-as command on device A to set AS 200 of carrier B as a fake AS number so that device A's AS number used to establish the BGP peer relationship between devices A and B does not need to be changed.
In addition, the AS number of the original BGP speakers of carrier B may be changed to the actual AS number at any time when BGP peer relationships are established with devices of carrier A after the merger. If carrier B has a large number of BGP speakers and some of the speakers use the actual AS number whereas other speakers use the fake AS number during BGP peer relationship establishment with devices of carrier A, the local configuration on BGP speakers of carrier B needs to be changed based on the configuration of the peer AS number, which increases the workload of maintenance. To address this problem, you can run the peer fake-as command with dual-as specified to allow the local end to use the actual or fake AS number to establish a BGP peer relationship with the specified peer.
In Figure 1-1747, the AS number of carrier A is 100, whereas the AS number of carrier B is 200; devices A, B, C, and D belong to carrier B, and device A establishes an IBGP peer relationship with device B, device C, and device D each. Then carrier A acquires carrier B. In this case, the AS number of device A needs to be changed from 200 to 100. Because the AS number used by device A to establish the IBGP peer relationship with devices B, C, and D is 200, the AS number needs to be changed to 100. In this case, carrier A and carrier B need to communicate about the change. In addition, the AS number configured on device A and peer AS number configured on devices B, C, and D may not be changed at the same time, which will lead to a lengthy interruption of the IBGP peer relationships. To ensure a smooth merger, you can run the peer fake-as command on device A to set AS 200 of carrier B as a fake AS number so that device A's AS number used to establish the IBGP peer relationships with devices B, C, and D does not need to be changed.
BMP
Background
The BGP Monitoring Protocol (BMP) can monitor the BGP running status and trace data of BGP routes on network devices in real time. The BGP running status includes the establishment and termination of peer relationships and update of routing information. The trace data of BGP routes indicates how BGP routes on a device are processed; for example, processing of the routes that match an import or export route-policy.
Before BMP is implemented, only manual query can be used to obtain the BGP running status of devices, resulting in low monitoring efficiency.
After BMP is implemented, a device can be connected to a BMP server and configured to report its BGP running status to the server, significantly improving monitoring efficiency.
BMP Message Types
BMP sessions include Initiation, PU, RM, PD, SR, ROFT, and Termination messages, which are sent in packets. The information reported in these messages mainly includes BGP routing information, BGP peer information, and device vendor and version information.
Initiation message: sent by a monitored device to the monitoring server to report information such as the device vendor and software version.
Peer Up Notification (PU) message: sent by a monitored device to notify the monitoring server that a BGP peer relationship has been established.
Route Monitoring (RM) message: used to provide the monitoring server with a collection of all routes received from a BGP peer and notify the server of route addition or withdrawal in real time.
Peer Down Notification (PD) message: sent to notify the monitoring server that a BGP peer relationship has been disconnected.
Stats Reports (SR) message: sent to report statistics about the device running status to the monitoring server.
Termination message: sent to report the cause for closing a BMP session to the monitoring server.
- Route Policy and Attribute Trace (ROFT) message: used to report the trace data of routes to the monitoring server in real time.
BMP sessions are unidirectional. Devices send messages to the monitoring server but ignore messages sent by the server.
Implementation
On the network shown in Figure 1-1748, TCP connections are established between the monitoring server and monitored devices (PE1 and PE2 shown in the figure). The monitored devices send unsolicited BMP messages to the monitoring server to report information about the BGP running status. Upon receiving these BMP messages, the monitoring server parses them and displays the BGP running status in the monitoring view. By analyzing the headers in the received BMP messages, the monitoring server can determine which BGP peers have advertised the routes carried in these messages.
When establishing a connection between a BGP device and monitoring server, note the following guidelines:
- BMP operates over TCP, and you can specify a port number for the TCP connection between the BGP device and monitoring server.
- One device can connect to multiple monitoring servers, and one monitoring server can also connect to multiple devices.
- Each BMP instance can connect to multiple monitoring servers. The advantages are as follows:
- Multiple monitoring servers back up each other, improving reliability.
- The load of a single server in monitoring BGP peers is reduced.
- Different servers can be used to monitor routes from the same BGP peer in different address families, allowing each BGP service to be monitored by a different server.
- A monitoring server can monitor all BGP peers or a specified one.
Benefits
BMP facilitates the monitoring of the BGP running status and reports security risks on networks in real time so that preventive measures can be taken promptly to improve network stability.
BGP Best External
Background
If multiple routes to the same destination are available, a BGP device selects one optimal route based on BGP route selection policies and advertises the route to its BGP peers.
For details about BGP route selection policies, see BGP Fundamentals.
However, in scenarios with master and backup provider edges (PEs), if routes are selected based on the preceding policies, the BGP route convergence takes a long time because no backup route is available. To address this problem, the BGP Best External feature was introduced.
Related Concepts
BGP Best External: After BGP Best External is enabled on a device, if the route preferentially selected by the device is an IBGP route, the device selects the sub-optimal route (EBGP or IBGP route) and advertises it to its peers. BGP Best External implements fast route convergence if the link between the device and a peer fails.
Best External route: The sub-optimal route selected after BGP Best External is enabled.
Networking with Master and Backup PEs
In the networking shown in Figure 1-1749, CE1 is dual-homed to PE1 and PE2. PE1 has a larger Local_Pref value than PE2. EBGP peer relationships are established between CE1 and PE1, and between CE1 and PE2. In addition, IBGP peer relationships are established among PE1, PE2, and PE3. PE1 and PE2 receive the same route to 1.1.1.1/32 from CE1, and PE2 receives the route from PE1. Of the two routes, PE2 preferentially selects the route from PE1 because PE1 has a larger Local_Pref value than CE1. PE2 does not advertise the route received from PE1 to PE3. Therefore, PE3 has only one route, which is advertised by PE1. If the primary link fails, traffic can be switched to the backup link only after routes are re-converged.
BGP Best External can be enabled on PE2 to address this problem. With BGP Best External, PE2 selects the EBGP route from CE1 and advertises it to PE3. In this case, a backup link is available. Table 1-679 lists the differences with and without BGP Best External.
Feature Enabling Status |
Route Advertisement |
Optimal Route |
Route Convergence in Case of a Link Fault |
---|---|---|---|
Before the BGP Best External feature is enabled |
PE3 can receive only one route: CE1→PE1→PE3 |
CE1 -> PE1 -> PE3 |
The backup link can be selected only after PE1 and PE2 re-select a route. |
After BGP Best External is enabled |
PE3 receives two routes: CE1→PE1→PE3 CE1→PE2→PE3 |
CE1 -> PE1 -> PE3 |
Traffic can be directly switched to the backup link. |
Usage Scenario
The master and backup provider edges (PEs) need to advertise sub-optimal routes (Best External routes) to peers to implement fast route convergence in the case of a link fault.
Benefits
As networks develop, services, such as Voice over Internet Protocol (VoIP), online video, and financial services, pose higher requirements for real-time transmission. After BGP Best External is deployed, if the optimal route selected by a device is an IBGP route, the device selects the suboptimal route and advertises it to BGP peers. This implements fast route convergence in the case of a link fault and reduces the impact of traffic interruption on services.
BGP Add-Path
Background
In a scenario with a route reflector (RR) and clients, if the RR has multiple routes to the same destination (with the same prefix), the RR selects an optimal route from these routes and then sends only the optimal route to its clients. Therefore, the clients have only one route to the destination. If a link along this route fails, route convergence takes a long time, which cannot meet the requirements on high reliability.
To address this issue, deploy the BGP Add-Path feature on the RR. With BGP Add-Path, the RR can send two or more routes with the same prefix to its clients. After reaching the clients, these routes can work in primary/backup or load-balancing mode, which ensures high reliability in data transmission.
For details about BGP route selection and advertisement policies, see BGP Fundamentals.
Although BGP Add-Path can be deployed on any router, you are advised to deploy it on RRs.
With BGP Add-Path, you can configure the maximum number of routes with the same prefix that an RR can send to its clients. The actual number of routes with the same prefix that an RR can send to its clients is the smaller value between the configured maximum number and the number of available routes with the same prefix.
Related Concepts
Add-Path routes: The routes selected by BGP after BGP Add-Path is configured.
Typical Networking
On the network shown in Figure 1-1750, DeviceA, DeviceB, and DeviceC are clients of the RR, and DeviceD is an EBGP peer of DeviceB and DeviceC. Both DeviceB and DeviceC receive a route to 10.1.1.1/32 from DeviceD.
DeviceB and DeviceC advertise the route 10.1.1.1/32 to the RR. The two routes have the same destination address but different next hops. The RR selects an optimal route based on BGP route selection rules and advertises the optimal route to DeviceA. Therefore, Device A has only one route to 10.1.1.1/32.
BGP Add-Path can be configured on the RR to control the maximum number of routes with the same prefix that the RR can send to DeviceA. Assume that the configured maximum number of routes with the same prefix that the RR can send to DeviceA is 2. Table 1-680 lists the differences with and without BGP Add-Path.
Scenario |
Route Advertisement |
Route Convergence in Case of a Link Fault |
---|---|---|
Before BGP Add-Path is deployed |
The RR advertises a route with 10.1.1.1/32 as the destination address and 192.168.1.1/24 as the next hop to DeviceA. |
A new route must be selected to take over traffic after route convergence. |
After BGP Add-Path is deployed |
The RR advertises two routes destined for 10.1.1.1/32, one with next hop 192.168.1.1/24 and the other with next hop 192.168.2.1/24 to DeviceA. |
When two links work in primary/backup mode and the primary link fails, traffic can be quickly switched to the backup link. When two links work in load-balancing mode and one of the links fails, all traffic on the faulty link is transferred to and transmitted over the other link. |
Usage Scenario
BGP Add-Path applies to scenarios in which an RR is deployed and needs to send multiple routes with the same prefix to clients to ensure data transmission reliability. BGP Add-Path supports route attribute-or prefix-based filtering to control Add-Path route advertisement in a refined manner.
BGP Add-Path is used in traffic optimization scenarios and allows multiple routes to be sent to the controller.
Benefits
Deploying BGP Add-Path can improve network reliability.
Route Dampening
Route instability is reflected by route flapping. When a route flaps, it repeatedly disappears from the routing table and then reappears.
If route flapping occurs, the router sends an Update packet to its peers. After the peers receive the Update packet, they recalculate routes and update their routing tables. Frequent route flapping consumes lots of bandwidth and CPU resources and can even affect network operations.
Route dampening can address this problem. In most cases, BGP is deployed on complex networks where routes change frequently. To reduce the impact of frequent route flapping, BGP adopts route dampening to suppress unstable routes.
BGP dampening measures route stability using a penalty value. The greater the penalty value, the less stable a route. Each time route flapping occurs (a device receives a Withdraw or an Update packet), BGP adds a penalty value to the route carried in the packet. If a route changes from active to inactive, the penalty value increases by 1000. If a route is updated when it is active, the penalty value increases by 500. When the penalty value of a route exceeds the Suppress value, the route is suppressed. As a result, BGP does not add the route to the routing table or advertise any Update message to BGP peers.
The penalty value of a suppressed route reduces by half after a half-life period. When the penalty value decreases to the Reuse value, the route becomes reusable, and BGP adds the route to the IP routing table and advertises an Update packet carrying the route to BGP peers. The penalty value, suppression threshold, and half-life are configurable. Figure 1-1751 shows the process of BGP route dampening.
Suppression on BGP Peer Flapping
Suppression on BGP peer flapping is a way to suppress flapping. After this function is enabled, BGP peer relationships that flap continuously can be suppressed.
Background
BGP peer flapping occurs when BGP peer relationships are disconnected and then immediately re-established in a quick sequence that is repeated. Frequent BGP peer flapping is caused by various factors; for example, a link is unstable, or an interface that carries BGP services is unstable. After a BGP peer relationship is established, the local device and its BGP peer usually exchange all routes in their BGP routing tables with each other. If the BGP peer relationship is disconnected, the local device deletes all the routes learned from the BGP peer. Generally, a large number of BGP routes exist, and in this case, a large number of routes change and a large amount of data is processed when BGP peers frequently flap. As a result, a large number of resources are consumed, causing high CPU usage. To prevent this issue, a device supports suppression on BGP peer flapping. With this function enabled, the local device suppresses the establishment of the BGP peer relationship if it flaps continuously.
Related Concepts
ConnectFlaps: indicates the peer flapping count. The peer flapping count increases each time BGP peer flapping occurs. After flapping suppression exits, the statistics are cleared. Otherwise, the accumulated statistics are retained.
Peer flapping suppression period: The peer flapping suppression period is adjusted based on the ConnectFlaps value.
Idle hold timer: indicates the timer used by BGP to determine the waiting period for establishing a peer relationship with a peer. After the Idle hold timer expires, BGP attempts to establish a new connection with the BGP peer.
Half-life period: When the peer flapping counter (ConnectFlaps value) changes, the peer flapping count adjustment timer starts. If the timer expires (more than 1800s), the ConnectFlaps value is reduced by half. This period specified by the peer flapping count adjustment timer is called a half-life period.
Fundamentals
Entering flapping suppression
As shown in Figure 1-1752, when the ConnectFlaps value reaches a certain value (greater than 5), the Idle hold timer is used to suppress the establishment of the BGP peer relationship. The Idle hold timer value is calculated as follows:
Idle hold timer = Initial waiting time + Peer flapping suppression period,
where, if the peer timer connect-retry connect-retry-time command is not run, the initial time that BGP waits to establish the peer relationship is 10s. If this command is run, the configured connect-retry-time value is used as the initial waiting time.
The peer flapping suppression period is processed as follows: If the ConnectFlaps value ranges from 1 to 5, the establishment of the peer relationship is not suppressed. If the ConnectFlaps value ranges from 6 to 10, the peer flapping suppression period increases by 10s each time the ConnectFlaps value is incremented by 1. If the ConnectFlaps value ranges from 11 to 15, the peer flapping suppression period increases by 20s each time the ConnectFlaps value is incremented by 1. For each of the following five-value ranges, the peer flapping suppression period increases by twice the time of the previous range each time the ConnectFlaps value is incremented by 1. The peer flapping suppression period no longer increases until the Idle hold timer reaches 600s. This prevents a BGP negotiation failure due to long-time suppression.
When the ConnectFlaps value changes, the peer flapping count adjustment timer starts. If the timer expires (more than 1800s have passed), the ConnectFlaps value is reduced by half, and a half-life period ends. In this case, if the ConnectFlaps value has not reached 0, the next half-life period will start. This process is cyclically repeated until the ConnectFlaps counter is reset. Assume that the ConnectFlaps value is 10. After four half-life periods elapse, the ConnectFlaps value changes to 0, as shown in Figure 1-1753.
Exiting flapping suppression
Peer flapping suppression can be canceled in either of the following ways:
- Resetting the involved BGP process or BGP peer relationship
- Running a command that forcibly exits flapping suppression
BGP Recursion Suppression in Case of Next Hop Flapping
Background
In some scenarios, a large number of routes may recurse to the same next hop. If the next hop flaps due to a device fault, the system will become occupied processing reselection and re-advertisement of each involved route, leading to excessive resource consumption and high CPU usage. To address this problem, enable BGP recursion suppression in case of next hop flapping. If the next hop frequently flaps, recursion suppression in case of next hop flapping slows down route processing, conserving system resources and reducing CPU usage.
Fundamentals
- Increases the penalty value by 1 if the flapping interval is less than T1.
- Retains the penalty value if the flapping interval is greater than or equal to T1, but less than T2.
- Reduces the penalty value by 1 if the flapping interval is greater than or equal to T2, but less than T3.
- Clears the penalty value if the flapping interval is greater than or equal to T3.
When the number of recursion suppressions in case of next hop flapping reaches a certain value (greater than 10), route processing is much lower than that without suppression.
Benefits
BGP recursion suppression in case of next hop flapping prevents the system from frequently processing reselection and re-advertisement of a large number of routes that are recursed to a flapping next hop, reducing system resource consumption and CPU usage.
BGP-LS
BGP-link state (LS) enables BGP to report topology information collected by IGPs to the upper-layer controller.
Background
BGP-LS is a new method of collecting topology information.
- The controller must have high computing capabilities and support both the IGP and its algorithm.
- The controller cannot obtain complete information about the inter-IGP area topology. As a result, it cannot compute E2E optimal paths.
- The controller receives topology information from different routing protocols, making it difficult for the controller to analyze and process such information.
- Lowers the requirements on the controller's computing and IGP capabilities.
- Facilitates path selection and computation on the controller by using BGP to summarize topology information in each process or AS and report the complete information directly to the controller.
- Requires only one routing protocol (BGP) to report information about the entire network's topology to the controller.
Related Concepts
BGP-LS provides a simple and efficient method of collecting topology information.
BGP-LS routes carry topology information and are classified into six types of routes that carry node, link, route prefix, IPv6 route prefix, SRv6 SID, and TE Policy information, respectively. These routes work together to transmit topology information.
BGP-LS Routes
Based on BGP, BGP-LS introduces a series of new Network Layer Reachability Information (NLRI) attributes to carry information about links, nodes, and IPv4/IPv6 prefixes. Such new NLRIs are called Link-State NLRIs. BGP-LS includes the MP_REACH_NLRI or MP_UNREACH_NLRI attribute in BGP Update messages to carry Link-State NLRIs.
BGP-LS defines the following types of Link-State NLRI:
- Node NLRI
- Link NLRI
- IPv4 Topology Prefix NLRI
- IPv6 Topology Prefix NLRI
In addition, the BGP-LS attribute is defined for Link-State NLRI to carry link, node, and IPv4/IPv6 prefix parameters and attributes. The BGP-LS attribute is defined as a set of Type, Length, Value (TLV) triplets and carried with Link-State NLRI attributes in BGP-LS messages. All these attributes are optional, non-transitive BGP attributes, including Node Attribute, Link Attribute, and Prefix Attribute.
Node NLRI format
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+ | Protocol-ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Identifier | | (64 bits) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // Local Node Descriptors (variable) // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Field |
Length |
Description |
---|---|---|
Protocol-ID |
1 octet |
Protocol identifier, identifying a protocol such as IS-IS, OSPF, OSPFv3, or BGP. |
Identifier |
8 octets |
Uniquely identifies a protocol instance when IS-IS, OSPFv3 multi-instance, or OSPF multi-instance is running. |
Local Node Descriptors |
Variable |
The Local Node Descriptors TLV contains Node Descriptors for the local node of the link. This TLV consists of a series of Node Descriptor sub-TLVs. |
Link NLRI format
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+ | Protocol-ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Identifier | | (64 bits) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // Local Node Descriptors (variable) // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // Remote Node Descriptors (variable) // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // Link Descriptors (variable) // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Field |
Length |
Description |
---|---|---|
Protocol-ID |
1 octet |
Protocol identifier, identifying a protocol such as IS-IS, OSPF, OSPFv3, or BGP. |
Identifier |
8 octets |
Uniquely identifies a protocol instance when IS-IS, OSPFv3 multi-instance, or OSPF multi-instance is running. |
Local Node Descriptors |
Variable |
The Local Node Descriptors TLV contains Node Descriptors for the local node of the link. This TLV consists of a series of Node Descriptor sub-TLVs. |
Remote Node Descriptors |
Variable |
The Remote Node Descriptors TLV contains Node Descriptors for the remote node of the link. |
Link Descriptors |
Variable |
The Link Descriptors field is a set of TLV triplets. This field uniquely identifies a link among multiple parallel links between a pair of devices. |
IPv4/IPv6 Topology Prefix NLRI
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+ | Protocol-ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Identifier | | (64 bits) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // Local Node Descriptors (variable) // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // Prefix Descriptors (variable) // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Field |
Length |
Description |
---|---|---|
Protocol-ID |
1 octet |
Protocol identifier, identifying a protocol such as IS-IS, OSPF, OSPFv3, or BGP. |
Identifier |
8 octets |
Uniquely identifies a protocol instance when IS-IS, OSPFv3 multi-instance, or OSPF multi-instance is running. |
Local Node Descriptors |
Variable |
The Local Node Descriptors TLV contains Node Descriptors for the local node of the link. This TLV consists of a series of Node Descriptor sub-TLVs. |
Prefix Descriptors |
Variable |
The Prefix Descriptors field is a set of TLV triplets. This field uniquely identifies a prefix originated by a node. |
BGP-LS Route Formats
Format of node routes
For example, a node route is in the format of [NODE][ISIS-LEVEL-1][IDENTIFIER0][LOCAL[as100][bgp-ls-identifier10.1.1.2][ospf-area-id0.0.0.0][igp-router-id0000.0000.0001.00]].
Node routes carry node information.
Table 1-684 describes the fields in node routes.
Item |
Description |
---|---|
NODE |
Field indicating that the BGP-LS route is a node route. |
ISIS-LEVEL-1 |
Protocol that collects topology information. The protocol is IS-IS in this example. |
IDENTIFIER0 |
BGP-LS identifier of the protocol that collects topology information. |
LOCAL |
Field indicating information of a local node. |
as |
BGP-LS domain AS number. |
bgp-ls-identifier |
BGP-LS domain ID. |
ospf-area-id |
OSPF area ID. |
igp-router-id |
IGP router ID, generated by the IGP that collects topology information. The router ID is obtained from the NET of an IS-IS process in this example. |
Format of link routes
For example, a link route is in the format of [LINK][ISIS-LEVEL-1][IDENTIFIER0][LOCAL[as255.255][bgp-ls-identifier192.168.102.4][ospf-area-id0.0.0.0][igp-router-id0000.0000.0002.01]][REMOTE[as255.255][bgp-ls-identifier192.168.102.4][ospf-area-id0.0.0.0][igp-router-id0000.0000.0002.00]][LINK[if-address0.0.0.0][peer-address0.0.0.0][if-address::][peer-address::][mt-id0]].
Link routes carry information about links between devices.
Table 1-685 describes the fields in link routes.
Item |
Description |
---|---|
LINK |
Field indicating that the BGP-LS route is a link route. |
ISIS-LEVEL-1 |
Protocol that collects topology information. The protocol is IS-IS in this example. |
IDENTIFIER0 |
BGP-LS identifier of the protocol that collects topology information. |
LOCAL |
Field indicating information of a local node. |
as |
BGP-LS domain AS number. |
bgp-ls-identifier |
BGP-LS domain ID. |
ospf-area-id |
OSPF area ID. |
igp-router-id |
IGP router ID, generated by the IGP that collects topology information. The router ID is obtained from the NET of an IS-IS process in this example. |
REMOTE |
Field indicating information of a remote node. |
if-address |
IP address of the local interface. |
peer-address |
IP address of the remote interface. |
mt-id |
ID of the topology to which an IGP interface is bound. |
Format of prefix routes
For example, a prefix route is in the format of [IPV4-PREFIX][ISIS-LEVEL-1][IDENTIFIER0][LOCAL[as100][bgp-ls-identifier192.168.102.3][ospf-area-id0.0.0.0][igp-router-id0000.0000.0001.00]][PREFIX[mt-id0][ospf-route-type0][prefix192.168.102.0/24]].
Prefix routes carry information about reachable network segments.
Table 1-686 describes the fields in prefix routes.
Item |
Description |
---|---|
IPV4-PREFIX |
Field that indicates an IPv4 prefix route. Prefix routes are classified as IPv4 prefix routes or IPv6 prefix routes. The router cannot generate IPv6 prefix routes, but it can process the IPv6 prefix routes received from non-Huawei devices. |
ISIS-LEVEL-1 |
Protocol that collects topology information. The protocol is IS-IS in this example. |
IDENTIFIER0 |
BGP-LS identifier of the protocol that collects topology information. |
LOCAL |
Field indicating information of a local node. |
as |
BGP-LS domain AS number. |
bgp-ls-identifier |
BGP-LS domain ID. |
ospf-area-id |
OSPF area ID. |
igp-router-id |
IGP router ID, generated by the IGP that collects topology information. The router ID is obtained from the NET of an IS-IS process in this example. |
PREFIX |
Field indicating an IGP route. |
mt-id |
ID of the topology to which an IGP interface is bound. |
ospf-route-type |
OSPF route type:
|
prefix |
Prefix of an IGP route. |
Format of TE Policy routes
For example: [TEPOLICY][SEGMENT-ROUTING][IDENTIFIER0][LOCAL[as100][bgp-ls-identifier1.1.1.1][bgp-router-id1.1.1.2][ipv4-router-id1.1.1.9][ipv6-router-id2001:DB8:1::1]][TE[protocol-origin3][Flag0][endpoint2.2.2.2][color123][originator-as0][originator-address0.0.0.0][discriminator500]]
The routes carry information about SR TE Policy-related topology and status.
Table 1-687 describes the fields in TE Policy routes.
Item |
Description |
---|---|
TEPOLICY |
Field indicating that the BGP-LS route is a TE Policy route. |
SEGMENT-ROUTING |
Segment routing. |
IDENTIFIER0 |
BGP-LS identifier of the protocol that collects topology information. |
LOCAL |
Field indicating information of a local node. |
as |
BGP-LS domain AS number. |
bgp-ls-identifier |
BGP-LS domain ID. |
bgp-router-id |
BGP router ID. |
ipv4-router-id |
IPv4 router ID. |
ipv6-router-id |
IPv6 router ID. |
TE |
Traffic engineering. |
protocol-origin2 |
Protocol origin of the primary path over an SR-MPLS TE Policy tunnel. |
Flag |
Flag bit. |
endpoint |
Destination IP address of an SR-MPLS TE Policy tunnel. |
color |
Color attribute carried in SR-MPLS TE Policy routes. |
originator-as |
Originator AS number configured for the primary path over an SR-MPLS TE Policy tunnel. |
originator-address |
Originator address configured for the primary path over an SR-MPLS TE Policy tunnel. |
discriminator |
Discriminator of the primary path over an SR-MPLS TE Policy tunnel. |
Format of IPv6 prefix routes
For example: [IPV6-PREFIX][ISIS-LEVEL-2][IDENTIFIER100][LOCAL[as200][bgp-ls-identifier192.168.11.11][ospf-area-id0.0.0.0][igp-router-id0000.0000.0004.00]][PREFIX[mt-id0][ospf-route-type0][prefix2001:DB8:1::1/64]]
The routes carry information about reachable network segments.
Table 1-688 describes the fields in IPv6 prefix routes.
Item |
Description |
---|---|
IPV6-PREFIX |
Field that indicates an IPv6 prefix route. Prefix routes are classified as IPv4 prefix routes or IPv6 prefix routes. The router cannot generate IPv6 prefix routes, but it can process the IPv6 prefix routes received from non-Huawei devices. |
ISIS-LEVEL-2 |
Protocol that collects topology information. The protocol is IS-IS in this example. |
IDENTIFIER |
BGP-LS identifier of the protocol that collects topology information. |
LOCAL |
Field indicating information of a local node. |
as |
BGP-LS domain AS number. |
bgp-ls-identifier |
BGP-LS domain ID. |
ospf-area-id |
OSPF area ID. |
igp-router-id |
IGP router ID, generated by the IGP that collects topology information. The router ID is obtained from the NET of an IS-IS process in this example. |
PREFIX |
Field indicating an IGP route. |
mt-id |
ID of the topology to which an IGP interface is bound. |
ospf-route-type |
OSPF route type:
|
prefix |
Prefix of an IGP route. |
Format of SRv6 SID routes
For example, an SRv6 SID route is in the format of [SRV6-SID][ISIS-LEVEL-2][IDENTIFIER100][LOCAL[as200][bgp-ls-identifier192.168.11.11][ospf-area-id0.0.0.0][igp-router-id0000.0000.0004.00]][SID[mt-id0][sid2001:db8:1::1]].
Such routes carry information about reachable network segments.
Table 1-689 describes the fields in this type of route.
Item |
Description |
---|---|
SRV6-SID |
Field indicating an SRv6 SID route. |
ISIS-LEVEL-2 |
Protocol that collects topology information. The protocol is IS-IS in this example. |
IDENTIFIER |
BGP-LS identifier of the protocol that collects topology information. |
LOCAL |
Field indicating information of a local node. |
as |
BGP-LS domain AS number. |
bgp-ls-identifier |
BGP-LS domain ID. |
ospf-area-id |
OSPF area ID. |
igp-router-id |
IGP router ID, generated by the IGP that collects topology information. The router ID is obtained from the NET of an IS-IS process in this example. |
mt-id |
ID of the topology to which an IGP interface is bound. |
sid |
SRv6 SID value. |
Typical Networking
Collecting topology information in an IGP area
In Figure 1-1754, DeviceA, DeviceB, DeviceC, and DeviceD use IS-IS to communicate with each other at the IP network layer. DeviceA, DeviceB, DeviceC, and DeviceD are all Level-2 devices in the same area (area 10). After BGP-LS is deployed on any one of the devices (DeviceA, DeviceB, DeviceC, and DeviceD) and this device establishes a BGP-LS peer relationship with the controller, topology information of the entire network can be collected and reported to the controller. Reliability can be improved by deploying BGP-LS on two or more devices and establishing a BGP-LS peer relationship between each BGP-LS device and the controller. Because the BGP-LS devices collect the same topology information, they back up each other. This means that the topology information can be reported promptly if any of the BGP-LS devices fails.
Collecting BGP inter-AS topology information
In Figure 1-1755, DeviceA and DeviceB belong to the same AS, and an IS-IS neighbor relationship is established between them. BGP is not enabled on DeviceA in the AS. An EBGP peer relationship is established between DeviceB and DeviceC. If BGP-LS is not enabled, topology information cannot be transmitted between the ASs. Because the devices collect information about only their own AS, the topology information in AS 100 is different from that in AS 200. In this case, BGP-LS must be enabled on at least one device in each AS and this device must establish a BGP-LS peer relationship with the controller. To ensure that topology information can be collected and reported reliably, enable that two or more devices in each AS are connected to the controller.
On the network shown in Figure 1-1756, two controllers are each connected to a device in a different AS. If both controllers need to obtain information about the entire network's topology, a BGP-LS peer relationship needs to be established between the controllers or between the devices (DeviceB and DeviceC in this example) connected to the controllers.
To minimize the number of connections with the controllers, one or more devices can be used as BGP-LS RRs, which then function as proxies to establish BGP-LS peer relationships between the devices and controllers.
Usage Scenario
The router functions as a forwarder and reports topology information to the controller for topology monitoring and traffic control.
Benefits
BGP-LS offers the following benefits:
- Reduces computing capability requirements on the controller.
- Allows the controller to gain the complete inter-AS topology information.
- Requires only one routing protocol (BGP) to report topology information to the controller.
BGP RPD
Background
Route policy distribution (RPD) is used to distribute route-policies dynamically.
Without RPD, route-policies can be generated only through manual configuration, and then the route-policies are applied to specified peers. Such a generation mode is not applicable when the route-policies need to be adjusted dynamically and frequently. For example, in the inbound traffic optimization scenario with an NCE, the NCE monitors the traffic bandwidth usage on the network in real time, and users perform traffic optimization based on the analysis result. Specifically, for traffic optimization purposes, route-policies need to be used to modify route attributes to control the route selection on the peer end. However, the traffic bandwidth usage constantly changes, leading to the constant changes of traffic optimization policies. In this case, route-policies configured manually are not suitable. RPD provides a dynamic route-policy distribution mode for the NCE. With RPD, route-policy information is transmitted through the BGP RPD address family.
After RPD is configured, you can use the NCE to monitor and control traffic in real time. The traffic optimization policy configurations are performed on the NCE. The local device functions as a forwarder and only receives and executes policies delivered by NCE. No additional configuration is required.
Related Concepts
RPD route: Carries route-policy information and distributes the information to peers in the BGP RPD address family. After learning the RPD route, the receiver converts it into a route-policy and applies the policy.
RPD Route Format
RPD routes are in the format of policy type (export policy)/peer address/policy ID, for example, 1/1.1.1.1/1.
Table 1-690 describes the fields in the routes.
Field |
Description |
---|---|
Policy type |
Specifies the policy type. Currently, only export policies are supported. |
Peer address |
Specifies the peer address used by the policy. |
Policy ID |
Specifies the ID of a policy. |
Route-policies carried in RPD routes are encapsulated through the WideCommunity attribute. Figure 1-1757 shows the WideCommunity format used by RPD routes.
Field |
Length (in bits) |
Description |
---|---|---|
Container Type |
16 |
The value is 1, indicating the WideCommunity attribute. |
Flags |
8 |
The R bit is 0, indicating a private attribute. The T bit is 0, which is not used currently. |
HopCount |
8 |
This field is not used currently. The value is 1. |
Length |
16 |
Total packet length. |
Community |
32 |
Value of WideCommunity. Each value identifies a specific function of WideCommunity. If the value is MATCH AND SET ATTR, the attributes of the routes that match specific conditions are modified. If the value is MATCH AND NOT ADVERTISE, the routes that match specific conditions are not advertised. |
OWN AS |
32 |
AS number of the NCE. |
Context AS |
32 |
AS number of the local device (forwarder). |
Target TLV |
8 |
Target TLV. |
Length |
16 |
Target TLV length. |
RouteAttr |
8 |
Route attribute type. The TLV has three sub-TLVs: IP Prefix, AS-Path, and Community. |
Length |
16 |
Length of the route attribute type. |
IP Prefix |
8 |
IP address prefix. |
Length |
16 |
Length of IP address prefix. |
Type |
4 |
Matching type of the IP address prefix.
|
Flags |
4 |
This field is not used currently. |
IP Address |
32 |
Peer IP address |
Mask |
8 |
Mask of the IP address. |
GeMask |
8 |
Used to specify a range. The value of this field must be less than or equal to the length of the Mask or be 0. |
LeMask |
8 |
Used to specify a range. The value of this field must be greater than the length of the Mask or be 0. |
AS-Path |
8 |
AS_Path. |
Length |
16 |
AS_Path length. |
as-path regex string |
32 |
Content of the AS_Path, which is presented using a regular expression. The maximum length of the AS_Path is 1024 bytes. |
Community |
8 |
Community attribute. |
Length |
16 |
Length of the community attribute. |
Flags |
8 |
This field is not used currently. |
Community value |
32 |
Community attribute value. |
ExcTargetTLV |
8 |
This field is not used currently. Even if this TLV has a value, it is also ignored. |
Length |
16 |
ExcTargetTLV length |
Param TLV |
8 |
Content of the action to be performed. The format depends on the Community value, and the TLV content also varies according to the Community value. If the Community value is MATCH AND SET ATTR, the MED, community, or AS_Path attribute is set. If the Community value is MATCH AND NOT ADVERTISE, the Param TLV is empty, without any sub-TLV. |
Length |
16 |
Param TLV length |
Implementation
In the following example, the typical networking of inbound traffic optimization is used to describe how RPD works to implement traffic optimization:
Figure 1-1758 shows an inbound traffic optimization scenario. NCE collects traffic information from devices and performs analysis and calculation to identify the routes to be adjusted. After a traffic optimization policy is configured on NCE, NCE converts the policy into an RPD route and delivers the route to the devices, which are forwarders in this scenario.
- Before traffic optimization is implemented, the MED values of the BGP routes advertised from DeviceA to DeviceC and from DeviceB to DeviceC are 50, and traffic is balanced.
- NCE collects traffic information from devices and performs calculation and finds that the path from DeviceC to DeviceA is congested. In this case, it is expected that the traffic that is from AS 200 and destined for 10.1.1.1/24 enters AS 100 through DeviceB rather than DeviceA. NCE configures a traffic optimization policy, converts it into an RPD route, and delivers the route to DeviceA to instruct DeviceA to increase the MED value of the route advertised to AS 200 to 100. The MED value of the route advertised by DeviceB to AS 200 remains unchanged.
- After receiving the RPD route delivered by the NCE, Device A generates a route-policy based on the RPD route and executes the policy.
- The RPD route-policy takes effect. After receiving the routes destined for 10.1.1.1/24 from DeviceA and DeviceB, DeviceC selects the route received from DeviceB because its MED value is smaller than the MED value of the route received from DeviceA. In this case, traffic that is from AS 200 and destined for 10.1.1.1/24 enters AS 100 through DeviceB rather than DeviceA.
In this scenario, forwarders receive the policies delivered by NCE and adjust route attributes (MED, community, or AS_Path) based on the policies. The forwarders follow the policies strictly when advertising routes, but are not responsible for the traffic optimization results. You can check the traffic optimization results in real time through NCE.
Usage Scenario
The IP network optimization solution provides users with a method of on-demand traffic scheduling to make full use of network bandwidth. In the IP network optimization solution, this feature ensures inbound traffic optimization in MAN ingress or IGW scenarios. In this solution, the router functions as a forwarder and needs to be configured with the RPD feature so that the router executes the route-policies carried in the RPD routes delivered by NCE to dynamically adjust traffic for inbound traffic optimization.
Benefits
In traffic optimization scenarios, this feature spares manual BGP route-policy maintenance, which is complex, time-consuming, and error-prone. Therefore, this feature reduces maintenance workload and improves maintenance quality.
BGP Multi-instance
Background
By default, all BGP routes are stored in the BGP basic instance, and separate route management and maintenance are impossible. To address this problem, BGP multi-instance is introduced. A device can simultaneously run two BGP instances: a BGP basic instance and a BGP multi-instance. The two BGP instances are independent of each other and can have either the same AS number or different AS numbers. BGP multi-instance can achieve separate route management and maintenance by having different address families deployed in the BGP basic instance and BGP multi-instance.
Basic Concepts
- BGP basic instance (BGP view), such as bgp 100
- BGP multi-instance (BGP multi-instance view), such as bgp 100 instance a
Implementation
- Configure BGP basic instance bgp 200 on Device A.
- Configure BGP basic instance bgp 100 and BGP multi-instance bgp 200 instance a on Device B.
- Configure BGP basic instance bgp 100 on Device C.
BGP SR LSP
BGP Segment Routing (SR) uses BGP as the control-plane protocol to transmit SR information. BGP uses the prefix SID attribute to advertise Segment Routing global block (SRGB) and Label-Index information for unified SR label deployment, after which BGP SR LSPs can be established. BGP SR LSPs are essentially BGP LSPs and are created in a similar way. The data forwarding process using BGP SR LSPs is also similar to that using BGP LSPs. The main difference between BGP SR LSPs and BGP LSPs lies in the label distribution mode. BGP SR LSPs use the SR label distribution mode, in which a label value is allocated to a specified route in a fixed mode (Label-Index+SRGB). This mode is a static label configuration mode, whereas BGP LSPs use a dynamic label allocation mode.
BGP SR LSP Creation
Table 1-692 describes the process of establishing a prefix SID-based BGP SR LSP.
Step |
Device |
Operation |
---|---|---|
1 |
D |
An SRGB and Label-Index are configured on node D. The incoming label (In Label for short) of the route to 1.1.1.1/32 is 16100 on node D. In this case, node D instructs node C to use 16100 as the BGP SR LSP label for the route to 1.1.1.1/32. Node D creates an ILM entry to guide the processing of the In Label, encapsulates its SRGB and Label-Index into the Prefix SID attribute of a BGP route, and advertises the BGP route to its BGP peers. |
2 |
C |
After parsing the BGP message advertised by node D, node C sets the outgoing label (Out Label for short) to the In Label advertised by node D, instructs the tunnel management module to update the BGP LSP information, and delivers an NHLFE entry. In addition, node C calculates the In Label by adding the start value of its SRGB [36000–65535] and the Label-Index carried in the received message. The calculated In Label is 36100 (36000 + 100). After applying for the label, node C creates an ILM entry. |
3 |
B |
The process is similar to that on node C. The Out Label is 36100, and the In Label is 26100 (26000 + 100). |
4 |
A |
The process is similar to that on node B, and the In Label is 20100. |
Data Forwarding
BGP SR LSPs use the same three types of label operations as those used in MPLS: push, swap, and pop.
Table 1-693 describes the process of data forwarding on the network shown in Figure 1-1761.
Step |
Device |
Operation |
---|---|---|
1 |
A |
Node A receives a data packet and finds that the destination IP address of the packet is 1.1.1.1. Node A searches for the corresponding BGP LSP and pushes an inner MPLS label 20100 to the packet. Node A searches the inner and outer label mapping table, pushes an outer MPLS label 48123 to the packet, and forwards the packet through the outbound interface. NOTE:
To implement MPLS forwarding, each node creates an inner and outer label mapping table. Take node A as an example. According to the BGP SR LSP, when the inner label of a packet is 20100, the destination address is 1.1.1.1. According to the LDP LSP, when the packet needs to be sent to node B, the outer label 48123 needs to be added to the packet. Therefore, when the inner label of a packet is 20100, the outer label 48123 needs to be added. This mapping is recorded in the inner and outer label mapping table. With this table, node A does not need to query the IP routing table for an entry to send the packet to node B. Instead, node A only needs to query its inner and outer label mapping table for packet forwarding. |
2 |
B |
After receiving the labeled packet, node B searches for an LDP LSP and pops the outer label 48123. Then, node B searches for a BGP LSP and swaps the inner label from 20100 to 26100. Finally, node B queries its inner and outer label mapping table, pushes an outer label 48120 to the packet, and forwards the packet through the outbound interface. |
3 |
C |
The operations on node C are similar to those on node B. |
4 |
D |
After receiving the labeled packet, node D searches for an LDP LSP and pops the outer label 48125 from the packet. Then, node D searches for a BGP LSP, pops the inner label 36100 from the packet, and forwards the packet to the destination. |
BGP Configuration
Border Gateway Protocol (BGP) is applicable to complicated large-scale networks and used to transmit routing information between ASs.
BGP Overview
The Border Gateway Protocol (BGP) advertises and maintains a large number of routes between autonomous systems (ASs).
Definition
Border Gateway Protocol (BGP) is a dynamic routing protocol used between autonomous systems (ASs).
As three earlier-released versions of BGP, BGP-1, BGP-2, and BGP-3 are used to exchange reachable inter-AS routes, establish inter-AS paths, avoid routing loops, and apply routing policies between ASs.
Currently, BGP-4 is used.
As an exterior routing protocol on the Internet, BGP has been widely used among Internet service providers (ISPs).
BGP has the following characteristics:
Unlike an Interior Gateway Protocol (IGP), such as Open Shortest Path First (OSPF) and Routing Information Protocol (RIP), BGP is an Exterior Gateway Protocol (EGP) which controls route advertisement and selects optimal routes between ASs rather than discovering or calculating routes.
BGP uses Transport Control Protocol (TCP) as the transport layer protocol, which enhances BGP reliability.
BGP selects inter-AS routes, which poses high requirements on stability. Therefore, using TCP enhances BGP's stability.
BGP peers must be logically connected through TCP. The destination port number is 179 and the local port number is a random value.
BGP supports Classless Inter-Domain Routing (CIDR).
When routes are updated, BGP transmits only the updated routes, which reduces bandwidth consumption during BGP route distribution. Therefore, BGP is applicable to the Internet where a large number of routes are transmitted.
BGP is a distance-vector routing protocol.
BGP is designed to prevent loops.
Between ASs: BGP routes carry information about the ASs along the path. The routes that carry the local AS number are discarded to prevent inter-AS loops.
Within an AS: BGP does not advertise routes learned in an AS to BGP peers in the AS to prevent intra-AS loops.
BGP provides many routing policies to flexibly select and filter routes.
BGP provides a mechanism that prevents route flapping, which effectively enhances Internet stability.
BGP can be easily extended.
Purpose
BGP transmits route information between ASs. It, however, is not required in all scenarios.
BGP is required in the following scenarios:
On the network shown in Figure 1-1762, users need to be connected to two or more ISPs. The ISPs need to provide all or part of the Internet routes for the users. Routers, therefore, need to select the optimal route through the AS of an ISP to the destination based on the attributes carried in BGP routes.
The AS_Path attribute needs to be transmitted between users in different organizations.
Users need to transmit VPN routes through a Layer 3 VPN. For details, see the HUAWEI NetEngine 8100 M14/M8, NetEngine 8000 M14K/M14/M8K/M8/M4 & NetEngine 8000E M14/M8 series Feature Description - VPN.
Users need to transmit multicast routes and construct a multicast topology. For details, see the HUAWEI NetEngine 8100 M14/M8, NetEngine 8000 M14K/M14/M8K/M8/M4 & NetEngine 8000E M14/M8 series Feature Description - IP Multicast.
BGP is not required in the following scenarios:
Users are connected to only one ISP.
The ISP does not need to provide Internet routes for users.
ASs are connected through default routes.
Configuration Precautions for BGP
Feature Requirements
Feature Requirements |
Series |
Models |
---|---|---|
Before enabling the Add-Path function, you need to set the number of paths for use according to the actual requirement. The maximum number of paths cannot be set; otherwise, memory resources may be exhausted. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
If a feature is not configured for a peer or the default value is configured for the peer, and then the peer is added to a peer group which has a non-default value of the feature configured, the peer inherits the feature configuration from the peer group. If a peer in a peer group has the same configuration of a feature with the peer group, and then the feature is modified for the peer group, the feature configuration of the peer changes accordingly. If a peer in a peer group and the peer group have different configurations of a feature, and then the feature is modified for the peer group, the feature configuration of the peer remains inconsistent with that of the peer group. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
If the AS-SET parameter is configured during route summarization, the AS_Path attributes of all specific routes with the same sequence number form AS_SEQUENCE, and the other ASs form AS_SET, which is used as the AS_Path attribute of the summarized route. The number of AS_Path attributes after aggregation cannot exceed 2000. Otherwise, the AS_Path attribute is set to null. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
LocalIfnet does not support over GRE tunnels. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
In a scenario where a BGP IPv4 VPN unicast route is iterated to an MPLS local IFNET tunnel, the tunnel ID in the FIB table is different from that in the IP routing table. The tunnel ID in the FIB table does not carry a VPN instance ID, and the tunnel ID in the IP routing table is used. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
The peer allow-as-loop command enables BGP to check the count of the local AS number in the routes received from EBGP peers or confederation EBGP peers. The command does not apply to IBGP peers or confederation IBGP peers. If the command is not run, the implementation is equivalent to the peer allow-as-loop 0 configuration. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
EBGP peers do not support the following features: Route reflector, Best-external, Add-path. IBGP peers do not support the following features: EBGP-max-hop, MPLS local IFNET, Fake AS. Feature exclusiveness: The ebgp-max-hop and valid-ttl-hops functions are mutually exclusive. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
To advertise default routes, you need to run both the default-route imported and import-route commands. If either command is not run, default routes cannot be advertised even when they are available in the routing table. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
The undo peer x.x.x.x group command keeps the behavior of the peer unchanged before and after the operation, instead of removing the peer from the group. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
BGP routes cannot be recursed to SRv6-BE LSPs. After recursion, the routes are inactive. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
(1) Configuration restrictions: A maximum of 100 regions can be configured in one VS. A maximum of 100 AS numbers (either 4-byte or 2-byte) can be configured in one region. A maximum of 100 regional confederations can be configured in one VS. A maximum of 100 regions can be configured in one regional confederation. The same AS cannot be added to different regions. The display format is not affected. For example, 1.0 and 65536 indicate the same AS. The same region cannot be added to different regional confederations. The regions to be added to a regional confederation must exist. If a region has been added to a regional confederation, deleting the region will delete the region's information in the regional confederation. (2) Regional authentication depends on the trustworthiness of the original AS in each route. In actual application, the RPKI ROA function must also be deployed to ensure the correctness of the original AS. (3) The regional authentication configuration is a global configuration. Currently, the scenario where the public and private network ASs overlap is not considered. (4) Regional authentication can be enabled or disabled only in the address family view, not for a single peer. Currently, the following address families support regional authentication: IPv4 unicast address family, IPv6 unicast address family, VPN instance IPv4 address family, VPN instance IPv6 address family, BGP multi-instance VPN instance IPv4 address family, IPv4 unicast label address family, and IPv6 unicast label address family (5) Regional authentication must be configured on a border router that is directly connected to a router in an external region. Risky internal routes that already exist cannot be identified. (6) When both an import policy (for example, to modify AS numbers) and regional authentication are configured, regional authentication is performed before the import policy takes effect (after ROA). (7) Regional authentication affects the route learning performance of EBGP peers (the learning performance cannot decrease by more than 5% after regional authentication is configured). Regional authentication does not affect the convergence performance, RR reflection performance, or IBGP peers' route learning performance. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
The routing policy configured using the apply cost-type med-inherit-aigp command takes effect on the IPv4 and IPv6 private networks. The AIGP attribute of the private network route on the PE is advertised to the CE through the MED attribute. The policy applied to other address families does not take effect. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
Currently, among the 11 types of segments specified in the protocol, only Type 1 SIDs (MPLS label SIDs) and Type 2 SIDs (IPv6 address SIDs) are supported. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
In a public network IP over SRv6 TE Policy scenario, mirror-SID-based egress protection and service FRR-based egress protection are not supported. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
In the SR-MPLS TE Policy address family, IP prefix list, ACL, and RD filters cannot be used to filter routes based on NLRI. If the route-policy configured for a peer in the SR-MPLS TE Policy address family contains the if-match ip-prefix, if-match acl, or if-match rd-filter configuration, all the routes of the peer match the route-policy. If the route-policy configured for a peer in the SR-MPLS TE Policy address family contains the if-match as-path or if-match cost configuration, only the routes that meet the filtering rules match the route-policy. Properly plan route-policies. Do not use unsupported matching modes. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
Load balancing is not supported between MPLS and SRv6 tunnels. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
BGP IPv4 public network unicast routes, BGP IPv4 VPN remote cross routes, BGP IPv4 public network labeled routes (in 6PE networking), and BGP IPv6 VPN remote cross routes can recurse to SR-MPLS TE Policy tunnels based on next hop+color. Other routes do not support such recursion. Properly plan the tunnel policy and tunnel selector. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
By default, static routes cannot be iterated to SRv6 BE routes. After the ip route-static recursive-lookup inherit-label-route segment-routing-ipv6 command is run, static routes can be iterated to SRv6 BE routes. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
BGP IPv4 public network unicast routes, BGP IPv4 VPN remote cross routes, BGP IPv6 public network labeled routes, and BGP IPv6 VPN remote cross routes can recurse to SR-MPLS TE Policy tunnels. If multiple color extended community attributes are carried, only the maximum color value is used for recursion to SR-MPLS TE Policy tunnels. In addition, the value of the CO flag (refer to draft-ietf-idr-segment-routing-te-policy) in each received route is considered 00, regardless of its actual value. Properly plan the color extended community attribute to be added to routes on the egress. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
Allocation of DX4 SIDs for BGP public network IPv4 routes by the next hop is mutually exclusive with the Add-path function. If Add-path has been enabled before a DX4 SID is applied for, no DX4 SID can be obtained. If a DX4 SID has been obtained before the Add-path function is enabled, the allocated DX4 SID is released. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
After a route is imported between VPN and public network instances, the next hop or color extended community attribute of the route cannot be changed through a route-policy. Properly plan the route-policy to be used during the route import between VPN and public network instances. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
IPv4 and IPv6 neighbor functions cannot be enabled at the same time in the VPNv4 address family. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
When the apply extcommunity soo command is run in the XPL policy and route-policy, only the apply extcommunity soo {<source-of-origin> &<1-16>} additive command takes effect. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
Scenario 1: The as-number command is run in the BGP-VPN instance IPv4 or IPv6 address family view to configure a VPN AS number, and the bgp yang-mode enable command is run to enable the YANG management mode for the BGP VPN instance. Restrictions: 1. After the bgp yang-mode enable command is run, the sequence of the peer as-number and as-number commands in the configuration file changes. As a result, configurations in the configuration file fail to be pasted. To solve this problem, configure a VPN AS number using the as-number command first and then run the other commands in the configuration file. 2. Do not configure BGP peer relationships in the BGP-Flow VPN instance IPv4 address family view, BGP-Flow VPN instance IPv6 address family view, or BGP-labeled-VPN instance IPv4 address family view. Do not configure BGP-VPN IPv4 peer relationships in the BGP-VPN instance IPv6 address family view. 3. Before deleting the VPN AS number, delete all the peers and peer groups in the BGP-VPN instance IPv4 or IPv6 address family as well as all the peers in the BGP VPN instance view. 4. Before running the undo bgp yang-mode enable command, delete the VPN AS number. Scenario 2: A VPN AS number is configured in both the BGP-VPN instance IPv4 address family view and BGP-VPN instance IPv6 address family view, and the YANG management mode is enabled for the BGP VPN instance and then disabled. Restrictions: 1. After the bgp yang-mode enable command is run, the sequence of the peer as-number and as-number commands in the configuration file changes. As a result, configurations in the configuration file fail to be pasted. To solve this problem, run the peer as-number command in both the BGP-VPN instance IPv4 address family view and BGP-VPN instance IPv6 address family view to configure a new peer or peer group. However, do not configure a new peer in the BGP-VPN instance view. 2. Do not configure BGP peer relationships in the BGP-Flow VPN instance IPv4 address family view, BGP-Flow VPN instance IPv6 address family view, or BGP-labeled-VPN instance IPv4 address family view. Do not configure BGP-VPN IPv4 peer relationships in the BGP-VPN instance IPv6 address family view. 3. Before deleting the VPN AS number, delete all the peers and peer groups in the BGP-VPN instance IPv4 or IPv6 address family as well as all the peers in the BGP VPN instance view. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
Pay attention to the following points when using BGP EPE: 1. Confederation Member ASN is not supported. 2. Peer groups cannot be enabled. 3. Only node labels are generated for directly connected EBGP peers. Adjacency labels are not generated. 4. BGP EPE takes effect only after the BGP-LS address family is enabled. 5. BGP EPE supports only two directly connected devices, and multi-hop EBGP supports only two directly connected devices. 6. BGP EPE label forwarding takes effect only after segment routing is enabled in the system view. 7. When the next hop to which the BGP EPE peer address is recursed is an IPv6 address, no link route is generated. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
After the peer fake-as command is run and the prepend-fake-as or prepend-global-as parameter is modified, the BGP peer relationship is reestablished. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
If IPv6 routes received from IPv6 peers recurse to 6PE routes, the Pop-Go forwarding mode is not supported. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
The second carrier accesses the first carrier in IGP+LDP mode. Load balancing or FRR from the second carrier to the first carrier is not supported: 1->n+1. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
The original community values in all BGP public network routes on a device must be different from the configured community values that indicate peer roles. Otherwise, the original community attributes will be replaced, or routes will be incorrectly filtered. Users need to ensure that the community values are unique during the overall network planning. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
During BGP peer relationship establishment, specifying the local address is only optional. Therefore, when binding a TWAMP Light test instance to a connection based on the virtual link of the peer, the device cannot check whether the local and remote addresses of the peer match those of the TWAMP Light test instance. However, the generated link routes do not contain delay information. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
In BGP EPEv6 scenarios, only End/End.X SIDs support compression. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
UNRs do not support POPGO. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
1. If a device on the loop path does not support loop detection or is not enabled with loop detection, the low priority of the looped route may be lost. As a result, the loop cannot be eliminated. Workaround: Ensure that loop detection is enabled on each device on the loop path and the number of devices on the loop path does not exceed four. Impact: The loop detection function does not take effect. 2. If the local preference or MED of a looped route is reduced and then changed to another value using a routing policy, the priority of the looped route cannot be reduced. As a result, the loop cannot be eliminated. Workaround: Do not use a routing policy to modify the local-preference or MED of the routes that form a loop. Impact: The loop detection function does not take effect. 3. If the priority of the original route is the lowest, the priority cannot be reduced to prevent loops. Preventive measure: none Impact: The loop detection function does not take effect. 4. After the clear route loop-detect bgp alarm command is executed, the switchover is performed immediately. Some looped route records may not be cleared. In this case, you need to run the command again to clear the alarm. Preventive measure: none Impact: Even if a route does not carry the loop attribute, the route is incorrectly considered as a looped route. As a result, the route is never selected. 5. The maximum number of looped routes that can be recorded is controlled by the PAF file. Excess loop routes are not recorded. As a result, loops may fail to be removed for some routes. Preventive measure: none Impact: The loop detection function does not take effect. 6. The loop attribute values of BGP/IS-IS/OSPF are randomly generated. There is a low probability that the random numbers of different devices are the same. As a result, the loop attributes of BGP and BGP, IS-IS/OSPF and IS-IS/OSPF, and BGP and IS-IS/OSPF are the same, looped routes may be misjudged. Preventive measure: none Impact: Looped routes are incorrectly determined. 7. If both a source route and a looped route exist on a device and the source route is deleted, the looped route may be preferentially selected. In this case, enabling loop detection cannot prevent loops, and looped routes cannot be withdrawn. Workaround: If both source routes and looped routes exist on a device, remove the loop first and then delete the routes. Impact: The looped route flaps on the loop path, and the route cannot be withdrawn after a loop occurs. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
If no public SID is carried, SRv6 BE escape cannot be performed when BGP public network IPv6 over SRv6 TE Policy/SRv6 TE Flow Group (USD-capable tunnels) are used. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
ROA verification is not performed on the routes received from IBGP peers and locally imported routes. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
Configuring Basic BGP Functions
Before building a BGP network, you must configure basic BGP functions.
Usage Scenario
BGP can be configured on a network to implement communication among ASs. To build a BGP network, configure basic BGP functions, including the following steps:
Start a BGP process. This step is a prerequisite for configuring basic BGP functions.
Establish BGP peer relationships. Devices can exchange BGP routing information only after peer relationships are established.
Import routes: BGP itself cannot discover routes. Instead, it needs to import routes discovered by other protocols to generate BGP routes.
Commands in the BGP-IPv4 unicast address family view can be run in the BGP view, which facilitates configuration. These commands are displayed in the BGP-IPv4 unicast address family view in configuration files.
To prevent commands of the BGP-IPv4 unicast address family from being executed in the BGP view, run the bgp default ipv4-unicast-config disable command.
Starting a BGP Process
Starting a BGP process is a prerequisite for configuring BGP functions. When starting a BGP process on a device, you need to specify the number of the AS to which the device belongs.
Procedure
- Run system-view
The system view is displayed.
- (Optional) Run route loop-detect bgp enable
BGP routing loop detection is enabled.
After this function is enabled, the device reports an alarm when detecting a BGP routing loop. Because the device cannot determine whether a routing loop is removed, the alarm will not be cleared automatically even if the routing loop is removed. To manually clear the BGP routing loop alarm, run the clear route loop-detect bgp alarm command.
- Run bgp as-number
BGP is started (with the local AS number specified), and the BGP view is displayed.
- (Optional) Run router-id ipv4-address
A BGP router ID is configured.
Configuring a new BGP router ID or changing the existing one will reset the BGP peer relationship between routers.
By default, BGP automatically selects a router ID in the system view as its router ID. If the selected router ID is the IP address of a physical interface, route flapping occurs when the IP address changes. To enhance network stability, configure the IP address of a loopback interface as the router ID. For rules in selecting router IDs from the system view, see the router-id command description in the "Command Reference."
By default, Cluster_List takes precedence over router ID during BGP route selection. To enable router ID to take precedence over Cluster_List during BGP route selection, run the bestroute routerid-prior-clusterlist command.
- (Optional) Run shutdown
All sessions between the device and its BGP peers are terminated.
Frequent BGP route flapping may occur during system upgrade and maintenance. To prevent this from impacting the network, perform this step.
After an upgrade or maintenance, run the undo shutdown command to restore the BGP sessions; otherwise, BGP functions will not work properly.
- Run commit
The configuration is committed.
Configuring a BGP Peer
Devices can exchange BGP routing information only after the BGP peer relationship is established.
Context
BGP peers use TCP to establish connections. Therefore, you need to specify the IP addresses of the peers when configuring BGP. A BGP peer may not be a neighboring node, and the BGP peer relationship can be created through logical links. To enhance the stability of BGP connections, using loopback interface addresses to establish connections is recommended.
The devices in the same AS establish IBGP peer relationships, and the devices of different ASs establish EBGP peer relationships.
Configuring BGP to Import Routes
BGP can import the routes from other routing protocols. When BGP needs to import routes from a dynamic routing protocol, you need to specify the process ID of the protocol.
Context
BGP itself cannot discover routes. Therefore, it needs to import routes from other protocols, such as IGP or static routes and adds the routes to the BGP routing table so that these imported routes can be transmitted within an AS or between ASs.
BGP imports routes in the following modes:
Import mode: BGP imports routes by protocol type, such as RIP, OSPF, IS-IS, static routes, and direct routes.
Network mode: BGP imports a route with the specified prefix and mask. This mode is more precise than the Import mode.
Verifying the Configuration
After configuring the basic BGP functions, verify BGP peer information.
Procedure
- Run the display bgp router-id [ vpn-instance [ vpn-instance-name ] ] command to check the router IDs.
- Run the display bgp peer [ verbose ] command to check the information about all BGP peers.
- Run the display bgp peer ipv4-address { log-info | verbose } command to check the information about a specified BGP peer.
- Run the display bgp routing-table command to check the information about BGP routes.
- Run the display bgp routing-table route-filter route-filter-name command to check BGP routes that match a specified route-filter.
Configuring the Format of BGP 4-Byte AS Numbers
You can change the format of BGP 4-byte AS numbers to your desired format.
Usage Scenario
By default, a BGP 4-byte AS number is displayed in dotted notation. To use integral 4-byte AS numbers, perform this configuration task to display 4-byte AS numbers as integers.
- If integral 4-byte AS numbers are configured, you must change 4-byte AS numbers in AS_Path regular expressions and extended community attribute filters to integral 4-byte AS numbers.
- If 4-byte AS numbers in dotted notation are configured, you must change 4-byte AS numbers in AS_Path regular expressions and extended community attribute filters to 4-byte AS numbers in dotted notation.
Procedure
- Run system-view
The system view is displayed.
- Run as-notation plain
The display format of BGP 4-byte AS numbers is set to the integer format.
The as-notation plain command affects the display format of BGP 4-byte AS numbers in the outputs of display commands and the matching results of AS_Path regular expressions and extended community filters, but does not affect the configuration format.
- Run commit
The configuration is committed.
Verifying the Configuration
- Run the display bgp peer [ [ ipv4-address ] verbose ] command to check the format of BGP 4-byte AS numbers.
- Run the display bgp routing-table command to check whether the result of matching BGP routes against an AS_Path regular expression or extended community filter has changed. If a change has occurred, reconfigure the AS_Path regular expression or extended community filter in time.
Configuring BGP Route Attributes
Configuring BGP route attributes can change BGP route selection results.
Usage Scenario
BGP has many route attributes. You can change route selection results by configuring attributes for routes.
BGP priority
Setting the BGP priority can control route selection between BGP routes and routes of other routing protocols.
Preferred values
After preferred values are set for BGP routes, the route with the greatest value is preferred when multiple routes to the same destination exist in the BGP routing table.
Local_Pref
The Local_Pref attribute has the same function as the preferred value of a route. If both of them are configured for a BGP route, the preferred value takes precedence over the Local_Pref attribute.
MED
The MED attribute is used to determine the optimal route for traffic that enters an AS. The route with the smallest MED value is selected as the optimal route if the other attributes of the routes are the same.
Next_Hop
BGP route selection can be controlled by changing Next_Hop attributes for routes.
AS_Path
The AS_Path attribute is used to prevent routing loops and control route selection.
AIGP
The AIGP attribute ensures that all devices in an AIGP domain forward data along the optimal path.
Setting the BGP Preference
Setting the BGP preference can affect route selection between BGP routes and other routing protocols' routes.
Context
Multiple dynamic routing protocols can be run on a device. The system sets a default preference for each routing protocol for inter-protocol route sharing and selecting. If different protocols have routes to the same destination, the route with the highest preference is selected.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
- Run preference { external internal local | route-policy route-policy-name | route-filter route-filter-name }
A preference is set for BGP.
The lower the value, the higher the preference.
BGP has the following types of routes:
EBGP routes: routes learned from external peers
IBGP routes: routes learned from internal peers
Locally originated BGP routes: summary routes generated automatically using the summary automatic command or manually using the aggregate command
However, you can set different preferences for the three types of routes.
You can also set a preference only for the routes that match the filtering rules in a route-policy. The routes that do not match the filtering rules will use the default preference.
Currently, the peer route-policy or peer route-filter command cannot be used to set a preference for the BGP routes received from or advertised to a specified peer.
- Run commit
The configuration is committed.
Setting a PrefVal for BGP Routes
After PrefVal values are set for routes, the route with the largest PrefVal is preferred when multiple routes to the same destination exist in the BGP routing table.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
- Run the peer { group-name | ipv4-address } preferred-value preferredvalue command to set a PrefVal for all the routes learned from a specified peer.
After the peer preferred-value command is run, all the routes learned from a peer have the same PrefVal.
- Run commit
The configuration is committed.
Setting the Default Local_Pref Attribute for the Local Device
The function of the Local_Pref attribute is similar to that of the preferred value. The priority of the Local_Pref attribute, however, is lower than that of the preferred value.
Context
The Local_Pref attribute is used to determine the optimal route for the traffic that leaves an AS. When a BGP device obtains multiple routes to the same destination address but with different next hops from different IBGP peers, the BGP device prefers route with the largest Local_Pref.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
- Run default local-preference local-preference
The default Local_Pref attribute is set for the local device.
- Run commit
The configuration is committed.
Configuring MED Attributes for BGP Routes
The MED attribute equals the metric used by an IGP. After the MED attributes of routes are set, an EBGP peer selects the route with the smallest MED value for the traffic that enters an AS if the other attributes of the routes are the same.
Context
If the router running BGP obtains multiple routes from different EBGP peers and these routes have different next hops but the same destination, the BGP device selects the route with the smallest MED value.
Procedure
- Set the default MED value on a device.
- Compare the MED values of the routes from different ASs.
- Configure the deterministic-MED function.
- Configure the processing mode when the MED value is lost.
- Compare the MED values of routes in a confederation.
- Compare the sums of MED multiplied by a MED multiplier and IGP cost multiplied by an IGP cost multiplier.
- Enable BGP to remove the MED attribute from the imported routes that are locally leaked and are to be advertised to a specified peer after an export route-policy in which the apply cost-type command is run is applied to routes to be advertised to the peer.
Configuring the Next_Hop Attribute
Configuring the Next_Hop attribute allows for flexible control of BGP route selection.
Procedure
- Configure a device to change the next hop address of a route when the device advertises the route to an IBGP peer.
By default, a device does not change the next hop address of a route learned from an EBGP peer before forwarding the route to IBGP peers. The next hop address of a route advertised by an EBGP peer to this device is the peer address of the EBGP peer. After being forwarded to IBGP peers in the local AS, this route is not active because the next hop is unreachable. To address this problem, the relevant ASBR needs to be configured to change the Next_Hop of the route learned from an EBGP peer to the ASBR's own address before the ASBR advertises the route to an IBGP peer. As an IGP runs within the AS, the next hop of the route is reachable to the IBGP peer. As such, the route received by the IBGP peer is active.
- Prevent a device from changing the next hop address of a route imported from an IGP when the device advertises the route to an IBGP peer.
- Prevent an ASBR from changing the next hop address of a route when the ASBR advertises the route to an EBGP peer.
- Configure route-policy-based next hop recursion.
- Prevent the device from changing the next hop address of a route to ensure that traffic is transmitted along the optimal route when the device advertises the route to a peer in the following scenarios:
- The route is learned from a directly connected peer and is to be advertised to a directly connected EBGP peer, the original next hop of the route resides on the same network segment as the local interface that is used to establish the BGP peer relationship with the EBGP peer, and all directly connected interfaces are broadcast interfaces.
- The route is locally imported and is to be advertised to a directly connected IBGP or EBGP peer, the next hop to which the route recurses resides on the same network segment as the local interface that is used to establish the BGP peer relationship with the IBGP or EBGP peer, and all directly connected interfaces are broadcast interfaces.
On the network shown in Figure 1-1764, DeviceA establishes EBGP peer relationships with DeviceB and DeviceC, but DeviceB and DeviceC do not establish a peer relationship with each other.Assume that DeviceA receives an EBGP route 1.1.1.1 from DeviceB. If the nexthop third-party command is not run, the next hop address of the route is changed as follows:- Before DeviceB advertises the route 1.1.1.1 to DeviceA, DeviceB changes the next hop to 192.168.10.1.
- Before DeviceA advertises the route 1.1.1.1 to DeviceC, DeviceA changes the next hop to 192.168.10.2.
When traffic is transmitted from DeviceC to DeviceB, the traffic passes through DeviceA.
After the nexthop third-party command is run on DeviceA, the next hop address of the route 1.1.1.1 is changed as follows:- Before DeviceB advertises the route 1.1.1.1 to DeviceA, DeviceB changes the route next hop to 192.168.10.1.
- Before DeviceA advertises the route to DeviceC, DeviceA detects that the address (192.168.10.2) of its local interface that is used to establish the BGP peer relationship with DeviceC belongs to the same network segment as the original next hop address 192.168.10.1 of the route. Therefore, DeviceA does not change the next hop address of the route. As a result, the next hop address of the BGP route 1.1.1.1 received by DeviceC remains 192.168.10.1.
In this way, traffic from DeviceC can be directly forwarded to DeviceB, without passing through DeviceA.
Setting the AS_Path Attribute
The AS_Path attribute is used to prevent routing loops and control route selection.
Procedure
- Enable a BGP device to accept the routes that contain the local AS number if the number of repetitions in each route is within a configured limit.
Generally, BGP uses AS numbers to detect routing loops. In the Hub and Spoke networking, if EBGP runs between a Hub-PE and a Hub-CE at a Hub site, a route sent from the Hub-PE to the Hub-CE carries the AS number of the Hub-PE. If the Hub-CE sends an Update message that contains the AS number of the Hub-PE to the Hub-PE, the Hub-PE will deny it.
To ensure proper route transmission in the Hub and Spoke networking, configure all the BGP peers on the path, along which the Hub-CE advertises VPN routes to the Spoke-CE, to accept the routes that contain the local AS number if the number of repetitions in each route is within the default limit (1).
- Enable the local device to ignore the AS_Path attribute during route selection.
- Configure a fake AS number.
- Substitute the AS numbers in the AS_Path attribute.
In a BGP/MPLS IP VPN scenario, if the ASs to which two VPN sites belong use private AS numbers, the AS numbers of the two VPN sites may be the same. If a CE in a VPN site sends a VPN route to the connected PE using EBGP and the PE then sends the route to the remote CE, the remote CE will discard the route because the AS number carried by the route is the same as the local AS number. As a result, different sites of the same VPN cannot communicate with each other. In this case, you need to run the peer substitute-as command on the PE to enable AS number substitution. That is, the PE replaces the AS number of the VPN site where the CE resides in the received VPN route with the local AS number. This prevents the remote CE from discarding routes due to duplicate AS numbers.
In a BGP public network scenario, when two devices with the same AS number learn a BGP route from each other through the same EBGP peer, the route may be discarded because the AS_Path attribute contains duplicate AS numbers. To prevent this problem, run the peer substitute-as command on the EBGP peer shared by the two devices to enable AS number substitution.
Exercise caution when running the peer substitute-as command because improper use of the command may cause routing loops.
- Run the system-view command to enter the system view.
- Run the bgp as-number command to enter the BGP view.
- Run the ipv4-family { vpn-instance vpn-instance-name | unicast } command to enter the BGP-VPN instance IPv4 address family or BGP-IPv4 unicast address family view.
- Run the peer { ipv4-address | group-name } substitute-as command to enable AS number substitution on the device.
- Run the commit command to commit the configuration.
- Configure the AS_Path attribute to carry only the public AS number.
- Set the maximum number of AS numbers in the AS_Path attribute.
- Disable the BGP device from checking the first AS number contained in the AS_Path attribute of each Update message received from an EBGP peer.
- Enable the device to check or disable the device from checking the first AS number in the AS_Path attribute contained in the Update messages received from a specified EBGP peer or peer group.
Configuring AIGP Attributes for Routes
The Accumulated Interior Gateway Protocol Metric (AIGP) attribute allows devices in an AIGP administrative domain to use the optimal routes to forward data.
Context
An AIGP administrative domain is a set of autonomous systems (ASs) in a common administrative domain.
IGPs running in an administrative domain assign a metric to each link and select the path with the smallest metric. BGP, designed to provide routing over a large number of independent administrative domains, does not select paths based on metrics. If a single administrative domain runs several contiguous BGP networks, it is desirable for BGP to select paths based on metrics, just as an IGP does.
After the AIGP attribute is configured in an AIGP domain, BGP selects optimal routes based on route metrics, just as an IGP does. This ensures that all devices in the AIGP domain forward data along the optimal paths.
Procedure
- Enable AIGP capability for a specified peer or peer group.
- (Optional) Allow VPN routes to participate in route selection using the AIGP attribute of the BGP LSP through which they are transmitted.
- (Optional) Allow public network routes to participate in route selection using the AIGP attribute of the corresponding BGP LSP.
Configuring Attr_Set Attribute Encapsulation or Parsing
Configuring Attr_Set attribute encapsulation or parsing ensures that the attributes of the routes sent by CEs are transparently transmitted over the backbone network.
Context
On BGP MPLS/VPN networks, EBGP peer relationships are established between PEs and CEs in most cases. Attributes of the routes advertised by CEs are modified during transmission over the intermediate backbone network, or the attributes affect the backbone network. In this case, BGP has been extended to allow the intermediate backbone network to transparently transmit the routes advertised by CEs. After receiving a route from a CE, the local PE encapsulates the attributes of the route in the Attr_Set attribute and then sends the route to the remote PE. Upon receipt of the route, the remote PE parses the Attr_Set attribute. This process ensures that the route attributes are transparently transmitted over the backbone network.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family vpn-instance vpn-instance-name command to enter the BGP-VPN instance IPv4 address family view or run the ipv6-family vpn-instance vpn-instance-name command to enter the BGP-VPN instance IPv6 address family view.
- Run attr-set { both | send | receive }
The device is configured to encapsulate the Attr_Set attribute when sending VPN routes, parse the Attr_Set attribute when receiving VPN routes, or encapsulate the Attr_Set attribute when sending VPN routes and parse the Attr_Set attribute when receiving VPN routes.
- Run commit
The configuration is committed.
Verifying the BGP Route Attribute Configuration
After configuring BGP route selection, verify information about route attributes.
Procedure
- Run the display bgp routing-table different-origin-as command to check routes with different source ASs but the same destination address.
- Run the display bgp routing-table regular-expression as-regular-expression command to check routes matching the AS regular expression.
- Run the display bgp routing-table [ network ] [ mask | mask-length ] [ longer-prefixes ] command to check information about the BGP routing table.
- Run the display bgp routing-table community [ community-number | aa:nn ] &<1-13> [ internet | no-advertise | no-export | no-export-subconfed ] * [ whole-match ] command to check routes matching a specified BGP community attribute.
- Run the display bgp routing-table community-filter { { community-filter-name | basic-community-filter-number } [ whole-match ] | advanced-community-filter-number } command to check the routes matching a specified BGP community filter.
Configuring BGP Routing Policies
BGP is used to transmit routing information between ASs, and its routing policies can be used to flexibly control route advertisement and acceptance, which directly affect traffic forwarding.
Usage Scenario
A large number of routes typically exist in a BGP routing table, and transmitting such extensive routing information brings heavy burden to a device. In order to address this problem, it is necessary to filter those routes to be advertised. You can configure a device to advertise only necessary routes or those that its peers require. Multiple routes to the same destination may exist and traverse different ASs. To direct traffic to specific ASs, routes to be advertised also need to be filtered.
A BGP device may receive multiple routes to the same destination network from different peers. To control the network traffic forwarding path, BGP needs to filter the received routes. In addition, due to potential service attacks, the BGP device may receive an excessively large number of routes from its peers, consuming many resources on the device. Regardless of whether malicious attacks or incorrect configurations result in the reception of numerous BGP routes, the administrator must limit the device resources to be consumed based on the network planning and device capacity.
Filters can be used to filter the routes to be advertised and received by BGP. BGP can filter the routes to be advertised by a peer or peer group, the routes that are received globally, or the routes received from a peer or peer group. If multiple filter policies are configured, BGP advertises or accepts only the routes that match all the filter policies.
Configuring BGP Filters
BGP filters can be used to flexibly filter routes to be advertised.
Procedure
- Configure an ACL.
An ACL is a series of sequential rules composed of permit and deny clauses. These rules specify source addresses, destination addresses, port numbers, and other information of data packets. ACL rules are used to classify data packets, and after the rules are applied to an interface on the router, the router uses the rules to permit or deny data packets.
For details on ACL configurations, see HUAWEI NetEngine 8100 M14/M8, NetEngine 8000 M14K/M14/M8K/M8/M4 & NetEngine 8000E M14/M8 seriesRouter Configuration Guide - IP Services.
An ACL can be used as a filtering condition of a route-policy or used in the filter-policy { acl-number | acl-name acl-name } export [ direct | isis process-id | ospf process-id | rip process-id | static ] or peer { group-name | ipv4-address } filter-policy { acl-number | acl-name acl-name } export command.
- Configure an IP prefix list.
An IP prefix list is a type of filter used to filter routes based on destination addresses, and is identified by its name. An IP prefix list can be used flexibly to implement precise filtering. For example, it can be used to filter one route or routes to a network segment. If a large number of routes with different prefixes need to be filtered, configuring an IP prefix list to filter the routes is very complex.
An IP prefix list can be used as a matching rule of a route-policy or used in the filter-policy ip-prefix ip-prefix-name export [ direct | isis process-id | ospf process-id | rip process-id | static ] or peer { group-name | ipv4-address } ip-prefix ip-prefix-name export command.
- Configure an AS_Path filter.
An AS_Path filter is used to filter BGP routes based on the AS_Path attributes they carry. If you do not want traffic to traverse some ASs, you can configure an AS_Path filter to filter out the routes whose AS_Path attributes contain the corresponding AS numbers. In addition, configuring an ACL or an IP prefix list to filter BGP routes may be complicated (as multiple ACLs or IP prefix lists need to be defined) and complicate maintenance of new routes. In this case, you can configure an AS_Path filter.
If the AS_Path information of summary routes is lost, an AS_Path filter can no longer filter them. However, it can still filter specific routes, which carry AS_Path information.
An AS_Path filter can be used as a filtering condition of a route-policy or be directly used in the peer as-path-filter command.
- Configure a community filter.
A BGP community attribute is used to identify a group of routes with the same properties. Routes can be classified through the community attribute, which facilitates route management.
In actual application, some AS internal routes may not need to be advertised to other ASs, while some AS external routes need to be advertised to other ASs. Both internal and external routes may have different prefixes (making an IP prefix list unsuitable), and may come from different ASs (making an AS_Path filter unsuitable). In this case, you can set a community value for the AS internal routes and another community value for the AS external routes on an AS edge device to control and filter routes.
- Configure a Large-community filter.
The Large-community attribute can completely represent a 2-byte or 4-byte AS number, and has two 4-byte LocalData fields, allowing the administrator to flexibly use route-policies. As an enhancement to community attributes, Large-community can be used together with community attributes.
- Configure an extended community filter.
Similar to a community filter, an extended community filter is mainly used to filter VPN routes.
- Configure a route-policy.
A route-policy is used to match routes or route attributes, and to change route attributes when the matching rules are met. As the preceding filters can be used as matching conditions of a route-policy, the route-policy offers powerful functions and can be used flexibly.
- Configure an IP address list.
Before configuring a conditional BGP route advertisement policy, you need to create an IP address list.
- Run the system-view command to enter the system view.
- Run the filter-list ip-prefix name command to create an IP address list and enter the ip-prefix-list view.
- Run the prefix address maskLen command to configure an IP address and mask for the IP address list.
- Run the commit command to commit the configuration.
Applying a Policy to BGP Route Advertisement
After a route advertisement policy is configured on a device, the device advertises only the routes that match the policy to its BGP peers.
Applying a Policy to BGP Route Acceptance
After an import policy is configured, only the routes that match the import policy are accepted.
Procedure
- Configure BGP to filter the routes to be received globally.
You can configure the device to filter the routes to be received.
- Configure BGP to filter the routes to be received from a specified peer or peer group.
- Limit the number of routes received from peers.
If a BGP router is maliciously attacked or network configuration errors occur, the router will receive a large number of routes from its peers. As a result, a large number of resources are consumed on the router. To prevent this issue, the administrator must limit the resources to be consumed during device operation based on the network planning and router capacity. BGP provides peer-specific route control to limit the number of routes received from a peer or peer group.
Configuring BGP Soft Reset
When a BGP policy is changed, BGP can apply the new policy immediately and refresh the BGP routing table dynamically without tearing down any BGP connection.
Context
After a BGP policy is changed, you can reset the BGP connection for the new policy to take effect immediately. This, however, interrupts the BGP connection temporarily. BGP route-refresh allows the system to refresh the BGP routing table dynamically without tearing down any BGP connection when a policy is changed.
If a BGP peer supports route-refresh, you can run the refresh bgp command to softly reset the BGP connection to refresh the routing table.
If a BGP peer does not support route-refresh, you can run the peer keep-all-routes command to reserve all the original routes of the peer. In this manner, the routing table can be refreshed without resetting the BGP connection.
Procedure
- For BGP peers that support route-refresh:
- For BGP peers that do not support route-refresh:
Configure the device to retain all the routing updates received from a specified peer or peer group.
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
- Run peer { ipv4-address | group-name } keep-all-routes
The device is configured to retain all routing updates received from the specified peer or peer group.
After this command is run, all routing updates received from the specified peer or peer group are retained, regardless of whether an import policy is used. If the local routing policy changes, the retained information can be used to regenerate BGP routes.
This command needs to be run on both the local device and its peers. If the peer keep-all-routes command is run on the device for the first time, the sessions between the device and its peers are re-established.
The peer keep-all-routes command does not need to be run on the router that support route-refresh. If this command is run, the sessions between the router and its peers are not reestablished, but the refresh bgp command does not take effect on the router.
- Run commit
The configuration is committed.
- Run system-view
Verifying the Configuration
After the configurations for controlling BGP route advertisement and acceptance are configured, you can view information about the configured filters, routes that match the specified filter, routes advertised to peers, and the imported routes that match the specified filter.
Prerequisites
All configurations for controlling BGP route advertisement and acceptance have been completed.
Procedure
- Run the display ip as-path-filter [ as-path-filter-number | as-path-filter-name ] command to check information about a configured AS_Path filter.
- Run the display ip community-filter [ basic-comm-filter-num | adv-comm-filter-num | comm-filter-name ] command to check information about a configured community filter.
- Run the display ip extcommunity-filter [ basic-extcomm-filter-num | advanced-extcomm-filter-num | extcomm-filter-name ] command to check the VPN-Target extended community filter information.
- Run the display ip extcommunity-list soo [ extcomm-filter-name ] command to check SoO extended community filter information.
- Run the display bgp routing-table as-path-filter as-path-filter-number command to check information about routes matching a specified AS_Path filter.
- Run the display bgp routing-table community-filter { { community-filter-name | basic-community-filter-number } [ whole-match ] | advanced-community-filter-number } command to check information about routes matching a specified BGP community filter.
- Run the display bgp routing-table peer ipv4-address advertised-routes [ statistics ] command to check information about routes advertised by a BGP device to its peers.
- Run the display bgp routing-table peer ipv4-address received-routes [ active ] [ statistics ] command to check information about routes received by a BGP device from its peers.
- Run the display bgp routing-table peer ipv4-address received-routes network { mask | mask-length } original-attributes command to check information about the original attributes of the routes received from the specified peer.
Configuring BGP XPL
Using XPL to Filter the BGP Routes to Be Advertised
A BGP device can use a route-filter to filter the routes to be advertised and modify route attributes to control the network traffic forwarding path.
Usage Scenario
BGP is used to transmit routing information between ASs, and route advertisement directly affects traffic forwarding.
In most cases, a BGP routing table has a large number of routes. Transmitting them will intensify the load of a device. To address this problem, configure the device to advertise only desired routes.
In addition, multiple routes to the same destination may exist and travel through different ASs. To direct routes to specific ASs, you also need to filter the routes to be advertised.
You can use XPL route-filters to control the BGP routes to be advertised to all peers or peer groups or to a specified peer or peer group.
Pre-configuration Tasks
Before using XPL to filter the BGP routes to be advertised, configure basic BGP functions.
Procedure
- Use XPL to filter the BGP routes to be advertised to all peers or peer groups.
Perform the following steps on the BGP device:
- Use XPL to filter the BGP routes to be advertised to a specific peer or peer group.
Perform the following steps on the BGP device:
Verifying the Configuration
Run the following commands to check configurations:
- Run the display xpl route-filter state [ attached | unattached ] command to check information about the configured route-filter.
- Run the display bgp routing-table [ peer ipv4-address advertised-routes [ statistics ] ] command to check the routes in the BGP routing table.
Using XPL to Filter the BGP Routes to Be Received
A BGP device can use a route-filter to filter the routes to be received and modify route attributes to control the network traffic forwarding path.
Usage Scenario
BGP is used to transmit routing information between ASs, and route advertisement directly affects traffic forwarding.
A BGP device may receive multiple routes to the same destination network from different peers. To control the network traffic forwarding path, filter the routes to be received.
In addition, a BGP device may receive a large number of routes during an attack, which may consume lots of device resources. In this case, the administrator must limit the resource consumption based on the network planning and device performance.
You can use XPL route-filters to control the BGP routes to be received from all peers or peer groups or from a specified peer or peer group.
Pre-configuration Tasks
Before using XPL to filter the BGP routes to be received, configure basic BGP functions.
Procedure
- Use XPL to filter the BGP routes to be received from all peers or peer groups.
Perform the following steps on the BGP device:
- Use XPL to filter the BGP routes to be received from a specific peer or peer group.
Perform the following steps on the BGP device:
Verifying the Configuration
Run the following commands to check configurations:
- Run the display xpl route-filter state [ attached | unattached ] command to check information about the configured route-filter.
- Run the display bgp routing-table [ peer ipv4-address received-routes [ statistics ] ] command to check the routes in the BGP routing table.
Configuring BGP Route Summarization
Configuring BGP route summarization on a device can reduce the sizes of routing tables on the peers of the device.
Usage Scenario
The BGP routing table of a router on a medium or large BGP network contains a large number of routing entries. Storing the routing table consumes a large number of memory resources, and transmitting and processing routing information consume lots of network resources. Configuring route aggregation can reduce the size of a routing table, prevent specific routes from being advertised, and minimize the impact of route flapping on network performance. BGP route summarization and routing policies enable BGP to effectively transmit and control routes.
BGP supports automatic and manual summarization. Manual summarization takes precedence over automatic summarization.
Configuring BGP to Generate a Summary Default Route
You can configure BGP to generate a summary default route and then determine whether to advertise the default route to a peer by using a route policy.
Usage Scenario
On the network shown in Figure 1-1765, a BGP-VPNv4 peer relationship is established between PE1 and PE2. In addition, an EBGP-VPN peer relationship is established between PE2 and the core network device, and another EBGP-VPN peer relationship is established between PE1 and CE1. The core network device advertises routes to PE2 through the EBGP-VPN peer relationship. PE2 then advertises the received routes to PE1 through the BGP-VPNv4 peer relationship. Upon receipt, PE1 leaks the routes to its VPN instance. A summary default route can be generated only if routes with a specific prefix exist among the leaked routes. You can configure BGP to generate a summary default route on PE1 so that PE1 matches the leaked routes against an IP prefix list and summarizes the matched routes into a default route. As a result, PE1 advertises only the summary default route to CE1. Traffic over the unmatched routes will not be diverted to PE1, thereby conserving PE1's bandwidth resources.
Pre-configuration Tasks
Before configuring BGP to generate a summary default route, configure basic BGP functions.
Procedure
- Run system-view
The system view is displayed.
- Run ip ip-prefix ip-prefix-name [ index index-number ] matchMode ipv4-address masklen [ match-network ] [ greater-equal greater-equal-value ] [ less-equal less-equal-value ]
An IPv4 prefix list is configured.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The BGP-IPv4 unicast address family view is displayed.
- Run aggregate default-route origin-ip-prefix ip-prefix-name [ attribute-policy attribute-policy-name ]
BGP is enabled to generate a summary default route based on an IPv4 prefix list.
- Run commit
The configuration is committed.
Configuring a BGP Peer Group
Configuring BGP peer groups simplifies the BGP network configuration and improves the route advertisement efficiency.
Usage Scenario
A BGP peer group consists of BGP peers that have the same update policies and configurations.
A large-scale BGP network has a large number of peers. Configuring and maintaining these peers is difficult. To address this problem, configure a BGP peer group for BGP peers with the same configurations. Configuring BGP peer groups simplifies peer management and improves the route advertisement efficiency.
- IBGP peer group: The peers of an IBGP peer group are in the same AS.
- Pure EBGP peer group: The peers of a pure EBGP peer group are in the same external AS.
- Mixed EBGP peer group: The peers of a mixed EBGP peer group are in different external ASs.
If a function is configured on a peer and its peer group, the function configured on the peer takes effect. After a peer group is created, peers can be added to the peer group. If these peers are not configured separately, they will inherit the configurations of the peer group. If a peer in a peer group has a specific configuration requirement, the peer can be configured separately. The configuration of this peer will override the configuration that the peer has inherited from the peer group.
Creating an IBGP Peer Group
If multiple IBGP peers exist, adding them to an IBGP peer group can simplify the BGP network configuration and management. When creating an IBGP peer group, you do not need to specify an AS number for the IBGP peer group.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run group group-name internal
An IBGP peer group is created.
- Run peer { ipv4-address | ipv6-address } group group-name
A peer is added to the peer group.
You can repeat step 4 to add multiple peers to the peer group. If the local device has not established a peer relationship with this peer, the device will attempt to establish a peer relationship with this peer, and set the AS number of this peer to the AS number of the peer group.
When creating an IBGP peer group, you do not need to specify the AS number.
After configuring a peer group, you can configure BGP functions for the peer group. By default, all peers in a peer group inherit the entire configuration of the peer group. If you configure a peer in a peer group independently. The configuration of this peer will override the configuration that the peer has inherited from the peer group.
- (Optional) Run peer { ipv4-address | ipv6-address | group-name } description description-text
A description is configured for the peer group.
You can simplify network management by configuring the descriptions of peers.
- Run commit
The configuration is committed.
Creating a Pure EBGP Peer Group
If multiple EBGP peers exist in an AS, adding them to an EBGP peer group can simplify the BGP network configuration and management. All the peers in a pure EBGP peer group must have the same AS number.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run group group-name external
An EBGP peer group is created.
- Run peer group-name as-number as-number
An AS number is set for the peer group.
If peers already exist in a peer group, the AS number of the peer group cannot be changed.
- Run peer ipv4-address group group-name
A peer is added to a peer group.
You can repeat Step 5 to add multiple peers to the peer group. If the specified peer does not exist, the system automatically creates it in the BGP view and sets the AS number of the peer to that of the peer group.
After a peer group is created, you can configure BGP functions for the peer group in batches. By default, each peer in a peer group inherits the configurations of the peer group. However, if you configure a member peer separately, the configuration of this peer will override that inherited from the peer group.
- (Optional) Run peer group-name description description-text
A description is configured for the peer group.
You can simplify network management by configuring a description.
- Run commit
The configuration is committed.
Creating a Mixed EBGP Peer Group
If multiple EBGP peers exist in different ASs, adding them to a mixed EBGP peer group can simplify the BGP network configuration and management. When creating a mixed EBGP peer group, you need to specify an AS number for each peer.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run group group-name external
A mixed EBGP peer group is created.
- Run peer { ipv4-address | ipv6-address } as-number as-number
A peer is created, and an AS number is set for this peer.
- Run peer { ipv4-address | ipv6-address } group group-name
A peer is added to the peer group.
You can repeat Steps 4 and 5 to add multiple peers to the peer group.
You need to specify an AS number for each peer in a mixed EBGP peer group.
After configuring a peer group, you can configure BGP functions for the peer group. By default, all peers in a peer group inherit the entire configuration of the peer group. If you configure a peer in a peer group independently. The configuration of this peer will override the configuration that the peer has inherited from the peer group.
- (Optional) Run peer group-name description description-text
A description is configured for the peer group.
You can simplify network management by configuring the descriptions of peers.
- Run commit
The configuration is committed.
Verifying the BGP Peer Group Configuration
After configuring a BGP peer group, check information about BGP peers and BGP peer groups.
Procedure
- Run the display bgp peer [ ipv4-address ] verbose command to check detailed information about BGP peers.
- Run the display bgp group [ group-name ] command to check information about BGP peer groups.
This command is applied only to devices on which BGP peer groups are created.
If a peer group is specified in this command, detailed information about this peer group will be displayed. If no peer group is specified in this command, information about all BGP peer groups is displayed.
Configuring a BGP Route Reflector
By configuring a BGP route reflector (RR), you can avoid fully meshed connections between multiple IBGP peers.
Usage Scenario
Fully meshed connections need to be established between IBGP peers to ensure the connectivity between IBGP peers. If there are n routers in an AS, n x (n–1)/2 IBGP connections need to be established. When there are a lot of IBGP peers, network resources and CPU resources are greatly consumed. Route reflection can solve the problem.
RRs can reduce the total number of IBGP connections. On a large network, to reduce the number of clients of each route reflector, you need to configure multiple RRs. Because fully meshed connections need to be established between RRs, there are still a large number of IBGP connections on the network. In this situation, configure hierarchical RRs to further reduce the number of IBGP connections.
Figure 1-1766 shows typical networking with hierarchical RRs. In this networking, R1, R2, R3, and R4 function as Level-1 RRs; R5, R6, R7, and R8 function as level-2 RRs and the clients of level-1 RRs. Level-1 RRs are not the clients of any RR and must be fully meshed. Level-2 RRs function as the clients of Level-1 RRs and do not need to be fully meshed.
Configuring a Route Reflector and Specifying Clients
RRs reflect routes between clients, and therefore IBGP connections do not need to be established between the clients.
Context
In an AS, one router functions as an RR, the other routers function as clients. IBGP connections are established between the RR and its clients. The RR and its clients form a cluster. The RR transmits (or reflects) routes between clients, and clients do not need to establish IBGP connections.
An RR simplifies configurations because all configurations need to be configured only on the RR and clients do not need to know that they are clients.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The BGP-IPv4 unicast address family view is displayed.
- Run peer { ipv4-address | group-name } reflect-client
The device is configured as an RR, and a client is specified for it.
The router on which the peer reflect-client command is run functions as the RR, and the specified peer or peer group functions as a client.
The configurations of RRs and clients in an address family are valid only in this address family and cannot be inherited by other address families. Therefore, configure RRs and clients in the required address family.
- Run commit
The configuration is committed.
(Optional) Disabling Route Reflection Between Clients Through the RR
If the clients of a route reflector are fully connected, you need to disable route reflection among them through the RR to reduce bandwidth consumption.
Context
On some networks, if fully meshed IBGP connections have been established between clients, they can directly exchange routing information. Therefore, route reflection between clients through the RR is unnecessary, which also occupies bandwidth. In this case, disable route reflection among them through the RR.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
- Run undo reflect between-clients
Route reflection is disabled among clients through the RR.
If the clients of the route reflector are fully connected, you can use the undo reflect between-clients command to disable route reflection among the clients through the RR. This command is applicable to only the route reflector.
- Run commit
The configuration is committed.
(Optional) Setting the Cluster ID of a Route Reflector
When there are multiple route reflectors in a cluster, you need to configure the same cluster ID for all the route reflectors in this cluster to avoid routing loops.
Context
To enhance network reliability and avoid single points of failure, more than one route reflector can be configured in a cluster. In this case, you need to set the same cluster ID for all the route reflectors in the same cluster. This can reduce the number of routes to be received by each route reflector and save the memory.
To ensure that a client can learn the routes reflected by a route reflector, the cluster ID of the route reflector must be different from the router ID of the client. If they are the same, the client discards the received routes.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
- Run reflector cluster-id { cluster-id-value | cluster-id-ipv4 }
The cluster ID of a route reflector is set.
When there are multiple route reflectors in a cluster, you need to run the command to configure the same cluster-id for all the route reflectors in this cluster.
The reflector cluster-id command can be configured on only route reflectors.
- Run commit
The configuration is committed.
(Optional) Preventing a Device from Adding BGP Routes to the IP Routing Table
After you prevent an RR from adding BGP routes to the IP routing table, the RR no longer forwards traffic, which improves route advertisement efficiency.
Context
In most cases, BGP routes are added to the IP routing table of the router for traffic forwarding. If the router does not need to forward traffic, prevent it from adding BGP routes to the IP routing table.
RRs need to be prevented from adding BGP routes to the IP routing table. An RR no only transmits routes but also forwards traffic. If the RR is connected to many clients and non-clients, the route transmission task will consume a lot of CPU resources of the RR, and as a result, the RR cannot forward traffic. To improve the route transmission efficiency, prevent the RR from adding BGP routes to the IP routing table so that the RR only transmits routes.
Perform the following steps on the router that runs BGP:
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
- Run routing-table rib-only [ route-policy route-policy-name | route-filter route-filter-name ]
The device is prevented from adding BGP routes to the IP routing table.
If route-policy route-policy-name or route-filter route-filter-name is configured in the routing-table rib-only command, routes matching the policy are not added to the IP routing table, and routes that do not match the policy are added to the IP routing table, with the route attributes unchanged.
The routing-table rib-only and active-route-advertise commands are mutually exclusive.
- Run commit
The configuration is committed.
(Optional) Enabling an RR to Modify Route Attributes Using an Export Policy
You can enable an RR to modify route attributes using an export policy to control BGP route selection.
Context
Route attributes cannot be modified using an export policy on an RR because it would cause routing loops. By default, an RR is disabled from modifying route attributes based on an export policy. However, if you need to re-plan the network traffic, you can enable the RR to modify route attributes based on an export policy.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
- Run reflect change-path-attribute
The RR is configured to modify path attributes of BGP routes based on an export policy.
After the reflect change-path-attribute command is run on an RR, the configuration of modifying path attributes of routes based on an export policy takes effect. The following configurations can take effect:- apply as-path: modifies the AS_Path attribute of BGP routes.
- apply comm-filter delete: deletes community attributes from BGP routes.
- apply community: modifies the community attribute of BGP routes.
- apply large-community: modifies the Large-community attribute of BGP routes.
- apply cost: modifies the MED value (cost) of BGP routes.
- apply ip-address nexthop: modifies the next-hop IP address of BGP routes.
- apply local-preference: modifies the Local_Pref value of BGP routes.
- apply origin: modifies the Origin attribute of BGP routes.
- apply extcommunity: modifies the VPN target extended community attribute of BGP routes.
apply extcommunity soo { site-of-origin } &<1-16> additive: modifies the SoO extended community attribute of BGP routes.
After the reflect change-path-attribute command is run on the RR, the peer route-policy export command takes precedence over the peer next-hop-invariable and peer next-hop-local commands.
- Run commit
The configuration is committed.
Configuring a BGP Confederation
On a large BGP network, configuring a BGP confederation reduces the number of IBGP connections and simplifies routing policy management, which increases the route advertisement efficiency.
Usage Scenario
A confederation is a solution to the increasing number of IBGP connections in an AS. The confederation divides an AS into multiple sub-ASs. In each sub-AS, IBGP peer relationships are set up or an RR is configured on one of the IBGP peers. EBGP connections are set up between sub-ASs.
Compared with RRs, confederations facilitate IGP extensions.
Pre-configuration Tasks
Before configuring a BGP confederation, complete the following tasks:
Configure link layer protocol parameters and assigning IP addresses to the interfaces to ensure that the status of the link layer protocol of the interface is Up.
Procedure
- Configure a BGP Confederation.
Perform the following steps on the BGP device:
- Configure the compatibility of the confederation.
If some routers in a confederation do not comply with the standard protocols, you can perform the following steps so that the local device is compatible with them:
Verifying the Configuration
- Run the display bgp peer [ ipv4-address ] verbose command to check detailed peer information.
- Run the display bgp routing-table [ network ] [ mask | mask-length ] [ longer-prefixes ] command to check information about routes in the BGP routing table.
Configuring BGP Community Attributes
Community attributes simplify routing policy management.
Usage Scenario
Community attributes are used to simplify routing policy application and facilitate network maintenance. They allow a group of BGP devices in different ASs to share the same routing policies. Before advertising a route with the community attribute to peers, a BGP device can change the original community attribute of this route. Community attributes are route attributes, which are transmitted between BGP peers, and the transmission is not restricted within an AS.
Configuring Community Attribute Advertisement
A community attribute defined in a routing policy takes effect only after community attribute advertisement is configured.
Verifying the BGP Community Attribute Configuration
After configuring BGP community attributes, verify the configured BGP community attributes.
Procedure
- Run the display bgp routing-table network [ mask | mask-length ] command to check information about BGP routes.
- Run the display bgp routing-table community [ community-number | aa:nn ] &<1-29> [ internet | no-advertise | no-export | no-export-subconfed ] * [ whole-match ] command to check information about the routes carrying specified BGP community attributes.
Configuring the BGP Large-Community Attribute
The Large-Community attribute can be used to flexibly apply route-policies.
Usage Scenario
The Large-Community attribute can represent a 2-byte or 4-byte Autonomous System Number (ASN), and has two 4-byte LocalData IDs. The administrator can therefore apply route-policies more flexibly. The Large-Community attribute extends and can be used together with a community attribute.
Pre-configuration Tasks
Before configuring the BGP Large-Community attribute, configure basic BGP functions.
Configuring a Route-Policy Related to the Large-Community Attribute
Before configuring the Large-Community attribute for routes, configure a route-policy in which the Large-Community attribute is applied.
Procedure
- Run system-view
The system view is displayed.
- Run route-policy route-policy-name matchMode node node
A route-policy with a node is created, and the route-policy view is displayed.
- (Optional) Configure filtering conditions (if-match clauses) for the route-policy. Large-Community values can be added only to the BGP routes that pass the filtering, and the Large-Community values of only these routes can be modified.
For details, see (Optional) Configuring an if-match Clause.
- Run apply large-community { aa:bb:cc } &<1-16> { additive | overwrite | delete } or apply large-community-list large-community-list-name { additive | overwrite | delete }
Large-Community values are configured for BGP routes.
- Run commit
The configuration is committed.
Configuring the Device to Advertise the Large-Community Attribute
The large-community attribute defined in a routing policy takes effect only after the large-community attribute is advertised.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
- Run peer { ipv4-address | group-name } route-policy route-policy-name export
An export route-policy is configured.
When configuring the BGP Large-Community attribute, use a route-policy to define specific Large-Community values, and then apply the route-policy to the routes to be advertised.
For details about the route-policy configuration, see the chapter "Routing Policy Configuration".
- Run peer { ipv4-address | group-name } advertise-large-community
The device is enabled to advertise the Large-Community attribute to a peer or peer group.
- Run commit
The configuration is committed.
Verifying the Large-Community Configuration
After configuring the BGP Large-Community attribute, verify the configuration.
Procedure
- Run the display bgp routing-table network [ mask | mask-length ] command to check information about BGP routes.
- Run the display bgp routing-table large-community [aa:bb:cc ] &<1-33> [ whole-match ] command to check information about the routes with the specified BGP Large-Community attribute.
Configuring Prefix-based BGP ORF
Prefix-based BGP ORF enables a device to send its peer the local prefix-based import policy so that the peer can use the policy to filter routes before sending them to the local device.
Usage Scenario
When a device expects to receive only required routes from the remote device and the remote end does not want to maintain a separate export policy for each connected peer, you can configure prefix-based ORF which supports on-demand route advertisement.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
- Run peer { group-name | ipv4-address } ip-prefix ip-prefix-name import
An IP prefix list-based import policy is configured to filter routes received from the specified peer or peer group.
- Run the peer { group-name | ipv4-address } capability-advertise orf [ non-standard-compatible ] ip-prefix { both | receive | send } command to configure prefix-based ORF for a BGP peer or peer group.
- Run commit
The configuration is committed.
Checking the Configurations
Run the display bgp peer [ ipv4-address ] verbose command to check detailed information about BGP peers.
Run the display bgp peer ipv4-address orf ip-prefix command to check routes received from a specified peer after the prefix-based ORF is configured.
Adjusting the BGP Network Convergence Speed
You can adjust the BGP network convergence speed by adjusting BGP peer connection parameters to adapt to changes on large-scale networks.
Usage Scenario
BGP is used to transmit routing information on large-scale networks. Frequent network changes affect the establishment and maintenance of BGP peer relationships, which in turn affects the BGP network convergence speed.
The route dampening and triggered update functions of BGP suppress frequent route changes to a certain extent, but cannot minimize the impact of network flapping on BGP connections.
BGP Keepalive and Hold timers
BGP uses Keepalive messages to maintain BGP peer relationships and monitor connection status. After establishing a BGP connection, two peers send Keepalive messages periodically to each other to detect the BGP connection status based on the Keepalive timer. If a router does not receive any Keepalive message or any other types of packets from its peer within the hold time set by the Hold timer, the router considers the BGP connection interrupted and terminates the BGP connection.
BGP MinRouteAdvertisementIntervalTimer
BGP does not periodically update a routing table. When BGP routes change, BGP updates the changed BGP routes in the BGP routing table by sending Update messages. If a route changes frequently, to prevent the router from sending Update messages upon every change, set the interval at which Update messages are sent.
Rapid EBGP peer reset
Rapid EBGP connection reset is enabled by default so that EBGP can quickly detect the status of interfaces used to establish EBGP connections. If the interface status changes frequently, you can disable rapid EBGP connection reset so that direct EBGP sessions will not be reestablished and deleted as interface alternates between Up and Down, which speeds up network convergence.
BGP ConnectRetry Timer
After BGP initiates a TCP connection, the ConnectRetry timer will be stopped if the TCP connection is established successfully. If the first attempt to establish a TCP connection fails, BGP re-establishes the TCP connection after the ConnectRetry timer expires.
Setting a short ConnectRetry interval reduces the period BGP waits between attempts to establish a TCP connection, which speeds up the establishment of the TCP connection.
Setting a long connectRetry interval suppresses routing flapping caused by peer relationship flapping.
After slow peer detection is configured on a device, the device identifies the slow BGP peer (if any) and removes it from the update peer-group to prevent this slow peer from affecting route advertisement to other peers in this update peer-group. Slow peer detection speeds up BGP network convergence.
Pre-configuration Tasks
Before setting parameters for a BGP peer connection, configure basic BGP functions.
Configuring BGP Keepalive and Hold Timers
The values of BGP Keepalive and Hold timers determine the speed at which BGP detects network faults. You can adjust the values of these timers to improve network performance.
Context
BGP uses Keepalive messages to maintain peer relationships. After establishing a BGP connection, two peers periodically send Keepalive messages to each other to detect BGP peer relationship status. If a device receives no Keepalive message from its peer after the Hold timer expires, the device considers the BGP connection interrupted.
- If short Keepalive time and holdtime are set, BGP can fast detect link faults. This speeds up BGP network convergence, but increases the number of Keepalive messages on the network and loads of routers, and consumes more network bandwidth resources.
- If long Keepalive time and holdtime are set, the number of Keepalive messages on the network and loads of routers are reduced. If the Keepalive time is too long, BGP cannot fast detect link status changes, which slows down BGP network convergence and may cause packet loss.
Changing timer values using the timer command or the peer timer command interrupts BGP peer relationships between routers. Therefore, exercise caution before running either of the command.
Keepalive and Hold timers can be configured either for all peers or peer groups, or for a specific peer or peer group. Keepalive and Hold timers configured for a specific peer take precedence over those configured for the peer group of this peer. In addition, Keepalive and Hold timers configured for a specific peer or peer group take precedence over those configured for all peers or peer groups.
Configuring a MinRouteAdvertisementIntervalTimer
A proper MinRouteAdvertisementIntervalTimer can be configured to suppress frequent route changes, improving BGP network stability.
Context
BGP peers use update messages to exchange routing information. Update messages can be used to advertise reachable routes with the same attributes or delete unreachable routes.
BGP does not periodically update a routing table. When BGP routes change, BGP updates the changed BGP routes in the BGP routing table by sending Update messages. If a route changes frequently, to prevent the router from sending Update messages upon every change, configure a MinRouteAdvertisementIntervalTimer at which Update messages are sent.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run peer { ipv4-address | group-name } route-update-interval interval
A MinRouteAdvertisementIntervalTimer is configured.
ipv4-address specifies the address of a specific peer, while group-name specifies the name of a peer group. The MinRouteAdvertisementIntervalTimer configured for a peer takes precedence over that configured for a peer group.
- Run commit
The configuration is committed.
Disabling Fast Reset of EBGP Connections
Disabling rapid EBGP connection reset can prevent frequent reestablishment and deletion of EBGP sessions if route flapping occurs, which speeds up BGP network convergence.
Context
With rapid EBGP connection reset, BGP can immediately respond to a fault on an interface and delete the direct EBGP sessions on the interface without waiting for the hold timer to expire, which speeds up BGP network convergence. Rapid EBGP connection reset is enabled by default.
Rapid EBGP connection reset enables BGP to quickly respond to interface faults, but not interface recovery. After the interface recovers, BGP uses its state machine to restore relevant sessions.
If the status of an interface used to establish an EBGP connection changes frequently, the EBGP session will be deleted and reestablished repeatedly, causing network flapping. To address this issue, disable rapid EBGP connection reset so that BGP will not delete direct EBGP sessions on the interface until the hold timer expires. Therefore, disabling rapid EBGP connection reset suppresses BGP network flapping, speed up BGP network convergence, and reduce network bandwidth consumption.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run undo ebgp-interface-sensitive
Rapid EBGP connection reset is disabled.
Disable rapid EBGP connection reset only when the status of an interface used to establish an EBGP connection changes frequently. If the status of the interface becomes stable, run the ebgp-interface-sensitive command to enable rapid EBGP connection reset.
- Run commit
The configuration is committed.
Configuring a BGP ConnectRetry Timer
You can control the speed at which BGP peer relationships are established by changing the BGP ConnectRetry timer value.
Context
- Setting a short ConnectRetry interval reduces the period BGP waits between attempts to establish a TCP connection, which speeds up the establishment of the TCP connection.
- Setting a long connectRetry interval suppresses routing flapping caused by peer relationship flapping.
A ConnectRetry timer can be configured either for all peers or peer groups, or for a specific peer or peer group. A ConnectRetry timer configured for a specific peer takes precedence over that configured for the peer group of this peer. In addition, a ConnectRetry timer configured for a specific peer or peer group takes precedence over that configured for all peers or peer groups.
Enabling Slow Peer Detection
After slow peer detection is configured on a device, the device identifies the slow BGP peer (if any) and removes it from the update peer-group to prevent this slow peer from affecting route advertisement to other peers in this update peer-group. Slow peer detection speeds up BGP network convergence.
Context
An update peer-group may consist of multiple BGP peers. If a network problem (congestion for example) occurs and slows down the speed at which the local device advertises routes to a BGP peer in the update peer-group, the speed at which the local device advertises routes to other BGP peers in the update peer-group is affected. To address this problem, enable slow peer detection.
After slow peer detection is enabled, the local device calculates the difference between the time taken to send packets to each BGP peer and the shortest time taken to send packets to a BGP peer in the group. If the difference between the time taken to send packets to a BGP peer and the shortest time is greater than the threshold, the local device considers this BGP peer as a slow peer and removes it from the update peer-group, which prevents this slow peer from affecting route advertisement to other peers in the group.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run slow-peer detection threshold threshold-value
Slow peer detection is enabled.
threshold threshold-value specifies a slow peer detection threshold. If the difference between the time taken to send packets to a BGP peer and the shortest time taken to send packets to another BGP peer is greater than the threshold-value, the local device considers the former BGP peer as a slow peer and removes it from the update peer-group.
- Run commit
The configuration is committed.
Configuring a Dynamic BGP Peer Group
Configuring dynamic BGP peer groups reduces network maintenance workload.
Usage Scenario
On a BGP network, multiple peers may frequently change, causing the establishment of peer relationships to change accordingly. If you configure peers in static mode, you need to frequently add or delete peer configurations on the local device, which increases the maintenance workload. To address this problem, configure the dynamic BGP peer function to enable BGP to listen for BGP connection requests from a specified network segment, dynamically establish BGP peer relationships, and add these peers to the same dynamic peer group. This spares you from adding or deleting BGP peer configurations in response to each change in BGP peers.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- (Optional) Run bgp dynamic-session-limit max-num
The maximum number of dynamic BGP peer sessions that can be established is set.
- Run group group-name listen [ internal | external | confederation-external ]
A dynamic BGP peer group is created.
- Run either of the following commands to configure the peer AS number or AS range from which the dynamic EBGP peer group listens for BGP connection requests.
- To specify the peer AS number from which the dynamic EBGP peer group listens for BGP connection requests, run the peer group-name listen-as { asn } &<1-6> command.
- To specify the peer AS range from which the dynamic EBGP peer group listens for BGP connection requests, run the peer group-name listen-as-segment begin-as begin-asn end-as end-asn command.
This step is not needed for dynamic IBGP peer groups.
- Run peer group-name listen-net ipv4-address { mask | mask-length }
A network segment from which the dynamic BGP peer group listens for BGP connection requests is specified.
- Run commit
The configuration is committed.
Configuring a BGP Device to Send a Default Route to Its Peer
After a BGP device is configured to send a default route to its peer, the BGP device sends a default route with the local address as the next hop address to the specified peer, regardless of whether there are default routes in the local routing table, which reduces the number of routes on the network.
Usage Scenario
The BGP routing table of the router on a medium or large BGP network contains a large number of routing entries. Storing the routing table consumes a large number of memory resources, and transmitting and processing routing information consume lots of network resources. If a device needs to send multiple routes to its peer, you can configure the device to send only a default route with the local address as the next hop address to its peer, regardless of whether there are default routes in the local routing table. This greatly reduces the number of routes on the network and the consumption of memory resources on the peer and network resources.
On the network shown in Figure 1-1767, Device A and Device B have established a BGP peer relationship. Device B has added routes to 10.1.1.0/24, 10.2.1.0/24, and 10.3.1.0/24 to its BGP routing table. Device A needs to learn these routes from Device B. In this way, Device A retains three BGP routes. To reduce the memory consumption on Device A and bandwidth used by Device B for sending routing information to Device A, configure Device B to send a default route to its peer (Device A) and use a routing policy to prevent Device B from sending all the routes to 10.1.1.0/24, 10.2.1.0/24, and 10.3.1.0/24 to Device A. Then, Device A stores only one default route but can still send traffic to the three network segments.
Pre-configuration Tasks
Before configuring a BGP device to send a default route to its peer, configure basic BGP functions.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
- Run peer { group-name | ipv4-address } default-route-advertise [ route-policy route-policy-name | route-filter route-filter-name ] [ conditional-route-match-all { ipv4-address1 { mask1 | mask-length1 } } &<1-4> | conditional-route-match-any { ipv4-address2 { mask2 | mask-length2 } } &<1-4> ]
The device is configured to send a default route to the specified peer or a peer group.
If route-policy route-policy-name or route-filter route-filter-name is set, the BGP device changes attributes of the default route based on the specified route policy.
If conditional-route-match-all { ipv4-address1 { mask1 | mask-length1 } } &<1-4> is set, the BGP device sends the default route to the peer only when routes that match all the all specified conditions exist in the local routing table.
If conditional-route-match-any { ipv4-address2 { mask2 | mask-length2 } } &<1-4> is set, the local device sends a default route to the peer when routes that match any of the specified conditions exist in the local routing table.
After the peer default-route-advertise command is used on a device, the device sends a default route with the local address as the next-hop address to a specified peer, regardless of whether there is a default route in the routing table.
- Run commit
The configuration is committed.
Configuring a Device to Advertise BGP Supernet Unicast Routes to BGP Peers
This section describes how to configure a Border Gateway Protocol (BGP) device to advertise BGP supernet unicast routes to BGP peers.
Usage Scenario
- If bitwise AND operations are performed on the destination address mask with the destination address and next hop address, the two obtained network addresses are the same, and destination address mask is greater than or equal to the next hop address mask.
- If bitwise AND operations are performed on the destination address mask with the destination address and next hop address, the two obtained network addresses are different. If bitwise AND operations are performed on the next hop address mask with the destination address and next hop address, however, the two obtained network addresses are the same.
For example, the route with the destination address being 6.6.6.6 in the following command output is a BGP supernet route.
<HUAWEI> display bgp routing-table
BGP Local router ID is 1.1.1.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 1 Network NextHop MED LocPrf PrefVal Path/Ogn *>i 6.6.6.6/32 6.6.6.6 0 100 0 i
By default, when a BGP device receives a BGP supernet unicast route, the BGP device sets the route invalid and does not advertise it to other BGP peers. If a Huawei device is connected to a non-Huawei device and you want the Huawei device to advertise BGP supernet unicast routes that it receives from the non-Huawei device to other BGP peers, configure the Huawei device to advertise BGP supernet unicast routes to BGP peers.
Pre-configuration Tasks
Before you configure a BGP device to send BGP supernet unicast routes to BGP peers, configure basic BGP functions.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The BGP-IPv4 unicast address family view is displayed.
- Run supernet unicast advertise enable
The BGP device is enabled to advertise BGP supernet unicast routes to BGP peers.
- Run commit
The configuration is committed.
Verifying the Configuration
Run the display bgp routing-table command to check BGP supernet unicast routes.
Run the display bgp routing-table network command to check information about a specified BGP supernet unicast route advertised to BGP peers.
Configuring BGP Load Balancing
BGP load balancing improves network resource usage and reduces network congestion.
Usage Scenario
On large networks, there may be multiple valid routes to the same destination. BGP, however, advertises only the optimal route to its peers, which may result in load imbalance.
Either of the following methods can be used to resolve the traffic imbalance:
Use BGP routing policies to allow traffic to be balanced. For example, use a routing policy to modify the Local_Pref, AS_Path, Origin, or MED attribute of BGP routes to control traffic forwarding and implement load balancing.
Use multiple paths to implement traffic load balancing. This method requires that multiple equal-cost routes exist and the number of routes allowed to participate in load balancing be set. Load balancing can be implemented globally or for a specified peer or peer group.
You can change load balancing rules through configurations. For example, you can prevent the device from comparing AS_Path attributes or IGP costs. When performing these configurations, ensure that no routing loops will occur.
Locally leaked routes and routes imported between public network and VPN instances do not support load balancing.
Procedure
- Configure BGP peer or peer group-based load balancing.
Run system-view
The system view is displayed.
Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The BGP-IPv4 unicast address family view is displayed.
Run peer { ipv4-address | ipv6–address | group-name } load-balancing [ as-path-ignore | as-path-relax ]
BGP peer or peer group-based load balancing is enabled.
After the peer load-balancing command is run, load balancing is implemented only when the following conditions are met:- The routes are received from a specified peer or peer group.
- The routes are optimal routes or optimal equal-cost routes.
- The AS_Path attribute of the routes is the same as that of the optimal route, or as-path-ignore or as-path-relax is specified when peer-based load balancing is configured.
- If as-path-ignore is specified, the device ignores comparing AS_Path attributes when selecting routes for load balancing. In this case, routes can participate in load balancing even if their AS_Path attributes are different.
- If as-path-relax is specified, the device ignores comparing the AS_Path attributes of the same length when selecting routes for load balancing. In this case, routes cannot participate in load balancing if their AS_Path attributes are of different lengths. For example, the AS_Path attribute of route A is 10, and the AS_Path attribute of route B is 10, 20. Because the two AS_Path attributes are of different lengths, the two routes cannot participate in load balancing.
- (Optional) Enable peer or peer group-based load balancing among VPN routes.
- Run quit
Return to the BGP view.
- Run quit
Return to the system view.
- Run ip vpn-instance vpn-instance-name
The VPN instance view is displayed.
- Run ipv4-family unicast
The VPN instance IPv4 address family view is displayed.
- Run route-distinguisher route-distinguisher
An RD is configured for the VPN instance IPv4 address family.
- Run quit
Return to the VPN instance view.
- Run quit
Return to the system view.
- Run bgp as-number
The BGP view is displayed.
- Run vpn-instance vpn-instance-name
A VPN instance is specified.
- Run peer { ipv4-address | group-name } as-number as-number
A peer relationship is established with the peer with the specified AS number.
- Run quit
Return to the BGP view.
- Run ipv4-labeled-unicast vpn-instance vpn-instance-name
The BGP labeled VPN instance IPv4 address family view is displayed.
- Run peer { ipv4-address | group-name } enable
The device is enabled to exchange routing information with the specified peer.
- Run peer { ipv4-address | group-name } load-balancing [ as-path-ignore | as-path-relax ]
Peer or peer group-based load balancing among VPN routes is enabled.
- Run quit
(Optional) Change load balancing rules.
- To prevent the device from comparing AS_Path attributes when selecting routes for load balancing, run the load-balancing as-path-ignore command.
- To configure the device to ignore comparing the AS_Path attributes of the same length when selecting routes for load balancing, run the load-balancing as-path-relax command.
- To prevent the device from comparing IGP costs when selecting routes for load balancing, run the load-balancing igp-metric-ignore command.
The address family views supported by the preceding commands are different. When running any of the commands, ensure that the command is run in the correct address family view.
Change load balancing rules based on network requirements and exercise caution when running the commands.
Run commit
The configuration is committed.
- Configure global BGP load balancing.
- Set the maximum number of BGP routes for load balancing.
Run system-view
The system view is displayed.
Run bgp as-number
The BGP view is displayed.
Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
Run maximum load-balancing [ ebgp | ibgp ] number [ ecmp-nexthop-changed ]
The maximum number of equal-cost BGP routes for load balancing is set.
ebgp indicates that load balancing is implemented only among EBGP routes.
ibgp indicates that load balancing is implemented only among IBGP routes.
If neither ebgp nor ibgp is specified, both EBGP and IBGP routes can balance traffic, and the number of EBGP routes for load balancing is the same as the number of IBGP routes for load balancing.
Before routes to the same destination implement load balancing on a public network, a device determines the type of optimal route. If IBGP routes are optimal, only IBGP routes carry out load balancing. If EBGP routes are optimal, only EBGP routes carry out load balancing. This means that load balancing cannot be implemented using both IBGP and EBGP routes with the same destination address.
(Optional) Change load balancing rules.
- To prevent the device from comparing AS_Path attributes when selecting routes for load balancing, run the load-balancing as-path-ignore command.
- To configure the device to ignore comparing the AS_Path attributes of the same length when selecting routes for load balancing, run the load-balancing as-path-relax command.
- To prevent the device from comparing IGP costs when selecting routes for load balancing, run the load-balancing igp-metric-ignore command.
The address family views supported by the preceding commands are different. When running any of the commands, ensure that the command is run in the correct address family view.
Change load balancing rules based on network requirements and exercise caution when running the commands.
Run commit
The configuration is committed.
Set the maximum number of EBGP and IBGP routes for load balancing.
This configuration is used in a VPN where a CE is dual-homed to two PEs. When the CE resides in the same AS as only one of the PEs, you can set the maximum number of EBGP and IBGP routes for load balancing so that VPN traffic can be balanced among EBGP and IBGP routes.
Run system-view
The system view is displayed.
Run bgp as-number
The BGP view is displayed.
Run ipv4-family vpn-instance vpn-instance-name
The BGP-VPN instance IPv4 address family view is displayed.
Run maximum load-balancing eibgp number [ ecmp-nexthop-changed ]
The maximum number of EBGP and IBGP routes for load balancing is set.
After the maximum load-balancing eibgp number command is run on a device, the device, by default, changes the next hop of each route to itself before advertising the route to a peer, regardless of whether the route is to be used for load balancing. However, in RR or BGP confederation scenarios, the device does not change the next hop addresses of non-local routes to be advertised to a local address. As a result, besides the routes for load-balancing, those routes that are not supposed to participate in load balancing deliver traffic to the device, which overburdens the device. To address this problem, you can set ecmp-nexthop-changed so that the device changes the next hop of only routes that are to be used for load balancing to itself before advertising them to peers.
(Optional) Change load balancing rules.
- To prevent the device from comparing AS_Path attributes when selecting routes for load balancing, run the load-balancing as-path-ignore command.
- To configure the device to ignore comparing the AS_Path attributes of the same length when selecting routes for load balancing, run the load-balancing as-path-relax command.
- To prevent the device from comparing IGP costs when selecting routes for load balancing, run the load-balancing igp-metric-ignore command.
The address family views supported by the preceding commands are different. When running any of the commands, ensure that the command is run in the correct address family view.
Change load balancing rules based on network requirements and exercise caution when running the commands.
Run commit
The configuration is committed.
- Configure load balancing among VPN unicast routes and leaked routes.
This configuration is mainly used in an EIBGP load balancing scenario where a CE that is single-homed to a PE accesses a CE that is dual-homed to PEs. As shown in Figure 1-1768, CE2 is dual-homed to PE1 and PE2. CE1 and CE2 are connected to PE1, and CE2 and CE3 are connected to PE2. When CE1 or CE3 needs to access CE2, you can configure load balancing among VPN unicast routes and leaked routes on PE1 and PE2. In this manner, when CE1 or CE3 accesses CE2, load balancing can be implemented through PE1 and PE2, that is, load balancing among VPN routes and leaked routes.
- Run system-view
The system view is displayed.
- Run ip vpn-instance vpn-instance-name
A VPN instance is created, and its view is displayed.
- Run route-distinguisher route-distinguisher
An RD is configured for the VPN instance.
- Run apply-label { per-nexthop | per-route } pop-go
A label distribution mode is configured for the current VPN.
- Run quit
Return to the system view.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family vpn-instance vpn-instance-name
The BGP-VPN instance IPv4 address family view is displayed.
Run load-balancing local-learning cross
Load balancing among VPN unicast routes and leaked routes is configured.
The load-balancing local-learning cross command can be run only after the apply-label { per-nexthop | per-route } pop-go command is run in the corresponding address family view of a VPN instance. If the apply-label { per-nexthop | per-route } pop-go command is not run, routing loops may occur between PEs.
The load-balancing local-learning cross command is mutually exclusive with the segment-routing ipv6 locator evpn, segment-routing ipv6 locator, vxlan vni, and evpn mpls routing-enable commands.
- Run commit
The configuration is committed.
- Run system-view
- Set the maximum number of BGP routes for load balancing.
Follow-up Procedure
When BGP routes carrying the link bandwidth extended community attribute are available for load balancing and they all recurse to IP routes or tunnels, you can run the load-balancing ucmp command in the BGP-IPv4 unicast address family view or BGP view to implement unequal-cost load balancing among BGP routes based on the link bandwidth extended community attribute. With this function, when there are multiple egress devices to the destination, unequal-cost load balancing can be implemented based on the actual bandwidth capability of each egress device. The methods of configuring the link bandwidth extended community attribute are as follows:
- Use XPL to configure the link bandwidth extended community attribute.
- Run the peer generate-link-bandwidth command to configure the local device to obtain the link bandwidth of a specified directly connected EBGP peer and generate the extended community attribute accordingly.
Verifying the Configuration
After configuring BGP load balancing, verify the configuration.
Run the display bgp routing-table [ network ] [ mask | mask-length ] [ longer-prefixes ] command to check information about the BGP routing table.
Run the display ip routing-table [ verbose ] command to check information about the IP routing table.
Configuring BGP LSP Load Balancing
Configuring BGP LSP load balancing improves network resource utilization and reduces network congestion.
Context
On large networks, there may be multiple valid routes to the same destination. BGP, however, advertises only the optimal route to its peers. This may result in unbalanced traffic on different routes.
- Use BGP policies for load balancing. For example, use a routing policy to modify the Local_Pref, AS_Path, Origin, or MED attribute of BGP routes to divert traffic to different forwarding paths for load balancing.
- Use multiple paths for load balancing. To use this method, equal-cost routes must exist and you need to configure the maximum number of load-balancing routes.
In some BGP LSP scenarios, for example, in the scenario where BGP unicast routes recurse to LSPs, or in the scenario where BGP LSPs can recurse to multiple TE/LDP tunnels, traffic must be balanced to prevent network congestion. BGP LSP load balancing allows traffic to be balanced based on the maximum number of load-balancing routes configured on ingress and transit nodes of BGP LSPs when the traffic is forwarded along the BGP LSPs, which improves network resource utilization and reduces network congestion.
Procedure
- Configure ingress LSP load balancing on an ingress node.
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- (Optional) Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
- Run maximum load-balancing ingress-lsp ingressNumber
The maximum number of equal-cost BGP labeled routes is set for ingress LSP load balancing.
Run commit
The configuration is committed.
- Run system-view
- Configure transit LSP load balancing on a transit node.
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- (Optional) Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
- Run maximum load-balancing transit-lsp transitNumber
The maximum number of equal-cost BGP labeled routes is set for transit LSP load balancing.
Run commit
The configuration is committed.
- Run system-view
Verifying the Configuration
After configuring transit LSP load balancing, run the display bgp routing-table and display ip routing-table commands to check whether load balancing has taken effect on the transit node. If the same destination IP address corresponds to more than one next hop, load balancing has taken effect.
Configuring a BGP SR LSP
Deploying a complete BGP SR LSP on devices in the same AS helps implement end-to-end service interworking.
Context
On the network shown in Figure 1-1769, OSPF runs between DeviceA and DeviceB, between DeviceB and DeviceC, and between DeviceD and DeviceE. IS-IS runs between DeviceC and DeviceD. Basic MPLS capabilities and MPLS LDP are configured on DeviceA through DeviceE so that LDP LSPs are established between loopback interfaces of devices in each IGP area. Therefore, traffic between loopback interfaces of devices in each IGP area is encapsulated using MPLS. However, traffic cannot be transmitted across IGP areas because devices cannot ping each other across IGP areas. For example, DeviceA cannot ping DeviceE. To solve this problem, you need to configure an inner MPLS tunnel (BGP SR LSP) from 1.1.1.1 to 5.5.5.5 so that the traffic from 1.1.1.1 to 5.5.5.5 is forwarded through MPLS.
Procedure
- Configure an SRGB.
- Run system-view
The system view is displayed.
- Run bgp as-number
BGP is started (with the local AS number specified), and the BGP view is displayed.
- Run segment-routing global-block begin-value end-value
A BGP SRGB is configured.
- Run commit
The configuration is committed.
- Run system-view
- Configure a BGP peer relationship.
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run peer ipv4-address as-number as-number
The IP address of a peer and the number of the AS where the peer resides are specified.
- Run peer ipv4-address connect-interface interface-type interface-number [ ipv4-source-address ]
A source interface and a source address to set up a TCP connection with the BGP peer are specified.
- Run commit
The configuration is committed.
- Run system-view
- Configure DeviceC and DeviceD as RRs.
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
- Run peer { ipv4-address | group-name } reflect-client
An RR is configured, and its peer is specified as a client.
Configure DeviceA and DeviceD as clients of DeviceC, and configure DeviceC and DeviceE as clients of DeviceD.
- Run peer { ipv4-address | group-name } next-hop-local
The device is configured to set the next hop address to its own address when advertising routes to clients.
To enable DeviceC or DeviceD to change the next hop address of a route to the local address before advertising the route to clients, run the peer next-hop-local command on DeviceC or DeviceD for each related client.
- Run commit
The configuration is committed.
- Run system-view
- Enable the function to exchange labeled IPv4 routes.
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run peer { ipv4-address | group-name } label-route-capability [ check-tunnel-reachable ]
The device is configured to exchange labeled IPv4 routes with a specified BGP peer.
- Run commit
The configuration is committed.
- Run system-view
- Configure the ingress for a BGP SR LSP.
- Run system-view
The system view is displayed.
- Run route-policy route-policy-name matchMode node node
A route-policy with a node is created, and the route-policy view is displayed.
- Run apply mpls-label
The device is configured to allocate labels to IPv4 routes.
- Run quit
Return to the system view.
- Run bgp as-number
The BGP view is displayed.
- Run network ipv4-address [ mask | mask-length ] [ route-policy route-policy-name | route-filter route-filter-name ] [ non-relay-tunnel ] label-index label-index-value
BGP is configured to import a local route, and an offset is specified for the SRGB.
- Run peer { ipv4-address | group-name } route-policy route-policy-name export
The route-policy is applied to the routes to be advertised to the specified BGP peer.
- Run ipv4-family unicast
The BGP-IPv4 unicast address family view is displayed.
- Run peer peerIpv4Addr prefix-sid
The device is configured to exchange prefix SID information with the specified IPv4 peer.
- Run commit
The configuration is committed.
- Run system-view
- Configure a transit node for the BGP SR LSP.
- Run system-view
The system view is displayed.
- Run route-policy route-policy-name matchMode node node A route-policy with a node is created, and the route-policy view is displayed.
- Run if-match mpls-label
Labeled IPv4 routes are matched.
- Run apply mpls-label
The device is configured to allocate labels to IPv4 routes.
- Run quit
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run peer { ipv4-address | group-name } route-policy route-policy-name export
The route-policy is applied to the routes to be advertised to the specified BGP peer.
- Run ipv4-family unicast
The BGP-IPv4 unicast address family view is displayed.
- Run peer peerIpv4Addr prefix-sid
The device is configured to exchange prefix SID information with the specified IPv4 peer.
- Run commit
The configuration is committed.
- Run system-view
Verifying the Configuration
After configuring the function, verify the configuration.
- Run the display bgp routing-table ipv4-address [ mask | mask-length ] prefix-sid srgb command to check SRGB information of the BGP routes with a specified destination address.
- Run the display mpls lsp command to check BGP SR LSP information.
Configuring Path MTU Auto Discovery
Path MTU auto discovery allows BGP to discover the smallest MTU value on a path so that BGP messages are transmitted based on the path MTU. This function improves transmission efficiency and BGP performance.
Usage Scenario
The link-layer MTUs of different networks that a communication path traverses may vary. The smallest MTU on the path is the most important factor that influences the communication between the two ends of the path. The smallest MTU on the communication path is called the path MTU.
The path MTU varies with the selected path and therefore may change. In addition, the path MTU in one direction may be inconsistent with that in the reverse direction. Enabling path MTU auto discovery allows a device to discover the path MTU from the transmit end to the receive end. TCP encapsulates IP packets based on the path MTU when transmitting BGP messages.
In Figure 1-1770, path MTU auto discovery is not enabled, and a BGP peer relationship is established between Device A and Device C. After Device A sends 9000-byte BGP messages to Device C, Device B fragments the messages upon reception by adding one IP header, one Layer 2 frame header, and one Layer 2 frame trailer in each fragment, which reduces transmission efficiency. If a fragment of a message is lost, the message becomes invalid.
In Figure 1-1771, path MTU auto discovery is enabled, and a BGP peer relationship is established between Device A and Device C. Device A sends 9000-byte BGP messages to Device C, and the path MTU is 6000 bytes. In this case, Device B does not fragment the messages upon reception, which improves transmission efficiency.
When path MTU auto discovery is not enabled:
For the sender, the TCP MSS is calculated using the following formula:
For the receiver:
When the device supports SYN Cookie, the MSS is calculated using the following formula:
If the device does not support SYN Cookie, the MSS is calculated using the following formula:
When path MTU auto discovery is enabled:
The sender updates the local MSS only when it sends a packet with the MSS greater than the path MTU. The TCP MSS is calculated using the following formula:
For the receiver:
If the device supports SYN Cookie, the TCP MSS is calculated using the following formula:
If the device does not support SYN Cookie, the TCP MSS is calculated using the following formula:
- CFGMSS: MIN { APPMSS, CLICFGMSS }
- APPMSS: MSS value configured using the peer tcp-mss command
- CLICFGMSS: maximum MSS value configured using the tcp max-mss mss-value command
- MTU-40: interface MTU minus 40
- PMTU-40: path MTU minus 40
- internally-defined MSS value: MSS value, including 216, 460, 952, 1400, 2900, 4900, 7900, and 9500. Upon receipt of a packet, the receive-end device uses the internally-defined MSS value which is smaller than but closest to the MSS of the received packet.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run peer { group-name | ipv4-address } path-mtu auto-discovery
Path MTU auto discovery is enabled.
After the command is run, a BGP peer learns the path MTU, preventing BGP messages from being fragmented during transmission.
A BGP message from one end to the other may travel a path different from the path used by the ACK message that is responded by the other end. Therefore, running this command on both ends is recommended so that both peers exchange messages based on the path MTU.
- Run quit
Return to the system view.
- Run tcp timer pathmtu-age age-time
The aging time is set for an IPv4 path MTU.
The path MTUs vary with the path. If there are multiple routes between two communication hosts and the routes selected for packet transmission change frequently, configure the path MTU aging time so that the system updates path MTUs based on the path MTU aging time, increasing the transmission efficiency.
- Run commit
The configuration is committed.
Configuring BGP Route Recursion to the Default Route
When the next hop of a BGP route is not directly reachable, you can configure BGP route recursion to the default route.
Usage Scenario
The next hops of BGP routes may not be directly reachable. In this case, recursion is required so that the BGP routes can be used for traffic forwarding. You can configure whether to allow BGP routes to recurse to the default route.
Pre-configuration Tasks
Before configuring BGP route recursion to the default route, configure basic BGP functions.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The BGP-IPv4 unicast address family view is displayed.
- Run nexthop recursive-lookup default-route
BGP route recursion to the default route is configured.
- Run commit
The configuration is committed.
Configuring BGP Next Hop Recursion Based on a Route-Policy
Configuring BGP next hop recursion based on a route-policy prevents traffic loss if routes changes.
Usage Scenario
When BGP routes change, BGP needs to perform route recursion on the BGP routes with indirect next hops. If no route-policies are configured to filter the routes on which a BGP route with an indirect next hop depends for recursion, the BGP route may recurse to an incorrect route, which may cause traffic loss. To address this problem, configure BGP next hop recursion based on a route-policy. If no routes match the route-policy, the BGP route with an indirect next hop is considered unreachable. In this situation, incorrect route recursion and traffic loss are prevented.
Pre-configuration Tasks
Before configuring BGP next hop recursion based on a route-policy, complete the following tasks:
Before configuring a route-policy, ensure that the routes on which BGP routes with indirect next hops depend for recursion will not be filtered out by the route-policy. Otherwise, route recursion fails, and traffic cannot be forwarded.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run nexthop recursive-lookup { route-policy route-policy-name | route-filter route-filter-name }
BGP next hop recursion based on a route-policy or route-filter is configured.
The command does not apply to the routes received from directly connected EBGP peers or LinkLocal peers.
- Run commit
The configuration is committed.
Configuring AIGP value on a Route-Policy
BGP prefers the route with the smallest AIGP value during BGP route selection.
The Accumulated Interior Gateway Protocol Metric (AIGP) attribute is an optional non-transitive Border Gateway Protocol (BGP) path attribute. After the AIGP attribute is configured in an AIGP administrative domain, BGP selects paths based on costs in the same manner as an IGP, and all devices in the domain forward data along the optimal routes. During BGP route selection, the AIGP attribute is used as follows:
The priority of a route that carries the AIGP attribute is higher than the priority of a route that does not carry the AIGP attribute.
If two BGP routes both carry the AIGP attribute, the device selects the BGP route whose AIGP value plus the cost of the IGP route to which the BGP route recurses is smaller.
The AIGP attribute can be added to routes only through route-policies. You can configure an apply clause for a route-policy using the apply aigp { [ + | - ] cost | inherit-cost } command to modify the AIGP value during route import, acceptance, or advertisement by BGP. If no AIGP value is configured, the IGP routes imported by BGP do not carry the AIGP attribute.
Run the display bgp routing-table [ ip-address ] command on Device E to check the configurations. The route 10.1.4.0/30 is used in this example.
# Display the routing table of Device E.
[DeviceE] display bgp routing-table
BGP Local router ID is 10.1.1.1 Status codes: * - valid, > - best, d - damped, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Total Number of Routes: 6 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.1.2.0/30 10.1.1.2 0 0 65002? * 10.1.3.2 3 0 65002? *> 10.1.4.0/30 10.1.1.2 2 0 65002? * 10.1.3.2 2 0 65002? *> 10.1.5.0/30 10.1.3.2 0 0 65002? * 10.1.1.2 3 0 65002?
[DeviceE] display bgp routing-table 10.1.4.0
BGP local router ID : 10.1.1.1 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.1.4.0/30: From: 10.1.1.2 (10.1.1.2) Route Duration: 00h02m29s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.1.2 Qos information : 0x0 AS-path 65002, origin incomplete, MED 2, pref-val 0, valid, external, best, select, active, pre 255 Advertised to such 2 peers: 10.1.1.2 10.1.3.2 BGP routing table entry information of 10.1.4.0/30: From: 10.1.3.2 (10.1.5.1) Route Duration: 00h03m58s Direct Out-interface: GigabitEthernet0/2/0 Original nexthop: 10.1.3.2 Qos information : 0x0 AS-path 65002, origin incomplete, MED 2, pref-val 0, valid, external, pre 255, not preferred for router ID Not advertised to any peer yet
The command output when the AIGP attribute is not configured shows that DeviceE selects the route learned from DeviceA after comparing router IDs. To change the route selection result on DeviceE, you can configure the AIGP attribute.
Configurations on Device A:
# bgp 65002 # ipv4-family unicast import-route ospf 1 route-policy aigp_policy //Apply route-policy named aigp_policy to locally imported OSPF routes and use aigp_policy to modify the AIGP value. peer 10.1.1.1 aigp //Enable AIGP on the local device and the peer 10.1.1.1. # route-policy aigp_policy permit node 10 //Define the first node of aigp_policy and set the AIGP value of the route 10.1.4.0/30 to 10. if-match ip-prefix prefix1 apply aigp 10 # route-policy aigp_policy permit node 20 //Define the second node of aigp_policy and allow aigp_policy to permit all routes. # ip ip-prefix prefix1 index 10 permit 10.1.4.0 30 //Configure IP prefix list named prefix1 to match the route 10.1.4.0/30. #
Configurations on Device B:
bgp 65002 peer 10.1.3.1 as-number 65001 # ipv4-family unicast import-route ospf 1 route-policy aigp_policy1 //Apply route-policy named aigp_policy1 to locally imported OSPF routes and use aigp_policy1 to modify the AIGP value. peer 10.1.3.1 aigp //Enable AIGP on the local device and the peer 10.1.3.1. # route-policy aigp_policy1 permit node 10 //Define the first node of aigp_policy1 and set the AIGP value of the route 10.1.4.0/30 to 5. if-match ip-prefix prefix2 apply aigp 5 # route-policy aigp_policy1 permit node 20 //Define the second node of aigp_policy1 and allow aigp_policy1 to permit all routes. # ip ip-prefix prefix2 index 10 permit 10.1.4.0 30 //Configure IP prefix list named prefix2 to match the route 10.1.4.0/30. #
Configurations on Device E:
# bgp 65001 # ipv4-family unicast peer 10.1.1.2 aigp //Enable AIGP on the local device and the peer 10.1.1.2. peer 10.1.3.2 aigp //Enable AIGP on the local device and the peer 10.1.3.2. #
Run the display bgp routing-table [ ip-address ] command on Device E to check the configurations.
# Display the routing table of Device E.
[DeviceE] display bgp routing-table
BGP Local router ID is 10.1.1.1 Status codes: * - valid, > - best, d - damped, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Total Number of Routes: 6 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.1.2.0/30 10.1.1.2 0 0 65002? * 10.1.3.2 3 0 65002? *> 10.1.4.0/30 10.1.3.2 2 0 65002? * 10.1.1.2 2 0 65002? *> 10.1.5.0/30 10.1.3.2 0 0 65002? * 10.1.1.2 3 0 65002?
[DeviceE] display bgp routing-table 10.1.4.0
BGP local router ID : 10.1.1.1 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.1.4.0/30: From: 10.1.3.2 (10.1.5.1) Route Duration: 00h00m14s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.3.2 Qos information : 0x0 AS-path 65002, origin incomplete, MED 2, pref-val 0, valid, external, best, select, active, pre 255, AIGP 5 Advertised to such 2 peers: 10.1.1.2 10.1.3.2 BGP routing table entry information of 10.1.4.0/30: From: 10.1.1.2 (10.1.1.2) Route Duration: 01h01m15s Direct Out-interface: GigabitEthernet0/2/0 Original nexthop: 10.1.1.2 Qos information : 0x0 AS-path 65002, origin incomplete, MED 2, pref-val 0, valid, external, pre 255, AIGP 10, not preferred for AIGP Not advertised to any peer yet
The preceding command output shows that Device E selects the route 10.1.4.0/30 learned from Device B because its AIGP value is smaller.
Configuring the POPGO Function
After the POPGO function is configured on the egress of a BGP LSP, the egress forwards each data packet received from the LSP through the outbound interface found in the ILM based on the label information carried in the packet.
Usage Scenario
On the network shown in Figure 1-1773, DeviceC has two static routes, 10.1.1.0/24 and 10.1.1.0/30, and the next hops of the two routes are DeviceA and DeviceB respectively. DeviceC only imports route 10.1.1.0/24 to BGP and then sends this route to DeviceD. A BGP LSP is established between DeviceC and DeviceD. By default, after DeviceC receives a data packet addressed to 10.1.1.0 from DeviceD, DeviceC removes the LSP label from the packet, searches for an outbound interface in the IP forwarding table according to the longest-match principle, and incorrectly sends the packet to DeviceB.
To solve the preceding problem, configure the apply-label per-route pop-go command on DeviceC. After the apply-label per-route pop-go command is configured, when DeviceC sends route 10.1.1.0/24 to DeviceD, DeviceC records in the ILM the mapping between the label assigned to the route and the outbound interface of the route. Then, after the DeviceC receives a data packet from DeviceD, DeviceC directly searches the ILM for an outbound interface based on label information carried in the packet and forwards the packet through the found outbound interface after removing the packet label. This implementation ensures correct packet forwarding.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run apply-label per-route pop-go
The POPGO function is configured.
- Run commit
The configuration is committed.
Checking the Configurations
After configuring the POPGO function, you can run the following command to check the configuration.
Run the display mpls lsp protocol bgp command. The command output shows detailed BGP LSP information. If POPGO is displayed in the Label Operation field, the POPGO function is successfully configured.
Configuring the Device to Perform the Label Pop-go Action for Packets Carrying the Label Added to Each Received Non-labeled Unicast Route
Configure the labeled route sender to perform the label pop-go action for packets if the packets carry the labels allocated to non-labeled routes received in the BGP-IPv4 unicast address family, so that traffic can be forwarded through the specified path when the destination of the traffic is reachable through an IP route, but not through an LSP.
Usage Scenario
On the network shown in Figure 1-1774, an IBGP peer relationship is established between PE2 and ASBR2, and an EBGP peer relationship is established between ASBR1 and ASBR2. ASBR1 is reachable to ASBR2 through an IP route, but not through the LSP between the two ASBRs. After receiving the packets destined for ASBR1 from PE2, ASBR2 sends the packets to PE1 according to the longest match rule. To allow ASBR2 to perform the pop-go action for the BGP label in the received packets destined for ASBR1 and search the local ILM for an outbound interface based on the label to send the packets to ASBR1, run the unicast-route label pop-go command.
Configuring conversion from BGP IPv4 Unicast Routes to Labeled Routes
Configuring conversion from BGP IPv4 unicast routes to labeled routes can ensure that traffic is forwarded along a specified LSP.
Usage Scenario
On the network shown in Figure 1-1775, an IBGP peer relationship and an MPLS LSP are established between the user device and DeviceA. It is required that traffic from DeviceB to the user device be forwarded along the MPLS LSP.
To implement this function, enable DeviceA and DeviceB to send or receive labeled routes, and run the unicast-route label advertise command on DeviceA. After DeviceA assigns MPLS labels to routes based on a route-policy, DeviceA converts the IPv4 public network unicast route (1.1.1.0/24) learned from the user device to a labeled route and sends the labeled route to DeviceB. After traffic from DeviceB reaches DeviceA, DeviceA performs the POPGO action. Specifically, DeviceA removes the BGP label, adds an LSP label, and forwards the traffic to the user device along the MPLS LSP.
Configuring BFD for BGP
BFD for BGP speeds up fault detection and therefore increases the route convergence speed.
Usage Scenario
Currently, voice and video services are widely applied. These services are quite sensitive to the packet loss and delay. BGP periodically sends Keepalive messages to a peer to monitor the peer's status, but this mechanism takes an excessively long time, more than 1 second, to detect a fault. If data is transmitted at Gbit/s rates and a link fault occurs, such a lengthy detection period will result in a large amount of data being lost, making it impossible to meet the high reliability requirements of carrier-grade networks.
To address this issue, BFD for BGP has been introduced. BFD for BGP detects faults on links between BGP peers within milliseconds. The fast detection speed ensures fast BGP route convergence and minimizes traffic loss.
Pre-configuration Tasks
Before configuring BFD for BGP, complete the following task:
Configure parameters of the link layer protocol and IP addresses for interfaces to ensure that the link layer protocol on the interfaces is up.
Procedure
- Run system-view
The system view is displayed.
- Run bfd
BFD is enabled globally.
- Run quit
Return to the system view.
- Run bgp as-number
The BGP view is displayed.
- (Optional) Run ipv4-family vpn-instance vpn-instance-name
The BGP-VPN instance IPv4 address family view is displayed.
Using this command, you can enter the BGP-VPN instance IPv4 address family view so that BFD for BGP can be configured for the VPN instance in this view. To configure BFD for BGP for the public network, skip this step.
- Run peer { group-name | ipv4-address } bfd enable [ single-hop-prefer | { per-link one-arm-echo } ] [ compatible ]
BFD is configured for a peer or peer group, and default BFD parameters are used to establish a BFD session.
A BFD session can be established only when the peer relationship is in the Established state.
After BFD is enabled for a peer group, BFD sessions will be created on the peers that belong to this peer group and are not configured with the peer bfd block command.
The compatible parameter configures the compatibility mode, which ensures that the local and peer devices use the same detection mode when a Huawei device is connected to a non-Huawei device. The compatible parameter must be used together with the single-hop-prefer parameter.- In the scenario where Huawei devices are interconnected, the same parameters must be configured on the local and peer devices. If the devices are configured with different BFD parameters, services may be affected.
- In the scenario where a Huawei device is connected to a non-Huawei device, to implement BFD interworking, select a proper configuration mode from the following table to ensure consistent configurations on the local and peer devices.
Table 1-697 Configuration modes for the compatible and single-hop-prefer parameters
Whether single-hop-prefer Is Configured
Whether compatible Is Configured
Direct IBGP Scenario
Multi-hop IBGP Scenario
Direct EBGP Scenario
Multi-hop EBGP Scenario
N
N
In the packets sent by BFD, the UDP port number is 4784, and the TTL is 253.
In the packets sent by BFD, the UDP port number is 4784, and the TTL is 253.
In the packets sent by BFD, the UDP port number is 3784, and the TTL is 255.
In the packets sent by BFD, the UDP port number is 4784, and the TTL is 253.
Y
N
In the packets sent by BFD, the UDP port number is 3784, and the TTL is 255.
In the packets sent by BFD, the UDP port number is 4784, and the TTL is 253.
In the packets sent by BFD, the UDP port number is 3784, and the TTL is 255.
In the packets sent by BFD, the UDP port number is 4784, and the TTL is 253.
N
Y
In the packets sent by BFD, the UDP port number is 4784, and the TTL is 255.
In the packets sent by BFD, the UDP port number is 4784, and the TTL is 255.
In the packets sent by BFD, the UDP port number is 3784, and the TTL is 255.
In the packets sent by BFD, the UDP port number is 4784, and the TTL is 255.
Y
Y
In the packets sent by BFD, the UDP port number is 3784, and the TTL is 255.
In the packets sent by BFD, the UDP port number is 4784, and the TTL is 255.
If the peer UDP port number is 3784, the local BFD session can learn the port number and change the local UDP port number to 3784.
In the packets sent by BFD, the UDP port number is 3784, and the TTL is 255.
In the packets sent by BFD, the UDP port number is 4784, and the TTL is 255.
If the peer UDP port number is 3784, the local BFD session can learn the port number and change the local UDP port number to 3784.
In the preceding table, the UDP port numbers in the packets sent by BFD are those obtained during initial negotiation. BFD has the automatic adaptation function. If the UDP port number of a received response packet is different from that of the sent packet, BFD automatically changes the UDP port number of the sent packet to be the same as the received one and re-sends the packet to the peer end.
- (Optional) Run peer { group-name | ipv4-address } bfd { min-tx-interval min-tx-interval | min-rx-interval min-rx-interval | detect-multiplier multiplier } *
BFD session parameters are modified.
The BFD parameters of a single peer take precedence over those of a peer group. If BFD parameters are configured on peers, they will be used in BFD session establishment.
When changing the default values, pay attention to the network status and the network reliability requirement. A short interval for transmitting BFD packets can be configured for a link that has a higher reliability requirement. A long interval for transmitting BFD packets can be configured for a link that has a lower reliability requirement.
There are three formulas: Actual interval for the local device to send BFD packets = max {Locally configured interval for transmitting BFD packets, Remotely configured interval for receiving BFD packets}, Actual interval for the local device to receive BFD packets = max {Remotely configured interval for transmitting BFD packets, Locally configured interval for receiving BFD packets}, and Local detection period = Actual interval for receiving BFD packets x Remotely configured BFD detection multiplier.
For example:
On the local device, the configured interval for transmitting BFD packets is 200 ms, the interval for receiving BFD packets is 300 ms, and the detection multiplier is 4.
On the peer device, the configured interval for transmitting BFD packets is 100 ms, the interval for receiving BFD packets is 600 ms, and the detection multiplier is 5.
Then:
On the local device, the actual interval for transmitting BFD packets is 600 ms calculated by using the formula max {200 ms, 600 ms}; the interval for receiving BFD packets is 300 ms calculated by using the formula max {100 ms, 300 ms}; the detection period is 1500 ms calculated by multiplying 300 ms by 5.
On the peer device, the actual interval for transmitting BFD packets is 300 ms calculated by using the formula max {100 ms, 300 ms}; the interval for receiving BFD packets is 600 ms calculated by using the formula max {200 ms, 600 ms}; the detection period is 2400 ms calculated by multiplying 600 ms by 4.
- (Optional) Run peer { group-name | ipv4-address } bfd valid-ttl-hops valid-ttl-hops-value
A TTL value is set for BFD session check.
In scenarios where EBGP peers are indirectly connected, you can configure a TTL value for checking the BFD session with a specified BGP peer so that the traffic forwarding path can be quickly adjusted if BFD detects a fault on the link to the peer. Specifically, the local interface used to establish the BFD session forwards only the packets with a TTL value greater than or equal to the configured TTL value. If the TTL value in a BFD packet is smaller than the configured TTL value, the interface discards this packet, the BFD session goes down, and BFD notifies BGP of this event. In this manner, routes are re-converged so that the traffic forwarding path is adjusted.
The peer bfd valid-ttl-hops command and the peer bfd enable single-hop-prefer command are mutually exclusive.
The peer bfd valid-ttl-hops command and the peer bfd enable per-link one-arm-echo command are mutually exclusive.
- (Optional) Run peer ipv4-address bfd block
A peer is prevented from inheriting the BFD function of the peer group to which it belongs.
If a peer joins a peer group enabled with BFD, the peer inherits the BFD configuration of the group and creates a BFD session. To prevent the peer from inheriting the BFD function of the peer group, perform this step.
The peer bfd block command and the peer bfd enable command are mutually exclusive. After the peer bfd block command is run, the BFD session is automatically deleted.
- Run commit
The configuration is committed.
Configuring BGP Peer Tracking
BGP peer tracking provides fast link or peer fault detection for BGP to speed up network convergence.
Context
BFD can be configured to detect peer relationship status changes in order to implement rapid BGP convergence. BFD, however, needs to be configured on the entire network and has poor extensibility. If BFD cannot be deployed to detect BGP peer relationship status changes, you can configure BGP peer tracking on the local device to quickly detect link or peer unreachability, implementing rapid network convergence. In addition, you can adjust the interval between detecting peer unreachability and terminating the BGP connection to suppress BGP peer relationship flapping caused by route flapping, thereby improving BGP network stability.
Configuring BGP Auto FRR
BGP Auto FRR, a protection measure against link faults, applies to the network topology with both primary and backup links. It can be configured for services that are quite sensitive to the packet loss and delay.
Usage Scenario
As networks evolve continuously, voice, on-line video, and financial services raise increasingly high requirements for real-time performance. Usually, primary and backup links are deployed on a network to ensure the stability of these services. In a traditional forwarding mode, the router selects a route out of several routes that are bound for the same destination network as the optimal route and delivers the route to the FIB table to guide data forwarding. If the optimal route fails, the router has to wait for route convergence to be completed before reselecting an optimal route. During this period, services are interrupted. After the router delivers the new optimal route to the FIB table, services are restored. Service interruption in this mode lasts a long time, which cannot meet service requirements.
BGP Auto FRR allows a device to select the optimal route from the routes that are bound for the same destination network and automatically add information about the suboptimal route to the backup forwarding entry of the optimal route. If the primary link fails, the device quickly switches traffic to the backup link. The switchover does not depend on route convergence and can be performed within sub-seconds, greatly reducing service interruption time.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The BGP IPv4 unicast address family view is displayed.
- Run auto-frr
BGP Auto FRR is enabled for unicast routes.
- (Optional) Run route-select delay delay-value
A delay for selecting a route to the intermediate device on the primary path is configured. After the primary path recovers, an appropriate delay ensures that traffic switches back to the primary path after the intermediate device completes refreshing forwarding entries.
- Run commit
The configuration is committed.
Checking the Configurations
After configuring BGP Auto FRR, you can run the following commands to check the previous configuration.
- Run the display bgp routing-table [ network [ { mask | mask-length } [ longer-prefixes ] ] ] command to check information in a BGP routing table.
- Run the display ip routing-table [ ip-address [ mask | mask-length ] [ longer-match ] ] verbose command to check backup forwarding entries in an IP routing table.
Configuring Delayed Response to BGP Next Hop Recursion Changes
Configuring delayed response to BGP next hop recursion changes can minimize traffic loss during route changes.
Usage Scenario
As shown in Figure 1-1777, PE1, PE2, and PE3 are the clients of the RR. CE2 is dual-homed to PE1 and PE2. PE1 and PE2 advertise their routes destined for CE2 to the RR. The RR advertises the route from PE1 to PE3. PE3 has only one route to CE2 and advertises this route to CE1. After the route exchange, CE1 and CE2 can communicate. If PE1 fails, PE3 detects that the next hop is unreachable and instructs CE1 to delete the route to CE2. Traffic is interrupted. After BGP route convergence is complete, the RR selects the route advertised by PE2 and sends a route update message to PE3. PE3 then advertises this route to CE1, and traffic forwarding is restored. A high volume of traffic will be lost during traffic interruption because BGP route convergence is rather slow.
If delayed response to BGP next hop recursion changes is enabled on PE3, PE3 does not reselect a route or instruct CE1 to delete the corresponding route immediately after detecting that the route to PE1 is unreachable. After BGP convergence is complete, the RR selects the route advertised by PE2 and sends the route to PE3. PE3 then reselects a route and sends a route update message to CE1. Traffic forwarding is restored. After delayed response to BGP next hop recursion changes is enabled on PE3, PE3 does not need to delete the route or instruct CE1 to delete the route. This delayed response speeds up BGP route convergence and minimizes traffic loss.
There are two links between DeviceA and DeviceD, and traffic passes through link DeviceA -> DeviceB -> DeviceC -> DeviceD.
- On the network shown in Figure 1-1778, if the link between DeviceB and DeviceC fails, BGP cannot find the next hop route or tunnel for recursion to DeviceC. As a result, traffic is interrupted and is switched to the link DeviceA -> DeviceE -> DeviceF -> DeviceD. In this case, when the next hop recursion changes, the reachability also changes. This is called a critical recursion change.
- On the network shown in Figure 1-1779, when the link between DeviceB and DeviceC is normal, the cost of this link is increased. Due to route selection, traffic is switched to the link DeviceA -> DeviceE -> DeviceF -> DeviceD. In this case, the next hop recursion result changes, but the reachability remains unchanged. This is called a non-critical recursion result change.
Delayed response to BGP next hop recursion changes applies only to scenarios where multiple links exist between the downstream device and the same destination. If there is only one link between the downstream device and the destination, configuring delayed response to BGP next hop recursion changes may cause heavier traffic loss when the link fails because link switching is impossible.
Pre-configuration Tasks
Before configuring the BGP next hop recursion change delayed response, complete the following task:
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run nexthop recursive-lookup delay [ delay-time ]
The delay in responding to next hop recursion changes is configured.
The nexthop recursive-lookup delay command configures the device to delay responses to all recursion changes. The nexthop recursive-lookup non-critical-event delay command configures the device to delay responses only to non-critical BGP recursion changes. If both the commands are run, the nexthop recursive-lookup non-critical-event delay command takes precedence over the other command.
If both the commands are run, the delay time set using the nexthop recursive-lookup non-critical-event delay command must be greater than or equal to that set using the nexthop recursive-lookup delay command.
- Run commit
The configuration is committed.
Verifying the Configuration
After configuring the BGP next hop recursion changes delayed response, you can run the following command to check the previous configuration.
- Run the display current-configuration configuration bgp | include nexthop recursive-lookup delay command to view information about the delay in responding to a next hop recursion change.
- Run the display current-configuration configuration bgp | include nexthop recursive-lookup non-critical-event delay command to view information about the delay in responding to non-urgent next hop recursion changes.
Setting a Specified Peer or Each Peer in a Peer Group as an Independent Update Peer-Group
Setting a specified peer or each peer in a peer group as an independent update peer-group prevents routes learned from the peer from being sent back to the peer.
Usage Scenario
To improve the efficiency of route advertisement, BGP uses the dynamic update peer-group mechanism. The BGP peers with the same configurations are placed in an update peer-group. These routes are grouped once and then sent to all peers in the update peer-group. However, the routes learned from a peer may be sent back to the peer, for example, the preferred route learned from an EBGP peer is sent back to the EBGP peer, or the preferred route that an RR learns from a client is reflected back to the client. In this case, messages are discarded, wasting network resources.
To address this problem, you can set a specified peer or each peer in a peer group as an independent update peer-group so that the routes learned from the peer are not sent back to the peer.
Setting a specified peer or each peer in a peer group as an independent update peer-group can be performed in multiple address families. This section uses the BGP-IPv4 unicast address family as an example. For details about the address families supported, see peer update-group-independent.
Pre-configuration Tasks
Before setting a specified peer or each peer in a peer group as an independent update peer-group, configure basic BGP functions.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
- Set a specified peer or each peer in a peer group as an independent update peer-group.
The configuration of a peer takes precedence over that of the peer group to which the peer belongs.
- To set a specified peer as an independent update peer-group, run the peer { ipv4-address | ipv6-address } update-group-independent enable command.
- To set each peer in a peer group as an independent update peer-group, run the peer group-name update-group-independent command.
- Run commit
The configuration is committed.
Configuring a Delay in Releasing Obtained Labels in a BGP LSP FRR Switchover Scenario
Configuring a delay in releasing obtained labels in a BGP LSP FRR switchover scenario can prevent second-time packet loss.
Usage Scenario
In a BGP LSP FRR switchover scenario shown in Figure 1-1780, DeviceA and DeviceD belong to AS 100, and DeviceB, DeviceC, DeviceE, and DeviceF belong to AS 200. The optimal route selected by DeviceB is a route learned from its EBGP peer DeviceA, and the suboptimal route selected by DeviceB is a route learned from its IBGP peer DeviceE. In normal cases, DeviceB preferentially selects the labeled BGP route learned from its EBGP peer DeviceA and sends the route to its IBGP peer DeviceC. DeviceB delivers an incoming label map (ILM) entry and next hop label forwarding entry (NHLFE). DeviceC also delivers an NHLFE. If DeviceA restarts due to a fault, DeviceB withdraws the route learned from DeviceA. The suboptimal route learned from its IBGP peer DeviceE becomes the new optimal route and is not sent to its IBGP peer DeviceC. Instead, DeviceB (RR) reflects this route to DeviceC. Therefore, DeviceB releases the label that has been applied for, deletes the ILM entry. If the NHLFE entry of DeviceC is updated slowly, traffic is still sent to DeviceB. In this case, packet loss occurs again because the ILM entry of DeviceB has been deleted.
To prevent this problem, configure a delay in releasing obtained labels (deleting ILM entries) on Device B.
Pre-configuration Tasks
Before configuring a delay in releasing obtained labels in a BGP LSP FRR switchover scenario, complete the following tasks:
Configuring the Route Server Function
This section describes how to configure the route server function. The function reduces network resource consumption onASBRs.
Usage Scenario
In some scenarios on the live network, to achieve network traffic interworking, EBGP full-mesh connections may be required. However, establishing full-mesh connections among border devices is costly and places high requirements on the performance of the devices, which adversely affects the network topology and device expansion. The route server function is similar to the RR function used in IBGP full-mesh connection scenarios and allows devices to advertise routes to their clients (border devices) without changing route attributes, such as AS_Path, Nexthop, and MED. This reduces network resource consumption on the border devices.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- (Optional) Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
- Run peer { ipv4-address | group-name } route-server-client
The route server function is enabled on the device, and an EBGP peer is specified as its client.
- Run commit
The configuration is committed.
Configuring the BGP GR Helper
You can configure a device to function as a Graceful Restart (GR) helper to help a BGP peer with the BGP GR process.
Enabling BGP GR
Enabling or disabling GR may delete and reestablish all sessions and instances.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run graceful-restart
BGP GR is enabled.
- (Optional) Run graceful-restart timer restart restart-time
The maximum time is set for the local end to wait for GR recovery on the peer end.
- (Optional) Run graceful-restart peer-reset
The router is enabled to reset a BGP session in GR mode.
Currently, BGP does not support dynamic capability negotiation. Therefore, a BGP capability change causes the re-establishment of the peer relationship. In a scenario where a BGP IPv4 unicast peer relationship has been established and IPv4 services are running properly, if a BGP capability changes, the BGP IPv4 unicast peer relationship will be re-established, affecting IPv4 services. To prevent this problem, run the graceful-restart peer-reset command to enable the router to reset the BGP connection in GR mode.
- (Optional) Run the ipv4-family flow command to enter the BGP-Flow address family view, run the ipv4-flow vpn-instance command to enter the BGP-Flow VPN instance IPv4 address family view, run the ipv4-flow vpnv4 command to enter the BGP-Flow VPNv4 address family view, run the ipv6-family flow command to enter the BGP-Flow IPv6 address family view, or run the ipv6-flow vpn-instance command to enter the BGP-Flow VPN instance IPv6 address family view, and then run the peer { ipv4-address | ipv6-address } graceful-restart static-timer restart-time command to configure the maximum time for the local end to wait for GR recovery of the peer.
ipv6-address takes effect only in the BGP-Flow IPv6 address family view and BGP-Flow VPN instance IPv6 address family view.
- Run commit
The configuration is committed.
Enabling GR for BGP Peers
After the GR capability is configured for a BGP peer, a BGP speaker can negotiate with the peer to establish a BGP session with the GR capability.
Usage Scenario
A BGP restart causes re-establishment of all the involved peer relationships, resulting in traffic interruption. Enabling GR globally can prevent traffic interruption. However, this will disconnect all the BGP peer relationships on a device and cause the device to re-negotiate the GR capability with these peers, which affects all the BGP-dependent services running on the live network. To prevent this problem, you can enable GR on a BGP speaker for specified BGP peers so that the BGP speaker negotiates the GR capability only with the specified peers. If negotiation succeeds, BGP connections are established between the BGP speaker and specified peers.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run peer { ipv4-address | group-name } capability-advertise graceful-restart
GR is enabled for a specified peer or peer group, and the device is configured to advertise the GR capability to the peer or peer group.
If the specified peer does not support GR, run the peer ipv4-address local-graceful-restart enable command instead to enable local GR for the peer.
If the specified peer group has peers that do not support GR, run both the peer group-name capability-advertise graceful-restart and peer group-name local-graceful-restart enable commands.
- (Optional) Run peer { ipv4-address | group-name } graceful-restart timer restart time-value
The maximum duration is set for the specified peer or peer group to wait for the BGP peer relationship to be reestablished with the local device. After the command is run, the local device will advertise the maximum duration to the specified peer or peer group.
If the specified peer does not support GR, run the peer ipv4-address local-graceful-restart timer restart restart-time command instead to set the maximum duration for the local device to wait for the BGP peer relationship to be reestablished with the specified peer.
If the specified peer group has peers that do not support GR, run both the peer group-name graceful-restart timer restart time-value and peer group-name local-graceful-restart timer restart restart-time commands.
- (Optional) Run peer { ipv4-address | group-name } graceful-restart peer-reset
The device is enabled to use the GR mode to reset the BGP connection with the specified peer or each peer in the specified group.
Currently, BGP does not support dynamic capability negotiation. Therefore, each time a BGP capability is changed or a new BGP capability is enabled, a BGP speaker tears down the existing sessions with the affected peers and renegotiates BGP capabilities with these peers. For example, a BGP speaker has established a BGP IPv4 unicast peer relationship with a peer, and the IPv4 service is running properly. A change of BGP capability causes the BGP IPv4 unicast peer relationship to be reestablished, affecting the normal running of the IPv4 service. To address this issue, run the peer { ipv4-address | group-name } graceful-restart peer-reset command.
- (Optional) Run peer { ipv4-address | group-name } graceful-restart timer wait-for-rib time-value
The maximum duration is set for the device to wait for the End-of-RIB flag from the specified peer or peer group.
If the specified peer does not support GR, run the peer ipv4-address local-graceful-restart timer wait-for-rib wfrtime command instead to set the maximum duration for the device to wait for the End-of-RIB flag from the specified peer.
If the specified peer group has peers that do not support GR, run both the peer group-name graceful-restart timer wait-for-rib time-value and peer group-name local-graceful-restart timer wait-for-rib wfrtime commands.
- Run commit
The configuration is committed.
Verifying the Configuration
- Run the display bgp peer verbose command to check the BGP GR status.
- Run the display bgp graceful-restart status command to check GR information on the BGP speaker.
- Run the display bgp local-graceful-restart status command to check information about local GR on the BGP speaker.
Configuring BGP Best-external
Border Gateway Protocol (BGP) Best-external can speed up route convergence if the primary link fails.
Usage Scenario
If multiple routes to the same destination are available, a BGP device selects one optimal route based on BGP route selection policies and advertises the route to its BGP peers. This optimal route may be advertised by either an External Border Gateway Protocol (EBGP) peer or an Internal Border Gateway Protocol (IBGP) peer.
However, in scenarios with master and backup provider edges (PEs), if routes are selected based on the preceding policies and the primary link fails, the BGP route convergence takes a long time because no backup route is available. To address this problem, configure BGP Best-external on the backup PE.
The following figure shows the networking with master and backup PEs.
BGP Best-external must be enabled on the backup PE (PE2).
Configuration Procedures
Run system-view
The system view is displayed.
Run bgp as-number
The BGP view is displayed.
Run bestroute best-external
The device is enabled to select BGP Best-external routes.
Run peer { ipv4-address | group-name } advertise best-external
The device is enabled to advertise Best-external routes to the specified peer or peer group.
Run commit
The configuration is committed.
Configuring BGP Add-Path
BGP Add-Path allows a device to send multiple routes with the same prefix to a specified IBGP peer. These routes can back up each other or load-balance traffic, which improves network reliability.
Usage Scenario
In a scenario with an RR and clients, if the RR has multiple routes to the same destination (with the same prefix), the RR selects an optimal route from these routes and then sends only the optimal route to its clients. Therefore, the clients have only one route to the destination. If a link along this route fails, route convergence takes a long time, which cannot meet the requirements for high reliability.
To address this issue, deploy the BGP Add-Path feature on the RR. With BGP Add-Path, the RR can send two or more routes with the same prefix to a specified IBGP peer. These routes can back up each other or load-balance traffic, which ensures high reliability in data transmission. The BGP Add-Path feature does not affect BGP route selection rules.
In the BGP-VPNv4 address family view, the device can advertise Add-Path routes to IBGP and EBGP peers. However, in other address family views, Add-Path routes can be advertised only to IBGP peers.
BGP Add-Path is not supported in BGP confederation scenarios.
Generally, BGP Add-Path is configured on an RR, and the Add-Path route receiver needs to be configured to accept such routes. In Figure 1-1782, you can enable BGP Add-Path on the RR, enable Device A to accept BGP Add-Path routes from the RR so that Device A obtains two routes destined for 1.1.1.1/32, with next hops of 172.16.6.2 and 172.16.7.2. The two routes can back up each other or load-balance traffic.
Configuring BMP
BGP Monitoring Protocol (BMP) allows the BGP running status and route processing records and on network devices to be monitored in real time.
Usage Scenario
BMP is mainly used in networking scenarios where monitoring servers exist and need to monitor the BGP running status and route processing records and on network devices in real time. The running status includes the establishment and disconnection of peer relationships and update of routing information. BGP route processing records indicate the process of processing BGP routes on a device, for example, processing of the routes that match an import or export policy. Without BMP, only manual query can be used to obtain the BGP running status and processing records. The emergence of BMP eliminates this restriction and significantly improves network monitoring efficiency.
Procedure
- Configure BMP to report the BGP running status to a monitoring server.
- Configure BMP to report the trace data of IPv4 public network unicast routes to the monitoring server.
- Configure BMP to report the trace data of VPNv4 routes and the IPv4 VPN unicast routes (transformed from the VPNv4 routes) to the monitoring server.
Verifying the Configuration
After the configuration is complete, verify it.
- Run the display bmp session [ vpn-instance vrf-name ] [ ipv4-address [ alias alias-name ] verbose ] command to check BMP session configurations.
- Run the display bgp bmp-monitor { all | { ipv4 | vpnv4 vpn-instance vpn-instance-name | vpnv4 } ipv4-address } command to check information about BGP peers (either all peers or a specified one) monitored through BMP in all address families or in a specified address family.
Configuring BGP Route Dampening
BGP route dampening can be configured to suppress unstable routes.
Usage Scenario
Route instability is mainly reflected by route flapping. A route is considered to be flapping when it repeatedly appears and then disappears in the routing table. BGP is generally applied to complex networks where routes change frequently. Frequent route flapping consumes lots of bandwidth and CPU resources and even seriously affects network operations.
BGP route dampening prevents frequent route flapping by using a penalty value to measure route stability. When a route flaps for the first time, a penalty value is assigned to the route. Later, each time the route flaps, the penalty value of the route increases by a specific value. The greater the penalty value, the less stable the route. If the penalty value of a route exceeds the pre-defined threshold, the route will not be advertised until the penalty value of the route reduces to the reuse threshold.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Configuring BGP route dampening parameters
- Configuring EBGP route dampening parameters
- Run the ipv4-family unicast command to display the IPv4 unicast address family view.
- Run the dampening [ half-life-reach reuse suppress ceiling | route-policy route-policy-name | route-filter route-filter-name ] * [ update-standard ] command to set the EBGP route dampening parameters.
- Configuring IBGP route dampening parameters
- Run the ipv4-family unicast command to enter the IPv4 unicast address family view, run the ipv4-family vpnv4 command to enter the BGP-VPNv4 address family view, or run the ipv6-family vpnv6 command to enter the BGP-VPNv6 address family view.
- Run the dampening ibgp [ half-life-reach reuse suppress ceiling | route-policy route-policy-name | route-filter route-filter-name ] * [ update-standard ] command to set IBGP route dampening parameters.
When you configure BGP route dampening, the values of reuse, suppress, and ceiling should meet the relationship of reuse<suppress<ceiling.
If routes are differentiated based on policies and the dampening command is run to reference a route-policy, BGP can use different route dampening parameters to suppress different routes.
- Configuring EBGP route dampening parameters
- Run commit
The configuration is committed.
Verifying the Configuration
After BGP route dampening is configured, you can check whether the configuration is correct.
Run the display bgp routing-table flap-info [ regular-expression as-regular-expression | as-path-filter { as-path-filter-number | as-path-filter-name } | network-address [ { mask | mask-length } [ longer-match ] ] ] command to check route flapping statistics.
Run the display bgp routing-table time-range start-time end-time command to view BGP routes that flap within the specified time period.
Run the display bgp routing-table dampened command to check dampened BGP routes.
Run the display bgp routing-table dampening parameter command to check configured BGP route dampening parameters.
Configuring Suppression on BGP Peer Flapping
Suppression on BGP peer flapping allows a device to delay the establishment of a BGP peer relationship that flaps continuously.
Usage Scenario
BGP peer flapping occurs when BGP peer relationships are disconnected and then immediately re-established in a quick sequence that is repeated. Frequent BGP peer flapping is caused by various factors; for example, a link is unstable, or an interface that carries BGP services is unstable. After a BGP peer relationship is established, the local device and its BGP peer usually exchange all routes in their BGP routing tables with each other. If the BGP peer relationship is disconnected, the local device deletes all the routes learned from the BGP peer. Generally, a large number of BGP routes exist, and in this case, a large number of routes change and a large amount of data is processed when the BGP peer relationship is flapping. As a result, a high volume of resources are consumed, causing high CPU usage. To prevent this issue, a device supports suppression on BGP peer flapping. With this function enabled, the local device suppresses the establishment of the BGP peer relationship if it flaps continuously.
Pre-configuration Tasks
Before configuring suppression on BGP peer flapping, you have completed the following task:
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run peer peerIpv4Addr oscillation-dampening
BGP is enabled to suppress the establishment of a specified peer relationship that flaps continuously.
To immediately remove the suppression, you can run the peer oscillation-dampening disable command. Alternatively, you can run a reset command or another command that can cause the peer relationship to be disconnected and re-established.
- Run commit
The configuration is committed.
Configuring Flapping Suppression Involved in BGP Next Hop Recursion
Flapping suppression involved in next-hop recursion prevents the system from frequently processing changes in routes that recurse to a frequently flapping next hop, thereby reducing system resource consumption and CPU usage.
Usage Scenario
If a large number of routes recurse to the same next hop that flaps frequently, the system will be busy processing changes of these routes, which consumes excessive system resources and leads to high CPU usage. To address this problem, configure flapping suppression involved in next-hop recursion.
- Increases the penalty value by 1 if the flapping interval is less than T1.
- Retains the penalty value if the flapping interval is greater than or equal to T1, but less than T2.
- Reduces the penalty value by 1 if the flapping interval is greater than or equal to T2, but less than T3.
- Clears the penalty value if the flapping interval is greater than or equal to T3.
Pre-configuration tasks
Before configuring flapping suppression involved in BGP next-hop recursion, configure basic BGP functions.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
- Run undo nexthop recursive-lookup restrain disable
Flapping suppression involved in next hop recursion is enabled.
If you do not want to slow down route recursion processing and high CPU usage due to route recursion change processing is not a concern, you can disable flapping suppression involved in next-hop recursion using the nexthop recursive-lookup restrain disable command.
- Run quit
Return to the BGP view.
- Run nexthop recursive-lookup restrain suppress-interval add-count-time hold-interval hold-count-time clear-interval clear-count-time
The intervals are configured for increasing, retaining, and clearing the penalty value for flapping suppression involved in next hop recursion.
- Run commit
The configuration is committed.
Configuring BGP-LS
BGP-LS provides a simple and efficient method of collecting topology information.
Usage Scenario
- The controller must have high computing capabilities and support the IGP and its algorithm.
- The controller cannot gain the complete inter-area topology information and therefore is unable to calculate optimal E2E paths.
- Different IGPs report topology information separately to the controller, which complicates the controller's analysis and processing.
- Reduces computing capability requirements and spares the necessity of IGPs on the controller.
- Facilitates route selection and calculation on the controller by using BGP to summarize process or AS topology information and report the complete information to the controller.
- Requires only one routing protocol (BGP) to report topology information to the controller.
BGP-LS needs to be deployed on the devices connected to the controller.
Procedure
- Enable IGP topology advertisement to BGP. You can determine to enable IS-IS topology advertisement to BGP or OSPF topology advertisement to BGP based on network configurations.
- Enable IS-IS topology advertisement to BGP.
- Run system-view
The system view is displayed.
- Run isis [ process-id ]
An IS-IS process is configured.
- Run bgp-ls enable [ level-1 | level-2 | level-1–2 ]
IS-IS topology advertisement is enabled.
To enable IS-IS to advertise topology information of Level-1 areas and filter out the route prefixes leaked from Level-2 areas to Level-1 areas, run the bgp-ls enable level-1 level-2-leaking-route-ignore command.
- (Optional) Run bgp-ls identifier identifier-value
A BGP-LS identifier is configured for IS-IS.
- Run commit
The configuration is committed.
- Run system-view
- Enable OSPF topology advertisement.
- Run system-view
The system view is displayed.
- Run ospf [ process-id | router-idrouter-id | vpn-instancevpn-instance-name ] *
An OSPF process is configured.
- Run bgp-ls enable
OSPF topology advertisement to BGP is enabled.
- (Optional) Run bgp-ls identifier identifier-value
A BGP-LS identifier is configured for OSPF.
- Run commit
The configuration is committed.
- Run system-view
- Enable OSPFv3 topology advertisement.
- Run system-view
The system view is displayed.
- Run ospfv3 [ process-id ] [ vpn-instance vpn-instance-name ]
An OSPFv3 process is created.
- Run bgp-ls enable
OSPFv3 topology advertisement is enabled.
- (Optional) Run bgp-ls identifier identifier-value
A BGP-LS identifier is configured for OSPFv3.
- Run commit
The configuration is committed.
- Run system-view
- Enable IS-IS topology advertisement to BGP.
Enable BGP-LS.
- Run system-view
The system view is displayed.
- Run bgp as-number
BGP is enabled, and the BGP view is displayed.
Run peer { group-name | ipv4-address } as-number { as-number-plain | as-number-dot }
The IP address and AS number of a BGP peer are specified.
- Run link-state-family unicast
BGP-LS is enabled, and the BGP-LS address family view is displayed.
- Run peer { group-name | ipv4-address } enable
BGP-LS route exchange with the specified peer or peer group is enabled.
(Optional) Run domain identifier domain-id
A BGP-LS domain ID is configured.
A BGP-LS domain ID identifies a device with BGP-LS enabled. If no BGP-LS domain ID is configured, a BGP router ID is used as the BGP-LS domain ID by default. The same BGP-LS domain ID can be configured for multiple devices so that the controller calculates routes based on the combined topology information reported by the devices.
(Optional) Run domain as { domain as-plain | domain as-dot }
A BGP-LS domain AS number is configured.
Two devices with different BGP AS numbers must have the same BGP-LS domain AS number configured using the domain as command so that the controller can obtain combined topology information about the two ASs for route calculation.
(Optional) Run peer { group-name | ipv4-address } reflect-client
An RR is configured, and an RR client is specified.
The router on which the peer reflect-client command is run functions as the RR, and the specified peer or peer group functions as a client.
If the clients of an RR are fully meshed, you can run the undo reflect between-clients command to disable route reflection among these clients through the RR to reduce bandwidth consumption.
If a cluster has multiple RRs configured, you can run the reflector cluster-id cluster-id command to configure the same cluster ID for all the RRs. This command is applicable only to RRs.
(Optional) Run peer { group-name | ipv4-address } route-limitlimit [ percentage ] [ alert-only | idle-forever | idle-timeoutminutes ]
The maximum number of BGP-LS routes that the local device can receive from a specified peer is set.
Generally, a BGP-LS routing table contains a large number of routes. If a large number of routes are received from peers, excessive system resources are consumed. To prevent this problem, run this command to set the maximum number of routes that a BGP device is allowed to receive from a peer.
(Optional) Run peer { group-name | ipv4-address } route-policyroute-policy-name { import | export }
A route-policy is specified for the BGP-LS routes to be received from or advertised to a specified BGP peer or peer group.
After a route-policy is created, you can run the peer route-policy command to use the route-policy to filter the BGP-LS routes to be received from or advertised to a specified BGP peer or peer group. The command configuration ensures that only desired routes are accepted or advertised, which helps manage routes and reduces the BGP-LS routing table size and system resource consumption.
(Optional) Run peer { group-name | ipv4-address } route-update-intervalinterval
An interval at which the device sends Update messages carrying the same route prefix to a specified peer or peer group is set.
When BGP-LS routes change, the router sends Update messages to notify its peers. If a route changes frequently, to prevent the router from sending Update messages for every change, run this command to set an interval at which the router sends Update messages carrying the same route prefix to a specified peer or peer group.
(Optional) Run peer { group-name | ipv4-address } allow-as-loop num
The maximum number of AS number repetitions in the AS_Path attribute allowed by a peer or peer group is configured.
- Run commit
The configuration is committed.
- Run system-view
Verifying the Configuration
After configuring BGP-LS, verify the configuration.
- Run the display bgp link-state unicast peer command to check information about BGP-LS peers and their status.
- Run the display bgp link-state unicast routing-table command to check BGP-LS route information.
- Run the display bgp link-state unicast routing-table statistics command to check BGP-LS route statistics.
Configuring the Entropy Label Capability for a BGP LSP
Configuring the entropy label capability for a BGP LSP helps equalize and improve the performance of load balancing.
Usage Scenario
On the network shown in Figure 1-1783, an end-to-end BGP LSP is established between PE1 and PE2. In addition, an end-to-end BGP-VPNv4 IPv4 peer relationship is established between PE1 and PE2, an LDP LSP is established between PE1 and ASBR1, and an LDP LSP is established between ASBR2 and PE2. Load balancing technology is used to obtain higher bandwidth between nodes as a result of continuous network expansion. However, load imbalance becomes increasingly severe on the transit nodes. To improve load balancing performance, configure the entropy label capability for the BGP LSP on both PE1 and PE2.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- (Optional) Run ipv4-family unicast
The IPv4 unicast address family view is displayed.
- Run peer { peerIpv4Addr | peerGroupName } advertise-entropy-label elc [ padding paddingValue ]
The device is enabled to add the entropy label of the entropy label capability (ELC) type to BGP routes to be advertised to a specified peer or peer group.
- Run peer { peerIpv4Addr | peerGroupName } entropy-label
The device is enabled to add the entropy label information to traffic to be forwarded to the specified peer or peer group.
- Run commit
The configuration is committed.
Configuring BGP RPD
RPD provides a new method of distributing route-policies and allows the NCE to efficiently and dynamically deploy route-policies.
Usage Scenario
In a MAN ingress or IGW scenario, uneven link resource usage or link faults may cause link congestion. To make full use of network bandwidth, you can deploy an inbound traffic optimization solution to adjust route priorities so that traffic is diverted to idle links. In such a scenario, the router functions as a forwarder, and RPD needs to be deployed on it.
In Figure 1-1784, an inbound traffic optimization solution is deployed so that traffic from AS 200 to the backbone network is monitored and scheduled in real time. If the link from Device C to Device A is congested, the traffic enters AS 100 through Device B and reaches the backbone network by path of the PE.
In this scenario, forwarders receive RPD policies delivered by the NCE and adjust route attributes and advertise routes based on the policies. The traffic optimization policy is configured on the NCE based on the traffic application. The following section describes relevant configurations on the forwarders. For details about how to configure the NCE, see the NCE manual.
Pre-configuration Tasks
Before configuring BGP RPD, complete the following tasks:
Configure basic BGP functions on a device, and establish a connection between the device and NCE to ensure routing reachability between them.
Procedure
- Configure basic RPD functions.
- (Optional) Configure GR to prevent the traffic interruption caused by a protocol restart.
- (Optional) Configure router ID-based filtering on non-RRs in the RR scenario so that the non-RRs only accept the RPD routes that match the router ID of the local BGP process. If a large number of RPD routes are accepted, a large number of policy nodes are generated accordingly, which reduces the performance.
- (Optional) Configure a delay for protocols to apply an updated RPD route-policy if the original policy changes.
Configuring IBGP Peers to Establish MPLS Local IFNET Tunnels
To carry BGP LSPs, you can configure IBGP peers to create an MPLS local IFNET tunnel.
Usage Scenario
To carry BGP LSPs, you can configure directly connected IBGP peers to establish an MPLS local IFNET tunnel. By default, IBGP peers cannot automatically establish an MPLS local IFNET tunnel. To enable the IBGP peers to establish an MPLS local IFNET tunnel, run the undo peer mpls-local-ifnet disable command.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run undo peer { peerGroupName | peerIpv4Addr } mpls-local-ifnet disable
A specified IBGP peer is enabled to create an MPLS local IFNET tunnel.
An MPLS local IFNET tunnel can be established between IBGP peers only in the BGP-IPv4 unicast address family or BGP unicast labeled address family. To allow an MPLS local IFNET tunnel to be established in the BGP-IPv4 unicast address family, run the peer label-route-capability command to enable the IBGP peers to send and receive labeled routes.
- Run commit
The configuration is committed.
Configuring the YANG Management Mode of BGP
In YANG management mode of BGP, BGP instance configurations can be delivered using the YANG model.
Usage Scenario
To manage BGP configurations using NETCONF YANG, you need to configure the YANG management mode of BGP on the device first. Alternatively, you can enable the leaf node (XPath: /bgp:bgp/bgp:global/bgp:yang-enable) globally through the YANG model file. This section describes the configuration on the device.
For security purposes, you are advised not to use weak security algorithms in this feature. If you need to use such an algorithm, run the undo crypto weak-algorithm disable command to enable the weak security algorithm function first.
Procedure
- Run the system-view command to enter the system view.
- Run the bgp yang-mode enable command to configure the YANG management mode of the BGP VPN instance.
If the bgp yang-mode enable command is run, the configurations of BGP VPN instances and their peers and peer groups are changed. For example:
Example 1 (including part 1 and part 2):
Part 1: For example, before the bgp yang-mode enable command is run, the configurations on the device are as follows:
[~HUAWEI-bgp]display this # bgp 100 # ipv4-family unicast undo synchronization # ipv4-family vpn-instance abc peer 3.3.3.4 as-number 100 # ipv4-family vpn-instance vrf1 group a internal peer 1.1.1.1 as-number 100 peer 1.1.1.1 group a
Part 2: After the bgp yang-mode enable command is run, the configurations on the device are changed as follows:
[~HUAWEI-bgp]display this # bgp 100 # ipv4-family unicast undo synchronization # vpn-instance abc //A BGP-VPN instance is added. peer 3.3.3.4 as-number 100 //The VPN instance-level command configuration in the BGP-VPN instance IPv4 address family view is migrated to the new BGP-VPN instance view. # ipv4-family vpn-instance abc peer 3.3.3.4 enable //The address-family level command is added to the BGP-VPN instance IPv4 address family view. # vpn-instance vrf1 group a internal //The VPN instance-level command configuration in the BGP-VPN instance IPv4 address family view is migrated to the new BGP-VPN instance view. peer 1.1.1.1 as-number 100 //The VPN instance-level command configuration in the BGP-VPN instance IPv4 address family view is migrated to the new BGP-VPN instance view. peer 1.1.1.1 group a //The VPN instance-level command configuration in the BGP-VPN instance IPv4 address family view is migrated to the new BGP-VPN instance view. # ipv4-family vpn-instance vrf1 peer a enable //The address-family level command is added to the BGP-VPN instance IPv4 address family view. peer 1.1.1.1 enable //The address-family level command is added to the BGP-VPN instance IPv4 address family view. peer 1.1.1.1 group a enable //The address-family level command is added to the BGP-VPN instance IPv4 address family view.
After the bgp yang-mode enable command is run, the configurations shown in part 1 of example 1 cannot be performed.
After the bgp yang-mode enable command is run, if a BGP-VPN instance is deleted, all the configurations in the instance are deleted accordingly.
Example 2: Example 2 is based on example 1. In this example, peer groups of the same name and in the same BGP VPN instance are changed.
Before the bgp yang-mode enable command is run, the configurations on a device are as follows:
[~HUAWEI-bgp]display this # bgp 100 # ipv4-family unicast undo synchronization # ipv4-family vpn-instance vrf1 group ML internal peer ML password simple 11 # ipv6-family vpn-instance vrf1 group ML internal peer ML connect-interface LoopBack1
After the bgp yang-mode enable command is run, the configurations on the device are changed as follows:
[~HUAWEI-bgp]display this # bgp 100 # ipv4-family unicast undo synchronization # vpn-instance vrf1 group ML internal peer ML password simple 11 group ML2019531105624 internal //In this example, the name of the peer group changes from ML to ML2019531105624. peer ML2019531105624 connect-interface LoopBack1 //In this example, the name of the peer group changes from ML to ML2019531105624. # ipv4-family vpn-instance vrf1 peer ML enable # ipv6-family vpn-instance vrf1 peer ML2019531105624 enable
- Run the commit command to commit the configuration.
Improving BGP Security
To improve BGP network security, you can configure BGP authentication, RPKI, and GTSM on the BGP network.
Usage Scenario
You can configure the following functions to improve BGP network security:
For security purposes, you are advised not to use weak security algorithms in this feature. If you need to use such an algorithm, run the undo crypto weak-algorithm disable command to enable the weak security algorithm function first.
MD5 authentication
BGP uses TCP as the transport protocol and considers a packet valid if the source address, destination address, source port, destination port, and TCP sequence number of the packet are correct. However, most parameters in a packet are easily accessible to attackers. To protect BGP against attacks, configure MD5 authentication for TCP connections established between BGP peers.
To prevent the MD5 password set on a BGP peer from being decrypted, update the MD5 password periodically.
The MD5 algorithm is not recommended if high security is required.
Keychain authentication
A keychain consists of multiple authentication keys, each of which contains an ID and a password. Each key has a lifecycle, and keys are dynamically selected based on the life cycle of each key. After a keychain with the same rules is configured on the two ends of a BGP connection, the keychains can dynamically select authentication keys to enhance BGP attack defense.
BGP GTSM
The GTSM mechanism protects the router by checking whether the TTL value in an IP packet header is within a pre-defined range, which enhances the system security.
BGP RPKI
Resource Public Key Infrastructure (RPKI) improves BGP security by validating the origin ASs of BGP routes.
SSL/TLS authentication
Secure Sockets Layer (SSL) is a security protocol that protects data privacy on the Internet. Transport Layer Security (TLS) is a successor of SSL. TLS protects data integrity and privacy by preventing attackers from eavesdropping the data exchanged between a client and server. To ensure data transmission security on a network, SSL/TLS authentication can be enabled for BGP message encryption.
- TCP-AO authentication
The TCP authentication option (TCP-AO) is used to authenticate received and to-be sent packets during TCP session establishment and data exchange. It supports packet integrity check to prevent TCP replay attacks. TCP-AO authentication improves the security of the TCP connection between BGP peers and is applicable to the network that requires high security.
GTSM supports only unicast addresses. Therefore, configure GTSM on all the routers configured with routing protocols.
Configuring MD5 Authentication
In MD5 authentication, a Message Digest 5 (MD5) authentication password is set for a TCP connection, and the MD5 authentication is performed by TCP. If authentication fails, no TCP connection will be established.
Context
For security purposes, you are advised not to use weak security algorithms in this feature. If you need to use such an algorithm, run the undo crypto weak-algorithm disable command to enable the weak security algorithm function first.
The encryption algorithm used for MD5 authentication is insecure and poses security risks. As such, you are advised to use a more secure encryption algorithm.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run peer { ipv4-address | group-name } password { cipher cipher-password | simple simple-password }
An MD5 authentication password is set.
An MD5 authentication password can be set in either of the following modes:
- cipher cipher-password indicates that a password is set using a ciphertext string.
- simple simple-password indicates that a password is set using a plaintext string.
- The new password is at least eight characters long and contains at least two of upper-case letters, lower-case letters, digits, and special characters.
- When configuring an authentication password, select the ciphertext mode because the password is saved in configuration files in simple text if you select the simple text mode, which has a high risk. To ensure device security, change the password periodically. If this command is run in the BGP view, the configuration also takes effect in an extended BGP address family view because they use the same TCP connection. BGP MD5 authentication and BGP keychain authentication are mutually exclusive.
- Run commit
The configuration is committed.
Configuring Keychain Authentication
After a keychain with the same rules is configured on the two ends of a BGP connection, the keychain can dynamically select the authentication keys to enhance BGP attack defense.
Configuring TCP-AO Authentication
This section describes how to configure BGP TCP Authentication Option (TCP-AO) authentication to check the integrity of packets and prevent TCP replay attacks.
Context
The TCP-AO is used to authenticate received and to-be sent packets during TCP session establishment and data exchange. It supports packet integrity check to prevent TCP replay attacks. After creating a TCP-AO, run the peer tcp-ao policy command in the BGP view and specify the peer that needs to reference the TCP-AO and the TCP-AO name. This enables the BGP session to be encrypted. Such configuration is applicable to networks that require high security. Different peers can reference the same TCP-AO.
Procedure
- Run the system-view command to enter the system view.
- Run the tcp ao tcpaoname command to create a TCP-AO and enter the TCP-AO policy view.
- Run the binding keychain kcName command to bind the TCP-AO to a keychain.
Before performing this step, complete configuring basic keychain functions in Pre-configuration Tasks to create a keychain.
- Run the key-id keyId command to create a key ID for the TCP-AO and enter the TCP-AO key ID view.
- Run the send-id sndId receive-id rcvId command to configure send-id and receive-id for the Key ID.
- Run the quit command to return to the upper-level view.
- Run the quit command to return to the system view.
- Run the bgp as-number command to enter the BGP view.
- Run the peer ipv4-address as-number as-number command to specify the IP address of a peer and the number of the AS where the peer resides.
- Run the peer ipv4-address tcp-ao policy tcp-ao-name command to configure TCP-AO authentication for the TCP connection to be set up between BGP peers.
The value of the tcp-ao-name parameter must be set to the TCP-AO created in step 2.
For the same peer, the authentication modes TCP-AO, MD5, and keychain are mutually exclusive.
- Run the commit command to commit the configuration.
Configuring BGP GTSM
BGP GTSM must be configured on both peers.
Usage Scenario
GTSM prevents attacks through TTL detection. An attacker simulates real BGP packets and sends the packets in a large quantity to the router. After receiving the packets, an interface board of the router directly sends the packets to the BGP module of the control plane if the interface board finds that the packets are sent by the local router, without checking the validity of the packets. The control plane of the router needs to process the "legal" packets. As a result, the system becomes abnormally busy and the CPU usage is high.
GTSM protects the router by checking whether the TTL value in an IP packet header is within a pre-defined range to enhance the system security.
GTSM supports only unicast addresses; therefore, GTSM must be configured on all the routers configured with routing protocols.
Pre-configuration Tasks
Before configuring the BGP GTSM, complete the following task:
Perform the following steps on both BGP peers:
Procedure
- Configure the basic BGP GTSM functions.
- Set the default action for packets that do not match the GTSM policy.
GTSM only checks the TTL values of packets that match the GTSM policy. Packets that do not match the GTSM policy can be allowed or dropped. If "drop" is set as the default GTSM action for packets, you need to configure TTL values for all the packets sent from valid peers in the GTSM policy. If TTL values are not configured for the packets sent from a peer, the device will discard the packets sent from the peer and cannot establish a connection to the peer. Therefore, GTSM enhances security but reduces the ease of use.
You can enable the log function to record packet drop for troubleshooting.
Perform the following configurations on the GTSM-enabled router:
Configuring ROA
Resource Public Key Infrastructure (RPKI) ensures BGP security by validating the origin ASs of BGP routes.
Usage Scenario
To solve the problem of BGP route hijacking, the industry proposes the RPKI solution that validates the origin ASs of BGP routes. Distributed RPKI servers are used to collect information such as the origin AS numbers, route prefixes, and masks of BGP routes initiated by each ISP. After a device sets up a connection with an RPKI cache server, the device saves a copy of Route Origin Authorization (ROA) data locally. If no RPKI server is available, static ROA data can be configured on a device. Inbound ROA validation, which applies to the BGP routes received from peers, can be configured to control route selection. In addition, outbound ROA validation, which applies to the BGP routes to be advertised to peers, can be configured to control route advertisement. ROA validation ensures that hosts in an AS can securely access external services.
Procedure
- Select one of the following configurations based on the usage scenario:
- If the local device needs to obtain the ROA database through a connection to be established with an RPKI server, perform the following operations:
- Run system-view
The system view is displayed.
- Run rpki
RPKI is started, and the RPKI view is displayed.
- Run session ipv4-address
An address of the RPKI server is specified for a TCP connection to be set up between the device and the RPKI server.
- Run tcp port port-number [ password md5 cipher-password | keychain keychain-name ]
Parameters are configured for the TCP connection to be set up between the device and the RPKI server.
For security purposes, you are advised not to use weak security algorithms in this feature. If you need to use such an algorithm, run the undo crypto weak-algorithm disable command to enable the weak security algorithm function first.
The MD5 algorithm is not recommended if high security is required.
The password must be at least eight characters long and contain at least two of the following character types: uppercase letters, lowercase letters, digits, and special characters (excluding question marks and spaces).
For security purposes, you are advised to configure a ciphertext password, and change it periodically.
- (Optional) Run timer { aging aging-time | refresh refresh-time }
Timers are configured for the RPKI session.
The aging-time parameter specifies a value of the validation data age timer, and the refresh-time parameter specifies a value of the session update timer. You can configure the timers based on actual requirements on BGP security. Small values are recommended if high BGP security is required. However, frequent data updates consume much network bandwidth.
- (Optional) Run rpki-limit limit [ alert-only | idle-forever | idle-timeout times ]
The maximum number of ROA entries that the device is allowed to accept in a session is configured.
In most cases, a large number of ROA entries exist on an RPKI server. If the device receives a large number of ROA entries from the RPKI server, excessive system resources will be consumed. To prevent this problem, run the rpki-limit command to configure the maximum number of ROA entries that the BGP device is allowed to accept in a session.
- (Optional) Run connect-interface { interface-name | ipv4-source-address | interface-type interface-number | interface-type ipv4-source-address | interface-type interface-number ipv4-source-address }
The source interface for sending RPKI packets is specified.
- (Optional) Run ssl-policy policy-name
An SSL policy to be bound to the TCP connection between the device and RPKI server is configured.
- Run quit
Exit the RPKI session view.
- Run quit
Exit the RPKI view.
- Run commit
The configuration is committed.
After RPKI session configurations are changed, run the reset rpki session command to reset the involved RPKI session for the new configurations to take effect.
- Run system-view
- If a static ROA database needs to be configured on the local device, perform the following operations:
- Run system-view
The system view is displayed.
- Run rpki
RPKI is started, and the RPKI view is displayed.
- Run origin-validation
A static ROA database is created, and the RPKI origin-validation view is displayed.
- Run static record ipv4-address mask-length max-length max-mask-length origin-as as-number
A record is configured for the static ROA database.
- Run quit
Exit the RPKI origin-validation view.
- Run quit
Exit the RPKI view.
- Run commit
The configuration is committed.
- Run system-view
- If the local device needs to obtain the ROA database through a connection to be established with an RPKI server, perform the following operations:
- Run bgp as-number
The BGP view is displayed.
- Configure inbound or outbound ROA validation as required.
- To configure inbound ROA validation (validation results not affecting route acceptance) for the routes received from an EBGP peer, perform the following operations:
- Run prefix origin-validation enable
Origin AS validation of RPKI is enabled.
After origin AS validation is enabled, the device matches the origin AS of each received route against the origin AS data in the database and provides the validation result, which can be Valid, Not Found, or Invalid.
- (Optional) Run bestroute origin-as-validation [ allow-invalid ]
The device is configured to apply origin AS validation results of RPKI to BGP route selection.
BGP selects routes in descending order of Valid, Not Found, and Invalid after origin AS validation results are applied to route selection. If allow-invalid is not specified in the command, the BGP routes with the validation result being Invalid do not participate in route selection.
- (Optional) Run peer { ipv4-address | group-name } advertise-ext-community
The device is configured to advertise extended community attributes to the specified peer.
- (Optional) Run peer { ipv4-address | group-name } advertise origin-as-validation
The device is enabled to advertise origin AS validation results of RPKI to the specified BGP peer or peer group.
Origin AS validation results of RPKI can be advertised only to IBGP peers.
- Run prefix origin-validation enable
- To configure outbound ROA validation for the routes to be advertised to an EBGP peer to control route advertisement, perform the following operations:
Run peer { peerIpv4Addr | peerGroupName } origin-validation export [ include-not-found [ external ] ]
The local device is configured to perform outbound ROA validation on the routes to be advertised to the specified EBGP peer.
After the local device is configured to perform outbound ROA validation on the routes to be advertised to a specified EBGP peer, the device matches the origin ASs of the routes against those of the matched routes recorded in the database. The validation result can be Valid, Not Found, or Invalid. By default, only the routes whose validation result is Valid are advertised. To configure the device to advertise the routes with the validation result being Valid or Not Found, specify the include-not-found keyword in the preceding command. To configure the device to advertise the routes with the validation result being Valid or Not Found (if the routes with the result being Not Found were received from another AS), specify the include-not-found external keyword in the preceding command.
- To configure inbound ROA validation (validation results not affecting route acceptance) for the routes received from an EBGP peer, perform the following operations:
- Run commit
The configuration is committed.
Configuring Regional Validation
Resource Public Key Infrastructure (RPKI) regional validation or regional confederation validation ensures BGP security by validating route advertisers.
Usage Scenario
Regional validation: Users can manually combine multiple trusted ASs into a region and combine multiple regions into a regional confederation. Regional validation controls route selection results by checking whether the routes received from EBGP peers in an external region belong to the local region. This prevents intra-region routes from being hijacked by attackers outside the local region, and ensures that hosts in the local region can securely access internal services.
Regional validation applies to the following typical scenarios: regional validation scenario and regional confederation validation scenario.
Procedure
- Run system-view
The system view is displayed.
- Run rpki
RPKI is started, and the RPKI view is displayed.
- Run region-validation
Regional validation is enabled, and the region-validation view is displayed.
- You can configure regions or regional confederations as required.
- Create a region.
- Run region region-id
A region is created.
- Run description description-text
A description is configured for the region.
- Run as-number { asn } &<1-100>
An AS number list is configured so that the AS numbers in it can be added to the region.
- Run quit
Exit the RPKI region-validation-region view.
- Run region region-id
- Create a regional confederation.
- Run region region-id
A region is created.
- Run quit
Exit the RPKI region-validation-region view.
- Run region-confederation region-confederation-id
A regional confederation is created.
- Run description description-text
A description is configured for the regional confederation.
- Run region { region-id } &<1-100>
A region ID list is configured in the regional confederation so that regions in the list are added to the regional confederation.
- Run quit
Exit the RPKI region-validation-confederation view.
- Run region region-id
- Create a region.
- Run bgp as-number
The BGP view is displayed.
- Enable the region or regional confederation function as required.
- Run region-validation
BGP regional validation is enabled.
- Run region-validation confed-check strict
Strict BGP regional validation is enabled.
- Run region-validation
- Run bestroute region-validation [ allow-invalid ]
The device is configured to apply the BGP regional validation results of RPKI to BGP route selection.
If regional validation succeeds, the route is valid and can participate in route selection. If regional validation fails, the route is invalid and cannot participate in route selection. To allow the routes that fail regional validation to be valid and participate in route selection, configure the allow-invalid parameter in the command. The priority of such routes is reduced during route selection.
- Run commit
The configuration is committed.
Enabling SSL/TLS Authentication for BGP
To ensure data transmission security on a network, SSL/TLS authentication can be enabled for BGP message encryption.
Procedure
- Run system-view
The system view is displayed.
- Run ssl policy policy-name
An SSL policy is created, and the SSL policy view is displayed.
- Run quit
Return to the system view.
- Run bgp as-number
The BGP view is displayed.
- To configure SSL/TLS authentication for BGP, perform the following steps (no sequential order) on the client and server (the priority of the configuration on a peer is higher than that of the configuration on the peer group):
- To configure a peer or peer group as an SSL client or server, run the peer { group-name | ipv4-address } ssl-policy role { client | server } command.
- To apply the SSL policy to the SSL client or server, run the peer { group-name | ipv4-address } ssl-policyname ssl-policy-name command.
- To enable SSL/TLS authentication, run the peer { group-name | ipv4-address } ssl-server certificate command.
This operation can be performed only on the server.
- Run commit
The configuration is committed.
Configuring BGP Extensions
Configuring BGP extensions enables BGP to provide routing information for multiple routing protocols.
Usage Scenario
The section does not describe the commands that are associated with specific applications and used in the MP-BGP address family view in detail. For details, see the MP-BGP chapter.
Configuring BGP Multi-Instance
You can configure BGP multi-instance to achieve separate route management and maintenance.
Usage Scenario
By default, all BGP routes are stored in the BGP base instance, and separate route management and maintenance are impossible. To address this problem, BGP multi-instance is introduced. A device can simultaneously run the BGP base instance and BGP multi-instance, which are independent of each other and can have either the same AS number or different AS numbers. You can deploy different address families for the BGP base instance and BGP multi-instance as required to implement separate route management and maintenance.
Procedure
- Run the system-view command to enter the system view.
- Run the ip vpn-instance vpn-instance-name command to create a VPN instance and enter the VPN instance view.
- Run the ipv4-family command to configure a VPN instance IPv4 address family and enter its view.
- Run the route-distinguisher route-distinguisher command to set an RD for the VPN instance IPv4 address family.
- Run the vpn-target vpn-target &<1-8> [ both | export-extcommunity | import-extcommunity ] command to configure VPN targets for the VPN instance IPv4 address family.
- Run the quit command to enter the VPN instance view.
- Run the quit command to enter the system view.
- Run the bgp as-number instance instance-name command to enter the BGP multi-instance view.
- Run the ipv4-family vpn-instance vpn-instance-name command to enter the BGP multi-instance VPN instance IPv4 address family view.
- Run the peer ipv4-address as-number as-number command to specify the IP address of a peer and the number of the AS where the peer resides.
The IP address of the peer can be one of the following types:
IP address of the peer's interface that is directly connected to the local device
IP address of a sub-interface on the peer's interface that is directly connected to the local device
IP address of a reachable loopback interface on the peer
- Run the commit command to commit the configuration.
Maintaining BGP
Maintaining BGP involves resetting BGP connections and clearing BGP statistics.
Resetting BGP Connections
Resetting a BGP connection will interrupt peer relationships.
Context
The BGP peer relationship between routers is interrupted after you reset BGP connections with the reset bgp command. Exercise caution when resetting BGP connections.
When the BGP routing policy on the router that does not support the route-refresh capability changes, you need to reset BGP connections so that the change can take effect. To reset BGP connections, run the following reset commands in the user view:
Procedure
- To reset all BGP connections, run the reset bgp all command.
- To reset BGP connections with a specified AS, run the reset bgp as-number command.
- To reset BGP connections with a specified peer, run the reset bgp ipv4-address command.
- To reset all EBGP connections, run the reset bgp external command.
- To reset BGP connections with a specified peer group, run the reset bgp group group-name command.
- To reset all IBGP connections, run the reset bgp internal command.
Clearing BGP Statistics
This section describes how to clear the statistics about flapping routes and dampened routes.
Context
BGP statistics cannot be restored after being cleared. Therefore, exercise caution when running the command.
Procedure
- To clear statistics about flapping routes, run the reset bgp flap-info [ regexp as-path-regexp | as-path-filter { as-path-filter-number | as-path-filter-name } | ipv4-address [ mask | mask-length ] ] command in the user view.
- To clear statistics about flapping routes of a specified peer, run the reset bgp ipv4-address flap-info command in the user view.
- To clear statistics about dampened routes and release dampened routes, run the reset bgp dampening [ ipv4-address [ mask | mask-length ] ] command in the user view.
Configuring BGP to Record Peer Status Changes and Event Information
After you configure BGP to record peer status changes and event information, BGP logs every peer status change or event.
Context
If an error occurs on a BGP peer, BGP generates an error code and a subcode. If the error occurs on the local device, the local device disconnects the BGP peer and sends a BGP Notification message to the BGP peer. After the BGP peer receives the Notification message, it records the error code and subcode carried in the message and changes its state machine.
By default, BGP records peer status changes and event information in the system log files. The record includes BGP error codes and subcodes, BGP state machine changes, and whether BGP Notification messages are sent. The system log files serve as a reference to locate network connectivity faults.
If you do not want BGP to record peer status changes or event information, run the undo peer log-change command. After you run the undo peer log-change command, BGP records only the last peer status change in the log file. To check this log, run the display bgp peer loginfo command.
Disabling the PAF Restriction for the Feature Indicating Whether the Number of Received BGP Routes Exceeds the Upper Limit
You can disable the PAF restriction for the feature indicating whether the number of routes received from all peers in a BGP address family exceeds the upper limit. This configuration allows a device to continue to receive routes even after the number exceeds the upper limit.
Usage Scenario
By default, the PAF restriction is enabled for the feature indicating whether the number of routes received from all peers in a BGP address family exceeds the upper limit. With the PAF restriction, if the number of received routes exceeds 80% of the upper limit, a threshold alarm is generated. If the number exceeds the upper limit, a threshold-crossing alarm is generated, and the excess routes are discarded. To enable the local device to continue to receive routes even after the number exceeds the upper limit, run the bgp paf feature off command to disable the PAF restriction for this feature.
Currently, disabling the PAF restriction is supported only for the feature indicating whether the number of routes received from all peers in a BGP address family exceeds the upper limit. If the PAF restriction is disabled on a BGP device, the device can still learn routes when the upper limit is exceeded, but this may consume excessive memory and affect other services. In addition, the device may be forced to restart if the memory is depleted. Therefore, disabling the PAF restriction is not recommended.
Configuring a Mode in Which BGP Path Attributes Are Processed
To enhance reliability, you can configure a special mode in which BGP path attributes are processed.
Usage Scenario
A BGP Update message contains various path attributes. If a local device receives Update messages containing malformed path attributes, the involved BGP sessions may flap. To resolve this issue and enhance reliability, configure a special mode in which a device processes specified path attributes in received BGP Update messages. Special modes indicate those that are not defined in a standard protocol.
This configuration may cause the specified path attributes to be dropped or the routes carrying the specified path attributes to be withdrawn. Therefore, exercise caution when you perform this configuration.
The peer path-attribute-treat command configuration takes effect immediately for the routes received after the command is run. However, for the routes received before the command is run, the configuration can take effect only after the refresh bgp command is run.
Procedure
- Run system-view
The system view is displayed.
- Run bgp path-attribute { originator-id | attr-set } accept-zero-value or bgp path-attribute { community | ext-community | ipv6-ext-community | large-community | attr-set | wide-community } accept-zero-length
The method of handling incorrect path attributes is set.
BGP Update messages contain various path attributes. If the local device receives any Update message with an incorrect format, BGP session flapping may occur. To enhance reliability, you can perform this step to configure a special mode in which the device processes specified BGP path attributes. To configure the device to process path attributes with the value being 0, set accept-zero-value. To configure the device to process path attributes with the length being 0, set accept-zero-length.
To configure the device to process incorrect BGP path attributes, perform this step. To configure the device to process incorrect BGP path attributes in a specific address family, enter the address family view and run the corresponding command.
- Run bgp as-number
BGP is started (with the local AS number specified), and the BGP view is displayed.
- Run peer ipv4-address as-number as-number
The IP address of a peer and the number of the AS where the peer resides are specified.
- Run ipv4-family unicast
The BGP-IPv4 unicast address family view is displayed.
- Run the peer peerIpv4Addr path-attribute-treat attribute-id { id [ to id2 ] } &<1-255> { discard | withdraw | treat-as-unknown } command to configure a processing mode for specified attributes. Alternatively, run the peer peerIpv4Addr treat-with-error attribute-id id accept-zero-value command to configure a processing mode for incorrect path attributes.
BGP Update messages contain various path attributes. If the local device receives any Update message with an incorrect format, BGP session flapping may occur. To enhance reliability, you can perform this step to configure a processing mode for specified BGP path attributes or incorrect path attributes.
The path-attribute-treat parameter specifies a path attribute processing mode, which can be any of the following ones:Discarding specified attributes
Withdrawing the routes with specified attributes
Processing specified attributes as unknown attributes
The treat-with-error parameter specifies a processing mode for incorrect path attributes. The mode can be as follows:
Accepting the path attributes with a value of 0.
- Run commit
The configuration is committed.
Setting a Priority That Determines the Disconnection Order of a BGP Peer Relationship If Memory Overload Occurs
You can set a priority that determines the disconnection order of a BGP peer relationship upon memory overload. If the system memory usage exceeds the alarm threshold and the BGP memory usage is excessively high, such configurations allow BGP peer relationships to be disconnected in order of priority. This prevents BGP from exhausting the memory.
Usage Scenario
If BGP keeps accepting new routes in the case of a memory exception, the device memory may be exhausted. As a result, the involved process or board is reset. To prevent this problem, you can enable BGP to discard new routes upon a memory exception.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
BGP is started (with the local AS number specified), and the BGP view is displayed.
- Run peer ipv4-address as-number as-number
The IP address of a peer and the number of the AS where the peer resides are specified.
- Run ipv4-family unicast
The BGP-IPv4 unicast address family view is displayed.
- Run peer peerIpv4Addr memory-priority priority
A priority is set, which determines the disconnection order of the specified BGP peer relationship if memory overload occurs.
- Run commit
The configuration is committed.
Enabling BGP to Discard New Routes If a Memory Exception Occurs
After BGP is enabled to discard new routes, BGP will discard the new routes received from peers in the case of a memory exception on the device.
Context
Usage Scenario
If BGP keeps accepting new routes when the device memory is abnormal, the device memory may be exhausted. As a result, the involved process or board is reset. To prevent this problem, you can enable BGP to discard new routes if a memory exception occurs.
Configuring Whitelist Session-CAR for BGP
You can configure whitelist session-CAR for BGP to isolate bandwidth resources by session for BGP messages. This configuration prevents bandwidth preemption among BGP sessions in the case of a traffic burst.
Context
The function of whitelist session-CAR for BGP sets an independent CAR channel for each BGP session to ensure that the bandwidth of each BGP session is not preempted by other traffic (including traffic from other sessions of the same protocol and traffic from other protocols). When BGP messages suffer a traffic burst, you can adjust the default parameters of whitelist session-CAR for BGP if they do not meet service requirements. This ensures that BGP messages can be sent properly.
In normal cases, you are advised to enable whitelist session-CAR for BGP. If this function becomes abnormal or adversely affects other services, you can run the whitelist session-car bgp disable command to disable this function.
Procedure
- Run system-view
The system view is displayed.
- Run whitelist session-car bgp { cir cir-value | cbs cbs-value | pir pir-value | pbs pbs-value } *
Parameters of whitelist session-CAR for BGP are configured.
In normal cases, you are advised to use the default values of these parameters.
- Run commit
The configuration is committed.
Verifying the Configuration
After configuring whitelist session-CAR for BGP, verify the configuration.
- Run the display cpu-defend whitelist session-car bgp statistics slot slot-id command to check statistics about whitelist session-CAR for BGP on a specified interface board.
To check the statistics within a specific period of time, run the reset cpu-defend whitelist session-car bgp statistics slot slot-id command to clear the existing statistics about whitelist session-CAR for BGP on the specified interface board; after a certain period of time, run the display cpu-defend whitelist session-car bgp statistics slot slot-id command.
The statistics about whitelist session-CAR for BGP on a specified interface board cannot be restored after being cleared. Therefore, exercise caution when you run the reset cpu-defend whitelist session-car bgp statistics slot slot-id command.
Configuring Whitelist Session-CAR for BMP
You can configure whitelist session-CAR for BMP to isolate bandwidth resources by session for BMP messages.
Context
The function of whitelist session-CAR for BMP sets an independent CAR channel for each BMP session to ensure that the bandwidth of each BMP session is not preempted by other traffic (including traffic of other sessions of the same protocol and traffic of other protocols). When BMP messages form a traffic burst, you can adjust the bandwidth for each BMP session in whitelist session-CAR for BMP to ensure that BMP messages can be sent to the CPU properly.
If the function becomes abnormal or affects other services, you can run the whitelist session-car bmp disable command to disable whitelist session-CAR for BMP. In normal cases, you are advised to keep whitelist session-CAR for BMP enabled.
Procedure
- Run system-view
The system view is displayed.
- Run whitelist session-car bmp { cir cir-value | cbs cbs-value | pir pir-value | pbs pbs-value } *
Parameters of whitelist session-CAR for BMP are configured.
In normal cases, you are advised to use the default values.
- Run commit
The configuration is committed.
Verifying the Configuration
Run the following commands to check the previous configuration:
- Run the display cpu-defend whitelist session-car bmp statistics slot slot-id command to check statistics about IPv4 whitelist session-CAR for BMP on a specified interface board.
To check the statistics within a specific period of time, run the reset cpu-defend whitelist session-car bmp statistics slot slot-id command to clear the existing statistics about IPv4 whitelist session-CAR for BMP on the specified interface board; after a certain period of time, run the display cpu-defend whitelist session-car bmp statistics slot slot-id command.
The statistics about whitelist session-CAR for BMP on a specified interface board cannot be restored after being cleared. Therefore, exercise caution before clearing them.
Configuring Whitelist Session-CAR for RPKI
You can configure whitelist session-CAR for RPKI to isolate bandwidth resources by session for RPKI messages.
Context
The function of whitelist session-CAR for RPKI sets an independent CAR channel for each RPKI session to ensure that the bandwidth of each RPKI session is not preempted by other traffic (including traffic of other sessions of the same protocol and traffic of other protocols). When RPKI messages form a traffic burst, you can adjust the bandwidth for each RPKI session in whitelist session-CAR for RPKI to ensure that RPKI messages can be sent to the CPU properly.
If the function becomes abnormal or affects other services, you can run the whitelist session-car rpki disable command to disable whitelist session-CAR for RPKI. In normal cases, you are advised to keep whitelist session-CAR for RPKI enabled.
Procedure
- Run system-view
The system view is displayed.
- Run whitelist session-car rpki { cir cir-value | cbs cbs-value | pir pir-value | pbs pbs-value } *
Parameters of whitelist session-CAR for RPKI are configured.
In normal cases, you are advised to use the default values.
- Run commit
The configuration is committed.
Verifying the Configuration
Run the following commands to check the previous configuration:
- Run the display cpu-defend whitelist session-car rpki statistics slot slot-id command to check statistics about IPv4 whitelist session-CAR for RPKI on a specified interface board.
To check the statistics within a specific period of time, run the reset cpu-defend whitelist session-car rpki statistics slot slot-id command to clear the existing statistics about IPv4 whitelist session-CAR for RPKI on the specified interface board; after a certain period of time, run the display cpu-defend whitelist session-car rpki statistics slot slot-id command.
The statistics about whitelist session-CAR for RPKI on a specified interface board cannot be restored after being cleared. Therefore, exercise caution before clearing them.
Configuring Micro-Segment CAR for BGP
You can configure micro-segment CAR for BGP to isolate bandwidth resources by interface and sub-interface for BGP messages used to establish peer relationships.
Context
When BGP messages used to establish peer relationships suffer a traffic burst, bandwidth may be preempted among interfaces and sub-interfaces. As a result, the BGP messages may fail to be sent properly. To resolve this problem, you can configure micro-segment CAR for BGP to isolate bandwidth resources by interface and sub-interface for the BGP messages. If the default parameters of micro-segment CAR for BGP do not meet service requirements, you can adjust them as required to ensure that the BGP messages can be sent properly.
Procedure
- Run system-view
The system view is displayed.
- Run micro-isolation protocol-car bgp { cir cir-value | cbs cbs-value | pir pir-value | pbs pbs-value } *
Parameters of micro-segment CAR for BGP are configured.
In normal cases, you are advised to use the default values of these parameters.
- (Optional) Run micro-isolation protocol-car bgp disable
Micro-segment CAR for BGP is disabled.
In normal cases, you are advised to keep this function enabled. Disable it if it becomes abnormal or adversely affects other services.
- Run commit
The configuration is committed.
BGP Route Selection Rules
Route Processing on the BGP router
Understanding how the BGP router processes routes helps you better control the BGP routing table.
Figure 1-1785 shows the route processing on the BGP router. BGP routes can be imported from other protocols or learned from BGP peers. Route summarization can be configured to reduce the routing table size before routes are selected, advertised, and delivered to the IP routing table.
No. |
Remarks |
---|---|
1 |
BGP can import direct routes, static routes, user network routes, and IGP routes based on the import-route (BGP) or network command configuration. |
2 |
BGP can use routing policies when importing routes from other protocols, receiving routes from BGP peers, or advertising routes to BGP peers. Routing policies can be used to filter routes or modify route attributes. |
3 |
BGP supports automatic and manual summarization. Multiple routing policies can be used during manual summarization. |
4 |
BGP selects routes based on strict route selection rules, which is the key point to be discussed in the following part. |
5 |
BGP adds the optimal route to the BGP routing table and advertises it to BGP peers. |
6 |
BGP adds the routes learned from peers and the optimal route in the BGP routing table to the IP routing table for traffic forwarding. |
Route Selection Rules
When multiple received routes are available to the same destination, BGP selects one optimal route based on BGP route selection rules and adds it to the IP routing table for traffic forwarding.
Figure 1-1786 shows how BGP selects the optimal route among multiple routes to the same destination on the NetEngine 8100 M, NetEngine 8000E M, NetEngine 8000 M.
BGP selects routes by comparing route attributes in a fixed order. When a route attribute is a sufficient condition for determining the optimal route, BGP does not compare the other attributes. If BGP fails to select the optimal route after comparing all route attributes, the route that was first received is selected as the optimal route. Table 1-699 lists the abbreviated alias, route selection rules, and remarks of each matching item. Table 1-699 shows that the route priority is directly proportional to the PrefVal or Local_Pref value and inversely proportional to the rest of the attribute values or lengths. In addition, the first column can be summarized as a character string (OPPAAA OMTCC RA), which helps memorize the matching sequence.
Abbreviated Alias |
Matching Item |
Route Selection Rules |
Remarks |
---|---|---|---|
O |
Origin AS |
Valid > NotFound > Invalid |
BGP origin AS validation states are applied to route selection in a scenario where the device is connected to an RPKI server. |
P |
PrefVal |
The route with the largest PrefVal value is preferred. The default value is 0. |
It is valid only locally. |
P |
Local_Pref |
The route with the largest Local_Pref value is preferred. The default value is 100. |
To modify the default Local_Pref value of BGP routes, run the default local-preference command. |
A NOTE:
A is the initial of the character string (ASNIL). |
Route generation mode |
A > S > N > I > L, where:
|
- |
A |
Accumulated Interior Gateway Protocol (AIGP) |
The route with the smallest AIGP value is preferred. The route with AIGP to the route without AIGP is preferred. |
- |
A |
AS_Path |
The route with the shortest AS_Path length is preferred. |
If the bestroute as-path-ignore command is run, BGP does not compare the AS_Path lengths in different routes during route selection. |
O |
Origin |
IGP > EGP > Incomplete |
- |
M |
Multi Exit Discriminator (MED) |
The route with the smallest MED value is preferred. The default value is 0. |
If the bestroute med-none-as-maximum command is configured, BGP considers the largest MED value (4294967295) as the MED of the route that does not carry an MED. For details about MED usage, see MED. |
T |
Peer type |
EBGP > IBGP |
- |
C |
IGP metric |
The route with the smallest IGP cost is preferred. |
If the bestroute igp-metric-ignore command is configured, BGP does not compare the IGP cost. |
C |
Cluster_List |
The route with the shortest Cluster_List length is preferred. |
By default, Cluster_List takes precedence over Originator_ID during BGP route selection. To enable Originator_ID to take precedence over Cluster_List during BGP route selection, run the bestroute routerid-prior-clusterlist command. |
R |
Router ID |
The route with the smallest router ID is preferred. |
If routes carry the Originator_ID, the originator ID is substituted for the router ID during route selection. The route with the smallest Originator_ID is preferred. |
A |
Peer IP address |
The route learned from the peer with the smallest IP address is preferred. |
- |
Selection of the Routes for Load Balancing
After BGP load balancing is configured, the BGP routes that meet the following conditions are used as equal-cost routes for load balancing:
- Original next-hop addresses are different.
The routes have the same Origin AS.
The routes have the same PrefVal value.
The routes have the same Local_Pref value.
All the routes are summarized or non-summarized routes.
The routes have the same AIGP value.
The routes have the same AS_Path length.
The routes have the same origin type (IGP, EGP, or incomplete).
The routes have the same MED value. If the load-balancing med-ignore command is run, BGP does not compare the MED attributes of routes when deciding the routes used for load balancing.
All the routes are EBGP or IBGP routes. After the maximum load-balancing eibgp command is run, BGP does not use this rule in optimal VPN route selection.
The metric values of the IGP routes to which BGP routes within an AS recurse are the same. After the load-balancing igp-metric-ignore command is run, the device does not compare IGP metric values when selecting routes for load balancing.
- All routes are blackhole or non-blackhole routes.
Even if the preceding conditions are met, load balancing cannot be implemented among labeled BGP routes and non-labeled BGP routes. Load balancing cannot be implemented between blackhole routes and non-blackhole routes.
VPN Route Selection Rules
On the NetEngine 8100 M, NetEngine 8000E M, NetEngine 8000 M, the rules for selecting VPN BGP routes are the same as those for selecting public network BGP routes. The only difference is that VPN BGP routes need to be leaked based on VPN targets. For details about route leaking, see "BGP VPN Route Leaking" in NetEngine 8100 M, NetEngine 8000E M, NetEngine 8000 M Feature Description > IP Routing > BGP.
BGP Routing Table
This section describes how to check route attributes.
Table 1-700 lists all the common route attributes that affect route selection and the commands that are used to check them.
Route Attribute |
Command Used to Check the Route Attribute |
---|---|
Origin AS |
display bgp routing-table [ network ] |
PrefVal |
display bgp routing-table [ network ] |
Local_Pref |
display bgp routing-table [ network ] |
Route type |
display bgp routing-table network |
AIGP |
display bgp routing-table network |
AS_Path |
display bgp routing-table [ network ] |
Origin |
display bgp routing-table [ network ] |
MED |
display bgp routing-table [ network ] |
Peer type |
display bgp routing-table network |
IGP Metric |
|
Cluster_List |
display bgp routing-table network |
Originator_ID |
display bgp routing-table network |
Router ID |
display bgp routing-table network |
Peer IP address |
display bgp routing-table network |
The following example describes how to check BGP route attributes in the display bgp routing-table command output.
<HUAWEI> display bgp routing-table BGP Local router ID is 1.1.1.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 4 Network NextHop MED LocPrf PrefVal Path/Ogn * 10.1.1.0/24 10.1.1.1 0 0 100? * 10.1.1.2/32 10.1.1.1 0 0 100? *> 10.1.1.0/24 10.1.1.1 0 0 100? *> 10.10.1.0/24 10.1.1.1 0 0 100?
Item |
Description |
---|---|
BGP Local router ID is 1.1.1.2 |
Router ID: 1.1.1.2, in the same format as an IPv4 address |
Status codes |
Route status code, displayed in front of each route entry:
BGP dampening measures route stability using a penalty value. The greater the penalty value, the less stable a route. Each time route flapping occurs (a device receives a Withdraw or an Update packet), BGP adds a penalty value to the route carried in the packet. When the penalty value of a route exceeds the Suppress value, BGP suppresses the route by replacing the > sign of the route with the d or h sign. The route is ignored and its Update packets are not advertised to other BGP peers until the penalty value of the route decreases to the Reuse value.
The penalty value is not increased after it reaches the suppression threshold. The penalty value of a suppressed route reduces by half after a half-life period.
|
Origin |
Route Origin:
|
RPKI validation codes |
Route origin AS validation code.
|
Network |
Network address in the BGP routing table |
NextHop |
Next hop address |
MED |
MED value of a BGP route, similar to the cost of IGP routes |
LocPrf |
Local_Pref |
PrefVal |
PrefVal |
Path/Ogn |
AS_Path and Origin attributes |
Information about Next_Hop, MED, Local_Pref, PrefVal, AS_Path, and Origin can be displayed using the display bgp routing-table command. To check information about the route type, AIGP, peer type, IGP cost, Cluster_List, router ID, and peer IP address, run the display bgp routing-table network command.
<HUAWEI> display bgp routing-table 10.1.1.1
BGP local router ID : 192.168.2.2 Local AS number : 100 Paths: 1 available, 1 best, 1 select, 0 best-external, 0 add-path BGP routing table entry information of 10.1.1.1/32: From: 10.1.3.1 (192.168.2.3) Route Duration: 0d00h01m33s Direct Out-interface: GigabitEthernet0/1/0 Relay is delayed as nexthop flapped frequently Original nexthop: 10.1.3.1 Qos information : 0x0 Primary Routing Table: vrf1 AS-path 200, origin incomplete, MED 0, pref-val 0, valid, external, best, select, active, pre 255, IGP cost 20 Advertised to such 1 peers: 10.1.3.1
Item |
Description |
---|---|
BGP local router ID |
Router ID of the local device, in the same format as an IPv4 address. |
Local AS number |
Local AS number. |
Paths |
BGP route information. |
BGP routing table entry information of 10.1.1.1/32 |
Information about the BGP route 10.1.1.1/32: |
From |
IP address of the device that sends the route. 10.1.3.1 is the IP address (Peer IP Address) of the interface used by the peer to set up a BGP connection, and 192.168.2.3 is the router ID of the peer. |
Route Duration |
Duration of a route. |
Direct Out-interface |
Directly connected interface. |
Relay is delayed as nexthop flapped frequently |
Route recursion to a specified next hop is suppressed because the next hop flaps. If only a small number of routes recurse to the next hop, the suppression is very short; therefore, this field may not be displayed in this case. |
Original nexthop |
Original next hop IP address. |
Qos information |
QoS information. |
Primary Routing Table |
The source routing table |
AS-path |
AS_Path attribute. If Nil is displayed, the AS_Path attribute is null. |
origin incomplete |
Origin attribute of the route, which can be any of the following three values:
|
MED |
MED value of a BGP route, similar to the cost of IGP routes. |
pref-val |
PrefVal |
valid |
Valid route with a reachable next hop address. |
external |
Type of the peer from which the route is learned.
|
best |
Optimal route. |
select |
Selected route to be delivered to the IP routing table. NOTE:
According to BGP selection rules, BGP selects only one optimal route, and this route is marked with best. In load balancing or FRR scenarios, more than one route needs to be added to the IP routing table, and each of the route is marked with select. Therefore, the number of the route marked with best is 1, and the number of the routes marked with select is the actual number of BGP routes added to the IP routing table. |
active |
Active route. |
pre 255 |
Protocol priority of the route: 255 |
Advertised to such 1 peers |
The BGP route has been advertised to one peer. |
The display bgp routing-table network [ { mask | mask-length } [ longer-prefixes ] ] command output is related to the route generation and transmission modes. Not all attributes of BGP routes are displayed. In the preceding command output, the route type of the route 10.1.1.1/32 is not displayed because it is an IBGP route. If you run the display bgp routing-table network [ { mask | mask-length } [ longer-prefixes ] ] command, the route type will be displayed. For example:
<HUAWEI> display bgp routing-table 10.0.0.0
BGP local router ID : 192.168.2.4 Local AS number : 200 Paths: 1 available, 1 best, 1 select BGP routing table entry information of 10.0.0.0/8: Aggregated route. Route Duration: 04h50m46s Direct Out-interface: NULL0 Original nexthop: 127.0.0.1 Qos information : 0x0 AS-path {65001 10 100}, origin incomplete, pref-val 0, valid, local, best, select, active, pre 255 Aggregator: AS 200, Aggregator ID 192.168.2.4, Atomic-aggregate Advertised to such 3 peers: 10.1.7.2 172.16.1.2 192.168.1.2
- If the route is automatically summarized using the summary automatic command, Summary automatic route will be displayed.
- If the route is imported using the network command, Network route will be displayed.
- If the route is imported using the import-route command, Imported route will be displayed.
In the following example, an RR and a cluster are configured. Therefore, the Cluster_List attribute is displayed in the display bgp routing-table network [ { mask | mask-length } [ longer-prefixes ] ] command output. For example:
<HUAWEI> display bgp routing-table 10.2.1.0
BGP local router ID : 4.4.4.4 Local AS number : 65010 Paths: 1 available, 0 best, 0 select BGP routing table entry information of 10.2.1.0/24: From: 10.1.4.1 (2.2.2.2) Route Duration: 00h00m14s Relay IP Nexthop: 0.0.0.0 Relay IP Out-Interface: Original nexthop: 10.1.1.2 Qos information : 0x0 AS-path Nil, origin igp, MED 0, localpref 100, pref-val 0, internal, pre 255 Originator: 1.1.1.1 Cluster list: 0.0.0.1 Not advertised to any peer yet
Route Attributes
BGP ignores routes with an unreachable next hop address during BGP route selection.
Unlike the Next_Hop attribute in an IGP, the Next_Hop attribute in BGP is not necessarily the IP address of a neighboring device. In most cases, the Next_Hop attribute in BGP complies with the following rules:
When advertising a route to an EBGP peer, the BGP speaker sets the Next_Hop of the route to the address of the local interface through which the BGP peer relationship is established.
When advertising a locally generated route to an IBGP peer, the BGP speaker sets the Next_Hop of the route to the address of the local interface through which the BGP peer relationship is established.
When advertising a route learned from an EBGP peer to an IBGP peer, the BGP speaker does not change the Next_Hop of the route.
When advertising a route learned from an IBGP peer to another IBGP peer, the BGP speaker does not modify the Next_Hop of the route.
Modifying the Next_Hop
Objectives |
Command |
Usage Scenarios |
Remarks |
---|---|---|---|
To enable the device to modify the Next_Hop of the routes to be advertised to an IBGP peer |
peer { ipv4-address | group-name } next-hop-local |
By default, a device does not change the next hop address of a route learned from an EBGP peer before forwarding the route to IBGP peers. The next hop address of a route advertised by an EBGP peer to this device is the peer address of the EBGP peer. After being forwarded to IBGP peers in the local AS, this route is not active because the next hop is unreachable. To address this problem, the relevant ASBR needs to be configured to change the Next_Hop of the route learned from an EBGP peer to the ASBR's own address before the ASBR advertises the route to an IBGP peer. As an IGP runs within the AS, the next hop of the route is reachable to the IBGP peer. As such, the route received by the IBGP peer is active. |
NOTE:
If BGP load balancing is configured using the maximum load-balancing number command, the router changes the next hop address of a route to the IP address used to establish an IBGP peer relationship when advertising the route to the IBGP peer or peer group, regardless of whether the peer next-hop-local command is run. |
To configure a device to retain the original Next_Hop of imported IGP routes when the device advertises the routes to an IBGP peer |
peer { ipv4-address | group-name } next-hop-invariable |
In an intra-AS scenario, if a device is configured to retain the original Next_Hop of imported IGP routes when advertising the routes to an IBGP peer, the peer can use the original Next_Hop for recursion, which reduces the number of hops. |
- |
To configure a BGP device to retain the original Next_Hop of imported static routes when advertising the routes to an IBGP peer |
peer { ipv4-address | group-name } next-hop-invariable include-static-route |
In an intra-AS scenario, if a device is configured to retain the original Next_Hop of imported static routes when advertising the routes to an IBGP peer, the peer can use the original Next_Hop for recursion, which reduces the number of hops. |
- |
To configure a BGP device to retain the original Next_Hop when the device advertises to an EBGP peer the unicast routes learned from another peer |
peer { ipv4-address | group-name } next-hop-invariable include-unicast-route |
In an intra-AS scenario, if a device is configured to retain the original Next_Hop of unicast routes when advertising them to a peer, the peer can directly use the original Next_Hop for recursion, which reduces the number of hops. |
- |
To prevent a device from modifying the Next_Hops of routes before advertising the routes to EBGP peers |
peer { group-name | ipv4-address } next-hop-invariable |
In an inter-AS VPN Option C scenario where RRs are used, the peer next-hop-invariable command needs to be run on the RRs to prevent them from modifying the Next_Hops of routes before advertising the routes to an EBGP peer. This ensures that the remote PE can implement recursion to the BGP LSP to the local PE during traffic transmission. |
- |
To configure route-policy-based next hop recursion |
nexthop recursive-lookup route-policy route-policy-name |
Route-policy-based next hop recursion helps flexibly control the recursion result based on specific conditions. If a route does not match the specified route-policy, the route fails to recurse. |
- |
To enable a device to modify the Next_Hops of BGP routes using a route-policy |
apply ip-address next-hop { ipv4-address | peer-address } |
The Next_Hops of BGP routes can be modified using a route-policy in the following situations:
|
If a route-policy has been specified in the import-route or network command, the apply clause configured for the route-policy using the apply ip-address next-hop command does not take effect. |
Obtaining a Reachable BGP Next Hop
Item |
Description |
Solutions |
---|---|---|
Unreachable next hop IP address |
A next hop IP address is obtained through route recursion, but no active routes to the IP address are available in the IP routing table. |
Common solutions are as follows:
Alternatively, you can run the peer next-hop-local command to change the Next_Hop to the local IP address. |
Unreachable next hop tunnel |
Routes fail to recurse to tunnels. |
Configure a tunnel policy or a tunnel selector to ensure that the routes can recurse to tunnels. |
A next hop tunnel is obtained through route recursion, but the tunnel is unavailable. |
Ensure that the tunnel is correctly configured and is Up. |
# Display the BGP routing table of DeviceA.
[~DeviceA] display bgp routing-table
BGP Local router ID is 10.1.1.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 2 Network NextHop MED LocPrf PrefVal Path/Ogn *> 1.1.1.9/32 0.0.0.0 0 0 i i 3.3.3.9/32 10.1.2.1 0 100 0 65001i
The preceding command output shows that no asterisk (*) is in front of the route 3.3.3.9/32, which indicates that the route is invalid.
# Display the IP routing table of DeviceA.
[~DeviceA] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : _public_ Destinations : 5 Routes : 5 Destination/Mask Proto Pre Cost Flags NextHop Interface 1.1.1.9/32 Direct 0 0 D 127.0.0.1 LoopBack1 10.1.1.0/30 Direct 0 0 D 10.1.1.1 GigabitEthernet0/1/0 10.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
- Configure a static route destined for 10.1.2.1/30 on DeviceA.
- Configure an IGP on DeviceB and DeviceC and configure BGP on DeviceB to import the route 10.1.2.1. However, this method is not applicable to this scenario because DeviceB and DeviceC are located in different ASs.
- Run the import-route direct command on DeviceB. This solution is not optimal because unnecessary routes may be imported.
- Run the network 10.1.2.0 30 command on DeviceB to configure BGP to advertise the route 10.1.2.0/30 to DeviceA.
- Run the peer 10.1.1.1 next-hop-local command on DeviceB to configure DeviceB to modify the Next_Hop of the route 3.3.3.9/32 before advertising the route to DeviceA.
In this example, the network 10.1.2.0 30 command is run on DeviceB. After the command is run, check the BGP routing table of DeviceA.
[~DeviceA] display bgp routing-table
BGP Local router ID is 10.1.1.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 3 Network NextHop MED LocPrf PrefVal Path/Ogn *> 1.1.1.9/32 0.0.0.0 0 0 i *>i 3.3.3.9/32 10.1.2.1 0 100 0 65001i *>i 10.1.2.0/30 10.1.1.2 0 100 0 i
The preceding command output shows that both * and > are in front of the route 3.3.3.9/32, which indicates that the route is valid and optimal.
BGP prefers the route with the largest PreVal value during BGP route selection.
PrefVal is valid only on the local device and is not transmitted to BGP peers. PrefVal values are manually set and represent the intention of the local user. Therefore, BGP preferentially compares PrefVal values during route selection.
To configure a PreVal value for the routes learned from a peer or peer group, run the peer { group-name | ipv4-address } preferred-value value command.
If multiple routes are available to the same destination, the route with the largest PreVal value is selected as the optimal route.
Method |
Usage Scenario |
---|---|
Run the peer { group-name | ipv4-address } preferred-value value command. |
This method sets a PreVal value for the routes learned from a peer or peer group. |
Configure an import policy and run the apply preferred-value preferred-value command to configure an apply clause for the policy. |
This method sets different PreVal values for different routes learned from a peer or peer group. NOTE:
If a route matches both the peer preferred-value and apply preferred-value commands, the apply preferred-value command takes effect. |
Scenario 1: When no PreVal value is configured on Device A, check the BGP routing table of Device A.
[~DeviceA] display bgp routing-table
BGP Local router ID is 10.1.2.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 4 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.11.0.0/16 10.1.3.2 0 200? * 10.1.2.2 0 300 100? *> 10.22.0.0/16 10.1.3.2 0 200? * 10.1.2.2 0 300 100?
The BGP routing table of Device A shows that Device A receives the routes 10.11.0.0/16 and 10.22.0.0/16 from ISP1 and ISP2. Check the information about the route 10.11.0.0/16 on Device A.
[~DeviceA] display bgp routing-table 10.11.0.0
BGP local router ID : 10.1.2.1 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.11.0.0/16: From: 10.1.3.2 (10.1.3.2) Route Duration: 00h08m35s Direct Out-interface: GigabitEthernet0/1/1 Original nexthop: 10.1.3.2 Qos information : 0x0 AS-path 200, origin incomplete, pref-val 0, valid, external, best, select, active, pre 255 Advertised to such 2 peers: 10.1.3.2 10.1.2.2 BGP routing table entry information of 10.11.0.0/16: From: 10.1.2.2 (10.1.2.2) Route Duration: 00h04m38s Direct Out-interface: 0/1/0 Original nexthop: 10.1.2.2 Qos information : 0x0 AS-path 300 100, origin incomplete, pref-val 0, valid, external, pre 255, not preferred for AS-Path Not advertised to any peer yet
Route Attribute |
Route Learned from ISP1 |
Route Learned from ISP2 |
Comparison |
---|---|---|---|
PrefVal |
0 |
0 |
The same. |
Local_Pref |
- |
- |
The same. NOTE:
If a route does not carry Local_Pref, the default value 100 takes effect. |
Route type |
Learned from a peer |
Learned from a peer |
The same. |
AIGP |
- |
- |
The same. |
AS_Path |
300 100 |
200 |
The route learned from ISP2 is selected as the optimal route because its AS_Path is shorter than that of the route learned from ISP1. |
Scenario 2: The administrator of AS 65001 requires that ISP1 be active and ISP2 be backup for the traffic to 10.11.0.0/16 and 10.22.0.0/16.
To meet the preceding requirements, run the peer { group-name | ipv4-address } preferred-value value command on DeviceA to increase the PrefVal values of the routes learned from AS 300. This configuration ensures that the routes learned from ISP1 are selected by DeviceA as the optimal routes to 10.11.0.0/16 and 10.22.0.0/16. Detailed configurations are as follows:
bgp 65001 # ipv4-family unicast peer 10.1.2.2 preferred-value 120 //Set the PrefVal of the routes learned from AS 300 to 120.
Run the display bgp routing-table [ ip-address ] command to check the configurations.
# Display the routing table of Device A.
[~DeviceA] display bgp routing-table
BGP Local router ID is 10.1.2.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 4 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.11.0.0/16 10.1.2.2 120 300 100? * 10.1.3.2 0 200? *> 10.22.0.0/16 10.1.2.2 120 300 100? * 10.1.3.2 0 200?
The preceding command output shows that Device A selects the routes learned from ISP1.
# Display detailed information about the route 10.11.0.0/16 or 10.22.0.0/16 on Device A. The route 10.11.0.0/16 is used as an example.
[~DeviceA] display bgp routing-table 10.11.0.0
BGP local router ID : 10.1.2.1 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.11.0.0/16: From: 10.1.2.2 (10.1.2.2) Route Duration: 00h05m36s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.2.2 Qos information : 0x0 AS-path 300 100, origin incomplete, pref-val 120, valid, external, best, select, active, pre 255 Advertised to such 2 peers: 10.1.3.2 10.1.2.2 BGP routing table entry information of 10.11.0.0/16: From: 10.1.3.2 (10.1.3.2) Route Duration: 00h23m11s Direct Out-interface: GigabitEthernet0/1/1 Original nexthop: 10.1.3.2 Qos information : 0x0 AS-path 200, origin incomplete, pref-val 0, valid, external, pre 255, not preferred for PreVal Not advertised to any peer yet
The preceding command output shows that the PrefVal value of the route learned by DeviceA from ISP1 is larger and that the route learned from ISP1 is selected as the optimal route.
Scenario 3: The expected configurations of the administrator of AS 65001 are as follows:
- For the traffic destined to 10.11.0.0/16, ISP1 is active and ISP2 is backup.
- For the traffic destined to 10.22.0.0/16, ISP2 is active and ISP1 is backup.
To meet the preceding requirements, ensure that the route 10.11.0.0/16 learned from ISP1 and the route 10.22.0.0/16 learned from ISP2 are selected in AS 65001. In this situation, the peer preferred-value command can no longer be used because different PrefVal values are required for the routes learned from the same peer. In this case, configure import policies. Detailed configurations are as follows:
# bgp 65001 # ipv4-family unicast peer 10.1.2.2 route-policy for_isp1_in import //Apply import policy named for_isp1_in to the routes learned from 10.1.2.2 and use for_isp1_in to modify the PrefVal value. peer 10.1.3.2 route-policy for_isp2_in import //Apply import policy named for_isp2_in to the routes learned from 10.1.3.2 and use for_isp2_in to modify the PrefVal value. # route-policy for_isp1_in permit node 10 //Define the first node of for_isp1_in and set the PrefVal value of the route 10.11.0.0/16 to 80. if-match ip-prefix for_isp1 apply preferred-value 80 # route-policy for_isp1_in permit node 20 //Define the second node of for_isp1_in and allow for_isp1_in to permit all routes. # route-policy for_isp2_in permit node 10 //Define the first node of for_isp2_in and set the PrefVal value of the route 10.22.0.0/16 to 120. if-match ip-prefix for_isp2 apply preferred-value 120 # route-policy for_isp2_in permit node 20 //Define the second node of for_isp2_in and allow for_isp2_in to permit all routes. # ip ip-prefix for_isp1 index 10 permit 10.11.0.0 16 //Configure an IP prefix list to match the route 10.11.0.0/16. ip ip-prefix for_isp2 index 10 permit 10.22.0.0 16 //Configure an IP prefix list to match the route 10.22.0.0/16. #
Run the display bgp routing-table [ ip-address ] command to check the configurations.
# Display the routing table of Device A
[~DeviceA] display bgp routing-table
BGP Local router ID is 10.1.2.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 4 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.11.0.0/16 10.1.2.2 80 300 100? * 10.1.3.2 0 200? *> 10.22.0.0/16 10.1.3.2 120 200? * 10.1.2.2 0 300 100?
The preceding command output shows that Device A selects the route 10.11.0.0/16 learned from ISP1 and the route 10.22.0.0/16 learned from ISP2.
# Display detailed information about the route 10.22.0.0/16 on Device A.
[~DeviceA] display bgp routing-table 10.22.0.0
BGP local router ID : 10.1.2.1 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.22.0.0/16: From: 10.1.3.2 (10.1.3.2) Route Duration: 00h14m14s Direct Out-interface: GigabitEthernet0/1/1 Original nexthop: 10.1.3.2 Qos information : 0x0 AS-path 200, origin incomplete, pref-val 120, valid, external, best, select, active, pre 255 Advertised to such 2 peers: 10.1.3.2 10.1.2.2 BGP routing table entry information of 10.22.0.0/16: From: 10.1.2.2 (10.1.2.2) Route Duration: 00h07m54s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.2.2 Qos information : 0x0 AS-path 300 100, origin incomplete, pref-val 0, valid, external, pre 255, not preferred for PreVal Not advertised to any peer yet
The preceding command output shows that the BGP routing table of DeviceA contains two routes destined for 10.22.0.0/16. The route with next hop address 10.1.3.2 is selected because its PrefVal (120) is greater than the PrefVal (0) of the route with next hop address 10.1.2.2. The PrefVal value is sufficient enough to determine the optimal route, and therefore, Device A does not compare other route attributes.
The preceding examples show that PrefVal values can be configured as required to control the traffic forwarding path.
BGP prefers the route with the highest Local_Pref during BGP route selection.
The Local_Pref attribute is used to determine the optimal route when traffic leaves an AS. The Local_Pref attribute is available only to IBGP peers and is not advertised to other ASs.
Table 1-707 lists two methods to modify the Local_Pref value.
Method |
Usage Scenario |
---|---|
Run the default local-preference command. |
This method sets a default Local_Pref for the routes that the local device advertises to IBGP peers. |
Configure an import or export policy and run the apply local-preference command to configure an apply clause for the policy. |
This method sets different Local_Pref values for different routes that the local device advertises to IBGP peers. NOTE:
If a route matches both the default local-preference and apply local-preference commands, the apply local-preference command takes effect. |
Figure 1-1789 is used as an example to show how the Local_Pref value is used during BGP route selection. In Figure 1-1789, both ISP1 and ISP2 advertise the routes 10.11.0.0/16 and 10.22.0.0/16 to AS 65001.
Scenario 1: When no Local_Pref value is configured on Device A and Device B, check the BGP routing tables of Device A and Device B.
[~DeviceA] display bgp routing-table
BGP Local router ID is 192.168.2.3 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 6 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.1.1.0/30 0.0.0.0 0 0 i *>i 10.1.2.0/30 10.1.3.2 0 100 0 i *> 10.11.0.0/16 10.1.1.1 0 100 10i * i 10.1.2.1 100 0 200 10i *> 10.22.0.0/16 10.1.1.1 0 100 10i * i 10.1.2.1 100 0 200 10i
The BGP routing table of Device A shows that Device A receives the routes 10.11.0.0/16 and 10.22.0.0/16 from ISP1 and Device B.
[~DeviceA] display bgp routing-table 10.11.0.0
BGP local router ID : 192.168.2.3 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.11.0.0/16: From: 10.1.1.1 (192.168.2.5) Route Duration: 04h41m03s Direct Out-interface: GigabitEthernet0/1/1 Original nexthop: 10.1.1.1 Qos information : 0x0 AS-path 100 10, origin igp, pref-val 0, valid, external, best, select, active, pre 255 Advertised to such 2 peers: 10.1.3.2 10.1.4.2 BGP routing table entry information of 10.11.0.0/16: From: 10.1.3.2 (192.168.2.2) Route Duration: 01h42m40s Relay IP Nexthop: 10.1.3.2 Relay IP Out-Interface: GigabitEthernet0/1/3 Original nexthop: 10.1.2.1 Qos information : 0x0 AS-path 200 10, origin igp, localpref 100, pref-val 0, valid, internal, pre 255, not preferred for peer type Not advertised to any peer yet
The preceding command output shows that the route learned by DeviceA from ISP1 is selected as the optimal route because it is an EBGP route and the route learned from Device B is an IBGP route. Table 1-708 shows the route attribute comparison of the routes learned from ISP1 and Device B.
Route Attribute |
Route Learned from ISP1 |
Route Learned from Device B |
Comparison |
---|---|---|---|
PrefVal |
0 |
0 |
The same. |
Local_Pref |
- |
100 |
The same. NOTE:
If a route does not carry Local_Pref, the default value 100 takes effect. |
Route type |
Learned from a peer |
Learned from a peer |
The same. |
AIGP |
- |
- |
The same. |
AS_Path |
100 10 |
200 10 |
The same length. |
Origin |
IGP |
IGP |
The same. |
MED |
- |
- |
The same. |
Peer type |
EBGP |
IBGP |
The route learned from ISP1 is optimal. |
The route selection process on Device B is the same as that on Device A. Then, Device A and Device B advertise the optimal routes to Device C. Check the routing table of Device C.
[~DeviceC] display bgp routing-table
Total Number of Routes: 6 BGP Local router ID is 192.168.2.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Network NextHop MED LocPrf PrefVal Path/Ogn *>i 10.1.1.0/30 10.1.4.1 0 100 0 i *>i 10.1.2.0/30 10.1.5.1 0 100 0 i *>i 10.11.0.0/16 10.1.2.1 100 0 200 10i * i 10.1.1.1 100 0 100 10i *>i 10.22.0.0/16 10.1.2.1 100 0 200 10i * i 10.1.1.1 100 0 100 10i
The preceding command output shows that Device C selects the routes advertised by Device B.
Check the reason why the routes learned from Device A are not selected on Device C. The route 10.11.0.0/16 is used as an example.
[~DeviceC] display bgp routing-table 10.11.0.0
BGP local router ID : 192.168.2.1 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.11.0.0/16: From: 10.1.5.1 (192.168.2.2) Route Duration: 00h12m46s Relay IP Nexthop: 10.1.5.1 Relay IP Out-Interface: GigabitEthernet0/1/1 Original nexthop: 10.1.2.1 Qos information : 0x0 AS-path 200 10, origin igp, localpref 100, pref-val 0, valid, internal, best, select, active, pre 255 Not advertised to any peer yet BGP routing table entry information of 10.11.0.0/16: From: 10.1.4.1 (192.168.2.3) Route Duration: 00h17m30s Relay IP Nexthop: 10.1.4.1 Relay IP Out-Interface: GigabitEthernet0/1/0 Original nexthop: 10.1.1.1 Qos information : 0x0 AS-path 100 10, origin igp, localpref 100, pref-val 0, valid, internal, pre 255, not preferred for router ID Not advertised to any peer yet
The preceding command output shows that Device C selects the route learned from Device B because the router ID (192.168.2.2) of Device B is smaller than that (192.168.2.3) of Device A. Table 1-709 shows the route attribute comparison of the routes learned from Device A and Device B.
Route Attribute |
Route Learned from Device A |
Route Learned from Device B |
Comparison |
---|---|---|---|
PrefVal |
0 |
0 |
The same. |
Local_Pref |
100 |
100 |
The same. |
Route type |
Learned from a peer |
Learned from a peer |
The same. |
AIGP |
- |
- |
The same. |
AS_Path |
100 10 |
200 10 |
The same length. |
Origin |
IGP |
IGP |
The same. |
MED |
- |
- |
The same. |
Peer type |
IBGP |
IBGP |
The same. |
IGP cost |
- |
- |
The same. |
Cluster_List |
- |
- |
The same length. |
Router ID |
192.168.2.3 |
192.168.2.2 |
The route learned from Device B is optimal. |
Scenario 2: The administrator of AS 65001 requires that ISP1 be active and ISP2 be backup for the traffic to 10.11.0.0/16 and 10.22.0.0/16.
To meet the preceding requirements, run the default local-preference command on DeviceA to increase the Local_Pref values of the routes advertised by DeviceA. This configuration ensures that the routes learned from ISP1 are selected by BGP devices in AS 65001 as the optimal routes to 10.11.0.0/16 and 10.22.0.0/16. Detailed configurations are as follows:
# bgp 65001 # ipv4-family unicast default local-preference 120 //Set the Local_Pref of the routes to be advertised to 120. #
Run the display bgp routing-table [ ip-address ] command to check the configurations.
# Display the routing table of Device A.
[~DeviceA] display bgp routing-table
BGP Local router ID is 192.168.2.3 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 4 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.1.1.0/30 0.0.0.0 0 0 i *>i 10.1.2.0/30 10.1.3.2 0 100 0 i *> 10.11.0.0/16 10.1.1.1 0 100 10i *> 10.22.0.0/16 10.1.1.1 0 100 10i
The preceding command output shows that Device A selects the routes learned from ISP1.
# Display the routing table of Device B.
[~DeviceB] display bgp routing-table
BGP Local router ID is 192.168.2.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 6 Network NextHop MED LocPrf PrefVal Path/Ogn *>i 10.1.1.0/30 10.1.3.1 0 120 0 i *> 10.1.2.0/30 0.0.0.0 0 0 i *>i 10.11.0.0/16 10.1.1.1 120 0 100 10i * 10.1.2.1 0 200 10i *>i 10.22.0.0/16 10.1.1.1 120 0 100 10i * 10.1.2.1 0 200 10i
The preceding command output shows that Device B selects the routes learned from Device A. Device B does not advertise the routes learned from ISP2 to its IBGP peers because those routes are not selected.
# Display detailed information about the route 10.11.0.0/16 or 10.22.0.0/16 on Device B. The route 10.11.0.0/16 is used as an example.
[~DeviceB] display bgp routing-table 10.11.0.0
BGP local router ID : 192.168.2.2 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.11.0.0/16: From: 10.1.3.1 (192.168.2.3) Route Duration: 00h22m16s Relay IP Nexthop: 10.1.3.1 Relay IP Out-Interface: GigabitEthernet0/1/4 Original nexthop: 10.1.1.1 Qos information : 0x0 AS-path 100 10, origin igp, localpref 120, pref-val 0, valid, internal, best, select, active, pre 255 Advertised to such 1 peers: 10.1.2.1 BGP routing table entry information of 10.11.0.0/16: From: 10.1.2.1 (192.168.2.4) Route Duration: 00h22m23s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.2.1 Qos information : 0x0 AS-path 200 10, origin igp, pref-val 0, valid, external, pre 255, not preferred for Local_Pref Not advertised to any peer yet
The preceding command output shows that the Local_Pref value of the route learned from Device A is greater than that of the route learned from ISP2 and that the route learned from Device A is selected as the optimal route. Table 1-710 shows the route attribute comparison of the routes learned from Device A and ISP2.
Route Attribute |
Route Learned from Device A |
Route Learned from ISP2 |
Comparison |
---|---|---|---|
PrefVal |
0 |
0 |
The same. |
Local_Pref |
120 |
- |
The route learned from Device A is optimal. NOTE:
If a route does not carry Local_Pref, the default value 100 takes effect. |
# Display the routing table of Device C.
[~DeviceC] display bgp routing-table
Total Number of Routes: 4 BGP Local router ID is 192.168.2.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Network NextHop MED LocPrf PrefVal Path/Ogn *>i 10.1.1.0/30 10.1.4.1 0 120 0 i *>i 10.1.2.0/30 10.1.5.1 0 100 0 i *>i 10.11.0.0/16 10.1.1.1 120 0 100 10i *>i 10.22.0.0/16 10.1.1.1 120 0 100 10i
Device C selects the routes advertised by ISP1 because Device B did not advertise the routes learned from ISP2 to Device C.
Scenario 3: The requirements of the administrator of AS 65001 are as follows:
- ISP1 is active and ISP2 is backup for the traffic to 10.11.0.0/16.
- ISP2 is active and ISP1 is backup for the traffic to 10.22.0.0/16.
To meet the preceding requirements, ensure that AS 65001 selects the route 10.11.0.0/16 learned from Device A and the route 10.22.0.0/16 learned from Device B. Detailed configurations are as follows (with Figure 1-1790 as the networking):
Configurations on Device A
# bgp 65001 # ipv4-family unicast peer 10.1.1.1 route-policy rp1 import //Apply import policy named rp1 to the routes learned from 10.1.1.1 and use rp1 to modify the Local_Pref. # route-policy rp1 permit node 10 //Define the first node of rp1 and set the Local_Pref value of the route 10.11.0.0/16 to 80. if-match ip-prefix reducepref apply local-preference 80 # route-policy rp1 permit node 20 //Define the second node of rp1 and set the Local_Pref value of the route 10.22.0.0/16 to 120. if-match ip-prefix addpref apply local-preference 120 # route-policy rp1 permit node 30 //Define the third node of rp1 and allow rp1 to permit all routes. # ip ip-prefix addpref index 10 permit 10.11.0.0 16 //Configure an IP prefix list to match the route 10.11.0.0/16. ip ip-prefix reducepref index 10 permit 10.22.0.0 16 //Configure an IP prefix list to match the route 10.22.0.0/16. #
Configurations on Device B
bgp 65001 # ipv4-family unicast peer 10.1.2.1 route-policy rp2 import //Apply import policy named rp2 to the routes learned from 10.1.1.1 and use rp2 to modify the Local_Pref. # route-policy rp2 permit node 10 //Define the first node of rp2 and set the Local_Pref value of the route 10.22.0.0/16 to 200. if-match ip-prefix addpref apply local-preference 200 # route-policy rp2 permit node 20 //Define the second node of rp2 and set the Local_Pref value of the route 10.11.0.0/16 to 60. if-match ip-prefix reducepref apply local-preference 60 # route-policy rp2 permit node 30 //Define the third node of rp2 and allow rp2 to permit all routes. # ip ip-prefix addpref index 10 permit 10.22.0.0 16 //Configure an IP prefix list to match the route 10.22.0.0/16. ip ip-prefix reducepref index 10 permit 10.11.0.0 16 //Configure an IP prefix list to match the route 10.11.0.0/16. #
Run the display bgp routing-table [ ip-address ] command to check the configurations.
# Display the routing table of Device A.
[~DeviceA] display bgp routing-table
BGP Local router ID is 192.168.2.3 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 5 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.1.1.0/30 0.0.0.0 0 0 i *>i 10.1.2.0/30 10.1.3.2 0 100 0 i *> 10.11.0.0/16 10.1.1.1 120 0 100 10i *>i 10.22.0.0/16 10.1.2.1 200 0 200 10i * 10.1.1.1 80 0 100 10i
# Display detailed information about the route 10.22.0.0/16 on Device A.
[~DeviceA] display bgp routing-table 10.22.0.0
BGP local router ID : 192.168.2.3 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.22.0.0/16: From: 10.1.3.2 (192.168.2.2) Route Duration: 00h20m12s Relay IP Nexthop: 10.1.3.2 Relay IP Out-Interface: GigabitEthernet0/1/3 Original nexthop: 10.1.2.1 Qos information : 0x0 AS-path 200 10, origin igp, localpref 200, pref-val 0, valid, internal, best, select, active, pre 255 Advertised to such 1 peers: 10.1.1.1 BGP routing table entry information of 10.22.0.0/16: From: 10.1.1.1 (192.168.2.5) Route Duration: 00h19m40s Direct Out-interface: GigabitEthernet0/1/1 Original nexthop: 10.1.1.1 Qos information : 0x0 AS-path 100 10, origin igp, localpref 80, pref-val 0, valid, external, pre 255, not preferred for Local_Pref Not advertised to any peer yet
The preceding command output shows that two routes 10.22.0.0/16 are available in the BGP routing table of Device A and that the route with next hop address 10.1.2.1 is selected because its Local_Pref (200) is greater than the Local_Pref (80) of the route with next hop address 10.1.1.1.
Table 1-711 shows the route attribute comparison of the routes learned from ISP1 and Device B.
Route Attribute |
Route Learned from ISP1 |
Route Learned from Device B |
Comparison |
---|---|---|---|
PrefVal |
0 |
0 |
The same. |
Local_Pref |
200 |
80 |
The route learned from ISP1 is optimal. |
The route with next hop address 10.1.1.1 is not optimal, and therefore, it is not advertised to Device B and Device C. In addition, the BGP routing table of Device A has only one route to the destination address 10.11.0.0/16, and the next hop is 10.1.1.1. This is because the route 10.11.0.0/16 with the next hop being 10.1.2.1 on DeviceB is not the optimal route, and DeviceB does not advertise this route to DeviceA or DeviceC.
# Display the routing table of Device B.
[~DeviceB] display bgp routing-table
BGP Local router ID is 192.168.2.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 5 Network NextHop MED LocPrf PrefVal Path/Ogn *>i 10.1.1.0/30 10.1.3.1 0 100 0 i *> 10.1.2.0/30 0.0.0.0 0 0 i *>i 10.11.0.0/16 10.1.1.1 120 0 100 10i * 10.1.2.1 60 0 200 10i *> 10.22.0.0/16 10.1.2.1 200 0 200 10i
# Display detailed information about the route 10.11.0.0/16 on Device B.
[~DeviceB] display bgp routing-table 10.11.0.0
BGP local router ID : 192.168.2.2 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.11.0.0/16: From: 10.1.3.1 (192.168.2.3) Route Duration: 00h40m28s Relay IP Nexthop: 10.1.3.1 Relay IP Out-Interface: GigabitEthernet0/1/4 Original nexthop: 10.1.1.1 Qos information : 0x0 AS-path 100 10, origin igp, localpref 120, pref-val 0, valid, internal, best, select, active, pre 255 Advertised to such 1 peers: 10.1.2.1 BGP routing table entry information of 10.11.0.0/16: From: 10.1.2.1 (192.168.2.4) Route Duration: 00h41m00s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.2.1 Qos information : 0x0 AS-path 200 10, origin igp, localpref 60, pref-val 0, valid, external, pre 255, not preferred for Local_Pref Not advertised to any peer yet
The preceding command output shows that two routes 10.11.0.0/16 are available in the BGP routing table of Device B and that the route with next hop address 10.1.1.1 is selected because its Local_Pref (120) is greater than the Local_Pref (60) of the route with next hop address 10.1.2.1. The route with next hop address 10.1.2.1 is not advertised to Device A or Device C because it is not optimal.
# Display the routing table of Device C.
[~DeviceC] display bgp routing-table
Total Number of Routes: 4 BGP Local router ID is 192.168.2.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Network NextHop MED LocPrf PrefVal Path/Ogn *>i 10.1.1.0/30 10.1.4.1 0 100 0 i *>i 10.1.2.0/30 10.1.5.1 0 100 0 i *>i 10.11.0.0/16 10.1.1.1 120 0 100 10i *>i 10.22.0.0/16 10.1.2.1 200 0 200 10i
The preceding command output shows that the next hop address of the route 10.11.0.0/16 is 10.1.1.1 and that the next hop address of the route 10.22.0.0/16 is 10.1.2.1.
- ISP1 is active and ISP2 is backup for the traffic from Device A and Device C to 10.11.0.0/16 and 10.22.0.0/16.
- ISP2 is active and ISP1 is backup for the traffic from Device B to 10.11.0.0/16 and 10.22.0.0/16.
To meet the preceding requirements, ensure that Device A and Device C select the routes learned from ISP1 as the optimal routes to 10.11.0.0/16 and 10.22.0.0/16. Detailed configurations are as follows (with Figure 1-1791 as the networking):
- Configure an export policy on Device A to modify the Local_Pref of the routes to be advertised to Device C.
- Configure an import policy on Device C to modify the Local_Pref of the routes learned from Device A.
bgp 65001 # ipv4-family unicast peer 10.1.2.1 route-policy rp2 export //Apply the export policy rp2 to the routes from the peer 10.1.1.1 and modify the Local_Pref of the routes through rp2. # route-policy rp2 permit node 10 if-match ip-prefix addpref apply local-preference 120
Run the display bgp routing-table [ ip-address ] command to check the configurations.
# Display the routing table of Device A.
[~DeviceA] display bgp routing-table
BGP Local router ID is 192.168.2.3 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 6 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.1.1.0/30 0.0.0.0 0 0 i *>i 10.1.2.0/30 10.1.3.2 0 100 0 i *> 10.11.0.0/16 10.1.1.1 0 100 10i * i 10.1.2.1 100 0 200 10i *> 10.22.0.0/16 10.1.1.1 0 100 10i * i 10.1.2.1 100 0 200 10i
The preceding command output shows that Device A selects the routes learned from ISP1.
# Display the routing table of Device B.
[~DeviceB] display bgp routing-table
BGP Local router ID is 192.168.2.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 6 Network NextHop MED LocPrf PrefVal Path/Ogn *>i 10.1.1.0/30 10.1.3.1 0 100 0 i *> 10.1.2.0/30 0.0.0.0 0 0 i *> 10.11.0.0/16 10.1.2.1 0 200 10i * i 10.1.1.1 100 0 100 10i *> 10.22.0.0/16 10.1.2.1 0 200 10i * i 10.1.1.1 100 0 100 10i
The preceding command output shows that Device B selects the routes learned from ISP2.
# Display the routing table of Device C.
[~DeviceC] display bgp routing-table
Total Number of Routes: 6 BGP Local router ID is 192.168.2.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Network NextHop MED LocPrf PrefVal Path/Ogn *>i 10.1.1.0/30 10.1.4.1 0 120 0 i *>i 10.1.2.0/30 10.1.5.1 0 100 0 i *>i 10.11.0.0/16 10.1.1.1 120 0 100 10i * i 10.1.2.1 100 0 200 10i *>i 10.22.0.0/16 10.1.1.1 120 0 100 10i * i 10.1.2.1 100 0 200 10i
The preceding command output shows that Device C selects the routes learned from ISP1.
# Display detailed information about the route 10.11.0.0/16 or 10.22.0.0/16 on Device C. The route 10.11.0.0/16 is used as an example.
[~DeviceC] display bgp routing-table 10.11.0.0
BGP local router ID : 192.168.2.1 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.11.0.0/16: From: 10.1.4.1 (192.168.2.3) Route Duration: 00h06m26s Relay IP Nexthop: 10.1.4.1 Relay IP Out-Interface: GigabitEthernet0/1/0 Original nexthop: 10.1.1.1 Qos information : 0x0 AS-path 100 10, origin igp, localpref 120, pref-val 0, valid, internal, best, select, active, pre 255 Not advertised to any peer yet BGP routing table entry information of 10.11.0.0/16: From: 10.1.5.1 (192.168.2.2) Route Duration: 00h08m05s Relay IP Nexthop: 10.1.5.1 Relay IP Out-Interface: GigabitEthernet0/1/1 Original nexthop: 10.1.2.1 Qos information : 0x0 AS-path 200 10, origin igp, localpref 100, pref-val 0, valid, internal, pre 255, not preferred for Local_Pref Not advertised to any peer yet
The preceding command output shows that Device C selects the routes learned from ISP1 because the Local_Pref of the routes learned from ISP1 is greater than that of the route learned from ISP2.
The preceding examples show that the modification of the Local_Pref values affects not only BGP route advertisement but also BGP route selection with an AS. We can configure Local_Pref values as required to control the forwarding path of the traffic that leaves an AS.
BGP prefers locally imported routes to the routes learned from peers during BGP route selection.
BGP routes can be locally imported or learned from peers. The locally imported routes take precedence over the routes learned from peers during BGP route selection. It is unusual for locally imported routes and the routes learned from peers to carry the same destination IP address and coexist in the routing table. Generally, locally imported routes can be the routes imported using the network or import-route command and the automatically and manually summary routes. Precedences of these routes are described as follows:
Summary routes take precedence over non-summary routes.
Summary routes that are manually generated using the aggregate command take precedence over summary routes that are automatically generated based on the summary automatic command settings.
The routes imported using the network command take precedence over the routes imported using the import-route command.
In Figure 1-1792, Device A and Device B are EBGP peers, and Device B, Device C, and Device D are IBGP peers.
The configurations on Device C are as follows:
# bgp 65001 # ipv4-family unicast network 10.1.2.0 255.255.255.252 //Advertise the route 10.1.2.0/30. network 10.1.4.0 255.255.255.252 //Advertise the route 10.1.4.0/30. import-route direct //Import direct routes. #
The configurations on Device D are as follows:
# bgp 65001 # ipv4-family unicast network 10.1.3.0 255.255.255.252 //Advertise the route 10.1.3.0/30. network 10.1.4.0 255.255.255.252 //Advertise the route 10.1.4.0/30. import-route direct //Import direct routes. #
Run the display bgp routing-table [ ip-address ] command to check the configurations.
# Display the routing table of Device D.
[~DeviceD] display bgp routing-table
BGP Local router ID is 10.1.3.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 10 Network NextHop MED LocPrf PrefVal Path/Ogn *>i 10.1.2.0/30 10.1.4.2 0 100 0 i *> 10.1.3.0/30 0.0.0.0 0 0 i * 0.0.0.0 0 0 ? *> 10.1.3.2/32 0.0.0.0 0 0 ? *> 10.1.4.0/30 0.0.0.0 0 0 i * 0.0.0.0 0 0 ? i 10.1.4.2 0 100 0 ? *> 10.1.4.1/32 0.0.0.0 0 0 ? *> 127.0.0.0 0.0.0.0 0 0 ? *> 127.0.0.1/32 0.0.0.0 0 0 ?
The preceding command output shows that three routes 10.1.4.0/30 are available in the routing table. The route with the next hop address 10.1.4.2 is learned from a peer (Device C). Therefore, BGP first excludes this route from route selection.
[~DeviceD] display bgp routing-table 10.1.4.0 30
BGP local router ID : 10.1.3.2 Local AS number : 65001 Paths: 3 available, 1 best, 1 select BGP routing table entry information of 10.1.4.0/30: Network route. From: 0.0.0.0 (0.0.0.0) Route Duration: 00h03m51s Direct Out-interface: GigabitEthernet0/1/4 Original nexthop: 10.1.4.1 Qos information : 0x0 AS-path Nil, origin igp, MED 0, pref-val 0, valid, local, best, select, pre 0 Advertised to such 2 peers: 10.1.3.1 10.1.4.2 BGP routing table entry information of 10.1.4.0/30: Imported route. From: 0.0.0.0 (0.0.0.0) Route Duration: 00h04m10s Direct Out-interface: GigabitEthernet0/1/4 Original nexthop: 10.1.4.1 Qos information : 0x0 AS-path Nil, origin incomplete, MED 0, pref-val 0, valid, local, pre 0, not preferred for route type Not advertised to any peer yet BGP routing table entry information of 10.1.4.0/30: From: 10.1.4.2 (10.1.2.2) Route Duration: 00h02m24s Relay IP Nexthop: 0.0.0.0 Relay IP Out-Interface: GigabitEthernet0/1/4 Original nexthop: 10.1.4.2 Qos information : 0x0 AS-path Nil, origin incomplete, MED 0, localpref 100, pref-val 0, internal, pre 255 Not advertised to any peer yet
The preceding command output shows that the route imported using the network command is selected as the optimal route.
The configurations on Device B are as follows:
bgp 65001 # ipv4-family unicast summary automatic aggregate 10.0.0.0 255.0.0.0 import-route direct #
Run the display bgp routing-table [ ip-address ] command to check the configurations.
# Display the routing table of Device B.
[~DeviceB] display bgp routing-table
BGP Local router ID is 10.1.1.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 14 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.0.0.0 127.0.0.1 0 ? * 127.0.0.1 0 ? s> 10.1.1.0/30 0.0.0.0 0 0 ? *> 10.1.1.2/32 0.0.0.0 0 0 ? s> 10.1.2.0/30 0.0.0.0 0 0 ? i 10.1.2.2 0 100 0 i *> 10.1.2.1/32 0.0.0.0 0 0 ? s> 10.1.3.0/30 0.0.0.0 0 0 ? i 10.1.3.2 0 100 0 i *> 10.1.3.1/32 0.0.0.0 0 0 ? *>i 10.1.4.0/30 10.1.3.2 0 100 0 i * i 10.1.2.2 0 100 0 ? *> 127.0.0.0 0.0.0.0 0 0 ? *> 127.0.0.1/32 0.0.0.0 0 0 ?
The preceding command output shows that two summary routes 10.0.0.0 are available in the routing table.
[~DeviceB] display bgp routing-table 10.0.0.0
BGP local router ID : 10.1.1.2 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.0.0.0/8: Aggregated route. Route Duration: 00h17m04s Direct Out-interface: NULL0 Original nexthop: 127.0.0.1 Qos information : 0x0 AS-path Nil, origin incomplete, pref-val 0, valid, local, best, select, active, pre 255 Aggregator: AS 65001, Aggregator ID 10.1.1.2 Advertised to such 3 peers: 10.1.1.1 10.1.3.2 10.1.2.2 BGP routing table entry information of 10.0.0.0/8: Summary automatic route Route Duration: 00h17m04s Direct Out-interface: NULL0 Original nexthop: 127.0.0.1 Qos information : 0x0 AS-path Nil, origin incomplete, pref-val 0, valid, local, pre 255, not preferred for route type Aggregator: AS 65001, Aggregator ID 10.1.1.2 Not advertised to any peer yet
The preceding command output shows that the route generated using the aggregate command is selected as the optimal route.
BGP prefers the route with the smallest AIGP value during BGP route selection.
The Accumulated Interior Gateway Protocol Metric (AIGP) attribute is an optional non-transitive Border Gateway Protocol (BGP) path attribute. After the AIGP attribute is configured in an AIGP administrative domain, BGP selects paths based on costs in the same manner as an IGP, and all devices in the domain forward data along the optimal routes. During BGP route selection, the AIGP attribute is used as follows:
The priority of a route that carries the AIGP attribute is higher than the priority of a route that does not carry the AIGP attribute.
If routes carry the AIGP attribute, the device selects the route whose AIGP value plus the cost of the IGP route to which the route recurses is smaller.
The AIGP attribute can be added to routes only through route-policies. You can configure an apply clause for a route-policy using the apply aigp { [ + | - ] cost | inherit-cost } command to modify the AIGP value during route import, acceptance, or advertisement. If no AIGP value is configured, the IGP routes imported by BGP do not carry the AIGP attribute.
Run the display bgp routing-table [ ip-address ] command on Device E to check the configurations. The route 10.1.4.0/30 is used in this example.
# Display the routing table of Device E.
[~DeviceE] display bgp routing-table
BGP Local router ID is 10.1.1.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 6 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.1.2.0/30 10.1.1.2 0 0 65002? * 10.1.3.2 3 0 65002? *> 10.1.4.0/30 10.1.1.2 2 0 65002? * 10.1.3.2 2 0 65002? *> 10.1.5.0/30 10.1.3.2 0 0 65002? * 10.1.1.2 3 0 65002?
[~DeviceE] display bgp routing-table 10.1.4.0
BGP local router ID : 10.1.1.1 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.1.4.0/30: From: 10.1.1.2 (10.1.1.2) Route Duration: 00h02m29s Direct Out-interface: GigabitEthernet0/1/1 Original nexthop: 10.1.1.2 Qos information : 0x0 AS-path 65002, origin incomplete, MED 2, pref-val 0, valid, external, best, select, active, pre 255 Advertised to such 2 peers: 10.1.1.2 10.1.3.2 BGP routing table entry information of 10.1.4.0/30: From: 10.1.3.2 (10.1.5.1) Route Duration: 00h03m58s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.3.2 Qos information : 0x0 AS-path 65002, origin incomplete, MED 2, pref-val 0, valid, external, pre 255, not preferred for router ID Not advertised to any peer yet
The command output when the AIGP attribute is not configured shows that Device E selects the route learned from Device A after comparing router IDs. To change the route selection result on Device E, you can configure the AIGP attribute.
Configurations on Device A:
# bgp 65002 # ipv4-family unicast import-route ospf 1 route-policy aigp_policy //Apply route-policy named aigp_policy to locally imported OSPF routes and use aigp_policy to modify the AIGP value. peer 10.1.1.1 aigp //Enable AIGP on the local device and the peer 10.1.1.1. # route-policy aigp_policy permit node 10 //Define the first node of aigp_policy and set the AIGP value of the route 10.1.4.0/30 to 10. if-match ip-prefix prefix1 apply aigp 10 # route-policy aigp_policy permit node 20 //Define the second node of aigp_policy and allow aigp_policy to permit all routes. # ip ip-prefix prefix1 index 10 permit 10.1.4.0 30 //Configure IP prefix list named prefix1 to match the route 10.1.4.0/30. #
Configurations on Device B:
bgp 65002 peer 10.1.3.1 as-number 65001 # ipv4-family unicast import-route ospf 1 route-policy aigp_policy1 //Apply route-policy named aigp_policy1 to locally imported OSPF routes and use aigp_policy1 to modify the AIGP value. peer 10.1.3.1 aigp //Enable AIGP on the local device and the peer 10.1.3.1. # route-policy aigp_policy1 permit node 10 //Define the first node of aigp_policy1 and set the AIGP value of the route 10.1.4.0/30 to 5. if-match ip-prefix prefix2 apply aigp 5 # route-policy aigp_policy1 permit node 20 //Define the second node of aigp_policy1 and allow aigp_policy1 to permit all routes. # ip ip-prefix prefix2 index 10 permit 10.1.4.0 30 //Configure IP prefix list named prefix2 to match the route 10.1.4.0/30. #
Configurations on Device E:
# bgp 65001 # ipv4-family unicast peer 10.1.1.2 aigp //Enable AIGP on the local device and the peer 10.1.1.2. peer 10.1.3.2 aigp //Enable AIGP on the local device and the peer 10.1.3.2. #
Run the display bgp routing-table [ ip-address ] command on Device E to check the configurations.
# Display the routing table of Device E.
[~DeviceE] display bgp routing-table
BGP Local router ID is 10.1.1.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 6 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.1.2.0/30 10.1.1.2 0 0 65002? * 10.1.3.2 3 0 65002? *> 10.1.4.0/30 10.1.3.2 2 0 65002? * 10.1.1.2 2 0 65002? *> 10.1.5.0/30 10.1.3.2 0 0 65002? * 10.1.1.2 3 0 65002?
[~DeviceE] display bgp routing-table 10.1.4.0
BGP local router ID : 10.1.1.1 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.1.4.0/30: From: 10.1.3.2 (10.1.5.1) Route Duration: 00h00m14s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.3.2 Qos information : 0x0 AS-path 65002, origin incomplete, MED 2, pref-val 0, valid, external, best, select, active, pre 255, AIGP 5 Advertised to such 2 peers: 10.1.1.2 10.1.3.2 BGP routing table entry information of 10.1.4.0/30: From: 10.1.1.2 (10.1.1.2) Route Duration: 01h01m15s Direct Out-interface: GigabitEthernet0/1/1 Original nexthop: 10.1.1.2 Qos information : 0x0 AS-path 65002, origin incomplete, MED 2, pref-val 0, valid, external, pre 255, AIGP 10, not preferred for AIGP Not advertised to any peer yet
The preceding command output shows that Device E selects the route 10.1.4.0/30 learned from Device B because its AIGP value is smaller.
BGP prefers the route with the shortest AS_Path length (the number of included ASs) during BGP route selection.
Four types of AS_Path attributes are available: AS_Sequence, AS_Set, AS_Confed_Sequence, and AS_Confed_Set.
AS_Sequence: records in reverse order all the ASs through which a route passes from the local device to the destination.
AS_Set: records in random order all the ASs through which a route passes from the local device to the destination. The AS_Set attribute is used in route summarization scenarios.
AS_Confed_Sequence: records in reverse order all the sub-ASs within a BGP confederation through which a route passes from the local device to the destination.
AS_Confed_Set: records in random order all the sub-ASs within a BGP confederation through which a route passes from the local device to the destination.
Item |
Description |
---|---|
AS_Set |
BGP takes an AS_Set as one AS number even if the AS_Set contains multiple AS numbers. When the aggregate (BGP) command is run to manually generate a summary route, if as-set is specified in the command, an AS_Set will be carried in the summary route. Otherwise, no AS_Set will be carried. The information in the AS_Set is as follows:
|
AS_Confed_Sequence and AS_Confed_Set |
BGP ignores AS_Confed_Sequence and AS_Confed_Set when calculating the AS_Path length. |
bestroute as-path-ignore |
After the command is run, BGP does not compare the AS_Path lists carried in candidate routes during route selection. |
apply as-path |
The command can be run to configure an apply clause for a route-policy so that the ASs in the AS_Path of the route that matches the route-policy are cleared or replaced, or new ASs are added. NOTE:
The configuration of the apply as-path command may change the traffic forwarding path, or cause routing loops or route selection errors. Therefore, exercise caution when configuring the command. |
peer public-as-only |
After the command is run, BGP removes all the private AS numbers (if any) from the AS_Path attribute in each Update message to be sent. The private AS number ranges from 64512 to 65534 and from 4200000000 to 4294967294 (or from 64086.59904 to 65535.65534). |
peer public-as-only import |
After the command is run, BGP removes all the private AS numbers (if any) from the AS_Path attribute in each received Update message. The private AS number ranges from 64512 to 65534 and from 4200000000 to 4294967294 (or from 64086.59904 to 65535.65534). |
peer fake-as |
After the command is run, BGP can use a fake AS number to set up a BGP peer relationship. If the local device uses the actual AS number to establish an EBGP peer relationship with a remote device, the actual AS number is carried in the AS_Path of the route sent to the remote device. If the local device uses the fake AS number to establish the EBGP peer relationship, the fake AS number is carried in the AS_Path of the route sent to the remote device. |
peer substitute-as |
After the command is run, if the AS_Path attribute in the route that a PE will send to its connected CE through a BGP peer relationship contains an AS number the same as that of the CE, the PE replaces the AS number in the AS_Path attribute with its local AS number before advertising this route.
NOTE:
The peer substitute-as command applies only to PEs in BGP MPLS IP/VPN scenarios and may cause routing loops if it is improperly configured. Therefore, exercise caution when using the command. |
During BGP route selection, BGP compares the AS_Path length by calculating the number of ASs included in the AS_Sequence if AS_Sequence is carried in a route. If both AS_Sequence and AS_Set are carried in the route, BGP considers the AS_Path length to be the number of ASs included in the AS_Sequence plus 1. The following describes some common commands in detail by using examples.
Deleting Private AS Numbers
In Figure 1-1794, DeviceA advertises the route 10.0.0.0/8 to DeviceD through ISP1 and ISP2. After receiving this route, DeviceD checks its AS_Path attribute. This AS_Path attribute carries AS 65001, which is the same as the AS number of DeviceD. As a result, DeviceD discards this route.
To address this problem, run the peer public-as-only command on DeviceB so that DeviceB in ISP1 deletes AS 65001 before adding AS 100 (public AS) to the AS_Path attribute and forwarding the route to DeviceC in ISP2.
The AS_Path of a route carries the AS number of the remote peer. In this case, deleting private AS numbers may lead to a routing loop.
The AS_Path carries both public and private AS numbers, which indicates that the route has passed through the public network. In this case, deleting private AS numbers may lead to incorrect traffic forwarding.
Adding AS Numbers
Run the display bgp routing-table [ ip-address ] command to verify the configuration.
# Display the routing table of DeviceA.
[~DeviceA] display bgp routing-table
BGP Local router ID is 10.1.1.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 6 Network NextHop MED LocPrf PrefVal Path/Ogn *> 172.16.1.0/24 10.1.3.2 0 65003 65005? * 10.1.1.2 0 65002 65004 65005? *> 172.16.2.0/24 10.1.3.2 0 65003 65005? * 10.1.1.2 0 65002 65004 65005? *> 172.16.3.0/24 10.1.3.2 0 65003 65005? * 10.1.1.2 0 65002 65004 65005?
[~DeviceA] display bgp routing-table 172.16.1.0
BGP local router ID : 10.1.1.1 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 172.16.1.0/24: From: 10.1.3.2 (10.1.5.1) Route Duration: 00h00m56s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.3.2 Qos information : 0x0 AS-path 65003 65005, origin incomplete, pref-val 0, valid, external, best, select, active, pre 255 Advertised to such 2 peers: 10.1.3.2 10.1.1.2 BGP routing table entry information of 172.16.1.0/24: From: 10.1.1.2 (10.1.1.2) Route Duration: 00h34m43s Direct Out-interface: GigabitEthernet0/2/0 Original nexthop: 10.1.1.2 Qos information : 0x0 AS-path 65002 65004 65005, origin incomplete, pref-val 0, valid, external, pre 255, not preferred for AS-Path Not advertised to any peer yet
The preceding command output shows that DeviceA selects the route learned from DeviceC because this route has a shorter AS_Path length than that learned from DeviceB. To enable DeviceA to select the route learned from DeviceB, configure DeviceB to reduce the AS_Path length of the route or configure DeviceC to increase the AS_Path length of the route. In the following example, DeviceC is configured to increase the AS_Path length of the route. The detailed configurations on DeviceC are as follows:
# bgp 65003 # ipv4-family unicast undo synchronization peer 10.1.3.1 route-policy add_asn export //Apply export policy named add_asn to the routes to be advertised to BGP peer 10.1.3.1. # route-policy add_asn permit node 10 //Define the first node of add_asn. if-match ip-prefix prefix1 //Configure IP prefix list named prefix1. apply as-path 65003 65003 65003 additive //Add 65003, 65003, 65003 to the AS_Path of the route that matches the IP prefix list prefix1. # route-policy add_asn permit node 20 //Define the second node of add_asn to permit all other routes. # ip ip-prefix prefix1 index 10 permit 172.16.1.0 24 //Define the first index of prefix1 to match the route 172.16.1.0/24. ip ip-prefix prefix1 index 20 permit 172.16.2.0 24 //Define the second index of prefix1 to match the route 172.16.2.0/24. ip ip-prefix prefix1 index 30 permit 172.16.3.0 24 //Define the third index of prefix1 to match the route 172.16.3.0/24. #
Run the display bgp routing-table [ ip-address ] command to verify the configuration.
# Display the routing table of DeviceA.
[~DeviceA] display bgp routing-table
BGP Local router ID is 10.1.1.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 6 Network NextHop MED LocPrf PrefVal Path/Ogn *> 172.16.1.0/24 10.1.1.2 0 65002 65004 65005? * 10.1.3.2 0 65003 65003 65003 65003 65005? *> 172.16.2.0/24 10.1.1.2 0 65002 65004 65005? * 10.1.3.2 0 65003 65003 65003 65003 65005? *> 172.16.3.0/24 10.1.1.2 0 65002 65004 65005? * 10.1.3.2 0 65003 65003 65003 65003 65005?
[~DeviceA] display bgp routing-table 172.16.1.0
BGP local router ID : 10.1.1.1 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 172.16.1.0/24: From: 10.1.1.2 (10.1.1.2) Route Duration: 00h33m30s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.1.2 Qos information : 0x0 AS-path 65002 65004 65005, origin incomplete, pref-val 0, valid, external, best, select, active, pre 255 Advertised to such 2 peers: 10.1.3.2 10.1.1.2 BGP routing table entry information of 172.16.1.0/24: From: 10.1.3.2 (10.1.5.1) Route Duration: 00h02m12s Direct Out-interface: GigabitEthernet0/2/0 Original nexthop: 10.1.3.2 Qos information : 0x0 AS-path 65003 65003 65003 65003 65005, origin incomplete, pref-val 0, valid, external, pre 255, not preferred for AS-Path Not advertised to any peer yet
Route Attribute |
Route Learned from DeviceB |
Route Learned from DeviceC |
Comparison |
---|---|---|---|
PrefVal |
0 |
0 |
The same. |
Local_Pref |
- |
- |
The same. |
Route type |
Learned from a peer |
Learned from a peer |
The same. |
AIGP |
- |
- |
The same. |
AS_Path |
65002 65004 65005 |
65003 65003 65003 65003 65005 |
The route learned from DeviceB is optimal. |
AS numbers can be added to the AS_Path as required. However, if an AS number is added to the AS_Path of a route, the route cannot be received by devices in this AS. Therefore, the local AS number is added in most cases. For example in Figure 1-1795, if DeviceC adds AS 65001 to the AS_Path of a route before advertising the route to DeviceA, DeviceA will discard the route upon receipt because the route carries DeviceA's AS number.
Replacing AS Numbers
Shield the actual path information.
Prevent a route from being discarded by replacing the AS_Path attribute of the route with a shorter one if the as-path-limit command is run on the device that receives this route.
Reduce the AS_Path length.
AS number replacement can also be used for the purpose of load balancing. Generally, BGP requires that the AS_Path attributes of the routes be the same so that load balancing can be implemented. To meet load balancing requirements, AS numbers can be replaced. For example in Figure 1-1795, the apply as-path 65002 65004 65005 overwrite command can be run on DeviceA to replace the AS_Path of the route learned from DeviceC so that the route has the same AS_Path as that of the route learned from DeviceB, and the two routes are used to load-balance traffic. Detailed configurations on DeviceA are as follows:
# bgp 65001 # ipv4-family unicast undo synchronization peer 10.1.3.2 route-policy replace_asn import //Apply export policy named replace_asn to routes to be advertised to BGP peer 10.1.3.2. # route-policy replace_asn permit node 10 //Define the first node of replace_asn. if-match as-path-filter filter1 //Configure AS_Path filter named filter1. apply as-path 65002 65004 65005 overwrite //Replace the AS_Path of the route that matches filter1 with 65002, 65004, 65005. # route-policy replace_asn permit node 20 //Define the second node of replace_asn to permit all other routes. # ip as-path-filter filter1 permit ^65003 //Define AS_Path filter named filter1 to match all the routes learned from AS 65003. #
Run the display bgp routing-table [ ip-address ] command to verify the configuration.
# Display the routing table of DeviceA.
[~DeviceA] display bgp routing-table
BGP Local router ID is 10.1.1.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 6 Network NextHop MED LocPrf PrefVal Path/Ogn *> 172.16.1.0/24 10.1.1.2 0 65002 65004 65005? * 10.1.3.2 0 65002 65004 65005? *> 172.16.2.0/24 10.1.1.2 0 65002 65004 65005? * 10.1.3.2 0 65002 65004 65005? *> 172.16.3.0/24 10.1.1.2 0 65002 65004 65005? * 10.1.3.2 0 65002 65004 65005?
The preceding command output shows that the AS_Path of the route received from AS 65003 has been replaced. In this case, the routes sent from AS 65002 and AS 65003 have the same AS_Path, which meets the load balancing conditions. Run the maximum load-balancing 2 command on DeviceA to set the maximum number of routes for load balancing to 2. Then, check the detailed BGP route information. The route 172.16.1.0/24 is used in the following example:
[~DeviceA] display bgp routing-table 172.16.1.0
BGP local router ID : 10.1.1.1 Local AS number : 65001 Paths: 2 available, 1 best, 2 select BGP routing table entry information of 172.16.1.0/24: From: 10.1.1.2 (10.1.1.2) Route Duration: 19h57m51s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.1.2 Qos information : 0x0 AS-path 65002 65004 65005, origin incomplete, pref-val 0, valid, external, best, select, active, pre 255 Advertised to such 2 peers: 10.1.1.2 10.1.3.2 BGP routing table entry information of 172.16.1.0/24: From: 10.1.3.2 (10.1.5.1) Route Duration: 00h10m21s Direct Out-interface: GigabitEthernet0/2/0 Original nexthop: 10.1.3.2 Qos information : 0x0 AS-path 65002 65004 65005, origin incomplete, pref-val 0, valid, external, select, active, pre 255, not preferred for router ID Not advertised to any peer yet
The preceding command output shows that the route learned from DeviceB is optimal and is used by BGP along with the route learned from DeviceC (not optimal) for load balancing. Check the information about the route 172.16.1.0/24 in the IP routing table.
[~DeviceA] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : _Public_ Destinations : 9 Routes : 12 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.1.1.0/30 Direct 0 0 D 10.1.1.1 GigabitEtherne0/2/0 10.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/2/0 10.1.3.0/30 Direct 0 0 D 10.1.3.1 GigabitEthernet0/1/0 10.1.3.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 172.16.1.0/24 EBGP 255 0 D 10.1.1.2 GigabitEthernet0/2/0 EBGP 255 0 D 10.1.3.2 GigabitEthernet0/1/0 172.16.2.0/24 EBGP 255 0 D 10.1.1.2 GigabitEthernet0/2/0 EBGP 255 0 D 10.1.3.2 GigabitEthernet0/1/0 172.16.3.0/24 EBGP 255 0 D 10.1.1.2 GigabitEthernet0/2/0 EBGP 255 0 D 10.1.3.2 GigabitEthernet0/1/0
The preceding command output shows that BGP has delivered the two routes with the same route prefix to the IP routing table for load balancing.
Clearing the AS_Path
If none overwrite is specified in the apply as-path command, the device can clear the AS_Path attribute to shield the actual path information as well as shortening the AS_Path length. If the AS_Path attribute is empty, BGP considers its length as 0 during route selection.
The Origin attribute indicates how routes become BGP routes.
- IGP: indicates that routes are added to the BGP routing table using the network command. IGP has the highest priority.
- EGP: indicates that routes are learned through the EGP protocol. EGP has the second highest priority.
The device can receive and send BGP routes with EGP as the Origin. However, devices do not support EGP; therefore, to set the Origin of routes to EGP, you need to run the apply origin { egp { as-number-plain | as-number-dot } | igp | incomplete } command to apply a route-policy.
- Incomplete: This attribute type has the lowest priority. If a route is added to the BGP routing table using the import-route command, the Origin attribute of the route is Incomplete.
The configurations on Device D are as follows:
# bgp 65001 # ipv4-family unicast network 10.1.4.0 255.255.255.252 //Advertise the route 10.1.4.0/30. #
The configurations on Device C are as follows:
# bgp 65001 # ipv4-family unicast import-route direct //Import direct routes. #
Run the display bgp routing-table [ ip-address ] command to check the configurations.
# Display the routing table of Device B.
[~DeviceB] display bgp routing-table
BGP Local router ID is 10.1.1.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 3 Network NextHop MED LocPrf PrefVal Path/Ogn i 10.1.2.0/30 10.1.2.2 0 100 0 ? *>i 10.1.4.0/30 10.1.3.2 0 100 0 i * i 10.1.2.2 0 100 0 ?
The preceding command output shows that two active routes 10.1.4.0/30 are available in the routing table.
[~DeviceB] display bgp routing-table 10.1.4.0
BGP local router ID : 10.1.1.2 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.1.4.0/30: From: 10.1.3.2 (10.1.3.2) Route Duration: 01h14m48s Relay IP Nexthop: 0.0.0.0 Relay IP Out-Interface: GigabitEthernet0/1/0 Original nexthop: 10.1.3.2 Qos information : 0x0 AS-path Nil, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, best, select, active, pre 255 Advertised to such 1 peers: 10.1.1.1 BGP routing table entry information of 10.1.4.0/30: From: 10.1.2.2 (10.1.2.2) Route Duration: 01h13m20s Relay IP Nexthop: 0.0.0.0 Relay IP Out-Interface: GigabitEthernet0/2/0 Original nexthop: 10.1.2.2 Qos information : 0x0 AS-path Nil, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal, pre 255, not preferred for Origin Not advertised to any peer yet
The preceding command output shows that the route learned from Device D is selected because it is imported using the network command and its Origin priority is higher. Table 1-715 describes the attribute comparison of the routes learned from Device C and Device D.
Route Attribute |
Route Learned from Device C |
Route Learned from Device D |
Comparison |
---|---|---|---|
PrefVal |
0 |
0 |
The same. |
Local_Pref |
100 |
100 |
The same. |
Route type |
Learned from a peer |
Learned from a peer |
The same. |
AIGP |
- |
- |
The same. |
AS_Path |
- |
- |
The same length. |
Origin |
Incomplete |
IGP |
The route learned from Device D is optimal. |
The Origin attribute can be modified using a route-policy. In the following example, a route-policy is configured on Device B to modify the Origin attribute, and the detailed configurations are as follows:
# bgp 65001 # ipv4-family unicast peer 10.1.3.2 route-policy for_d import //Apply import policy named for_d to the routes learned from 10.1.3.2 and use for_d to modify the Origin value. # route-policy for_d permit node 10 //Define the route-policy named for_d. apply origin incomplete //Set the Origin type to Incomplete.
Run the display bgp routing-table [ ip-address ] command to check the configurations.
# Display the routing table of Device B.
[~DeviceB] display bgp routing-table
BGP Local router ID is 10.1.1.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 3 Network NextHop MED LocPrf PrefVal Path/Ogn i 10.1.2.0/30 10.1.2.2 0 100 0 ? *>i 10.1.4.0/30 10.1.2.2 0 100 0 ? * i 10.1.3.2 0 100 0 ?
The preceding command output shows that the route learned from Device C becomes the optimal route.
[~DeviceB] display bgp routing-table 10.1.4.0
BGP local router ID : 10.1.1.2 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.1.4.0/30: From: 10.1.2.2 (10.1.2.2) Route Duration: 01h28m19s Relay IP Nexthop: 0.0.0.0 Relay IP Out-Interface: GigabitEthernet0/1/0 Original nexthop: 10.1.2.2 Qos information : 0x0 AS-path Nil, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal, best, select, active, pre 255 Advertised to such 1 peers: 10.1.1.1 BGP routing table entry information of 10.1.4.0/30: From: 10.1.3.2 (10.1.3.2) Route Duration: 00h03m18s Relay IP Nexthop: 0.0.0.0 Relay IP Out-Interface: GigabitEthernet0/2/0 Original nexthop: 10.1.3.2 Qos information : 0x0 AS-path Nil, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal, pre 255, not preferred for router ID Not advertised to any peer yet
The preceding command output shows that the route learned from Device C becomes the optimal route because it has a smaller router ID. Table 1-716 describes the attribute comparison of the routes learned from Device C and Device D.
Route Attribute |
Route Learned from Device C |
Route Learned from Device D |
Comparison |
---|---|---|---|
PrefVal |
0 |
0 |
The same. |
Local_Pref |
100 |
100 |
The same. |
Route type |
Learned from a peer |
Learned from a peer |
The same. |
AIGP |
- |
- |
The same. |
AS_Path |
- |
- |
The same. |
Origin |
Incomplete |
Incomplete |
The same. |
MED |
0 |
0 |
The same. |
Peer type |
IBGP |
IBGP |
The same. |
IGP cost |
- |
- |
The same. |
Cluster_List |
- |
- |
The same. |
Router ID |
10.1.2.2 |
10.1.3.2 |
The route learned from Device C is optimal. |
MED attributes of routes can be configured as required to control traffic forwarding path for the purpose of load balancing.
The MED attribute is transmitted only within an AS or between two neighboring ASs. The AS that receives the MED attribute does not advertise it to a third AS.
Similar to the cost used by an IGP, the MED is used to determine the optimal route when traffic enters an AS. When a BGP peer learns multiple routes that have the same destination address but different next hop addresses from EBGP peers, the route with the smallest MED value is selected as the optimal route if all the other attributes are the same.
Table 1-717 lists three methods used to modify the MED value.
Method |
Usage Scenario |
---|---|
Run the default med command. |
This method sets a default MED for all the routes that the local device advertises to its BGP peers. The default med command takes effect only with the routes imported locally using the import-route command and BGP summarized routes. |
Configure an import or export policy and run the apply cost command to configure an apply clause for the policy. |
This method sets different MED values for different routes advertised by the local device to its EBGP peers. |
Configure an export policy in which the apply cost-type internal command is run. |
The router sets the MED of each BGP route advertised to a peer to the cost of the IGP route to which the BGP route recurses. This method takes effect only on EBGP peers. NOTE:
If both the apply cost and apply cost-type commands are run, only the apply cost command takes effect. |
Configure an export policy in which the apply cost-type internal-inc-ibgp command is run. |
The router sets the MED of each BGP route advertised to a peer to the cost of the IGP route to which the BGP route recurses. This method takes effect both on IBGP and EBGP peers. |
Configure an export policy in which the apply cost-type med-plus-igp command is run. |
The router sets the MED of each BGP route advertised to a peer to the cost of the IGP route to which the BGP route recurses plus the original MED. This method takes effect both on IBGP and EBGP peers. |
Configure an export policy in which the apply cost-type med-inherit-aigp command is run. |
The router sets the MED of each route to be advertised to a peer to the AIGP of the route. This method takes effect on both IBGP and EBGP peers. The policy applies only to BGP VPN peers. |
In addition, pay attention to the following rules when using the MED attribute:
If routes are received from different ASs, traffic will be sent to different ASs. In addition, BGP selects the optimal route only from the routes destined for the same address. Therefore, BGP only compares the MEDs of routes that are from the same AS (excluding confederation sub-ASs). MEDs of two routes are compared only if the leftmost AS number in the AS_Sequence (excluding AS_Confed_Sequence) of one route is the same as its counterpart in the other route.
If the compare-different-as-med command is run, BGP compares MEDs of routes even when the routes are received from peers in different ASs. Do not run this command unless the ASs use the same IGP and route selection mode. Otherwise, a routing loop may occur.
If a route does not carry MED, BGP uses the default value (0) as the MED of the route during route selection. If the bestroute med-none-as-maximum command is run, BGP considers the largest MED value (4294967295) to be the MED of the route. After route selection is complete, the MED is restored to the original value.
After the bestroute med-confederation command is configured, BGP compares the MEDs of routes only when the AS_Path attributes of the routes carry no external AS numbers (ASs that do not belong to the confederation) and the leftmost AS numbers in each AS_Confed_Sequence are the same.
If the deterministic-med command is run, routes are no longer selected in the sequence in which they are received.
Figure 1-1797 is used as an example to describe how the MED attribute is used in BGP route selection. In Figure 1-1797, ISP1 and ISP2 can access 1.1.1.9/32 from DeviceC or DeviceD.
Scenario 1: Check the BGP routing tables of Device A and Device B before Device C and Device D are configured to modify the MED of the route 1.1.1.9/32.
[~DeviceA] display bgp routing-table
BGP Local router ID is 10.1.1.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 2 Network NextHop MED LocPrf PrefVal Path/Ogn *> 1.1.1.9/32 10.1.1.2 0 65001i * 10.1.3.2 0 65001i
[~DeviceB] display bgp routing-table
BGP Local router ID is 10.1.2.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 2 Network NextHop MED LocPrf PrefVal Path/Ogn *> 1.1.1.9/32 10.1.4.2 0 65001i * 10.1.2.2 0 65001i
The preceding command output shows that both ISP1 and ISP2 select the route learned from DeviceC as the optimal route. That is, the traffic from ISP1 and ISP2 to 1.1.1.9/32 enters AS 65001 through DeviceC, not through DeviceD, indicating that load balancing is not implemented.
Run the display bgp routing-table ip-address command on Device B to check the reason why Device B chooses the route learned from Device C.
[~DeviceB] display bgp routing-table 1.1.1.9
BGP local router ID : 10.1.2.1 Local AS number : 200 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 1.1.1.9/32: From: 10.1.4.2 (10.1.1.2) Route Duration: 00h00m58s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.4.2 Qos information : 0x0 AS-path 65001, origin igp, pref-val 0, valid, external, best, select, active, pre 255 Advertised to such 2 peers: 10.1.2.2 10.1.4.2 BGP routing table entry information of 1.1.1.9/32: From: 10.1.2.2 (10.1.2.2) Route Duration: 00h01m07s Direct Out-interface: GigabitEthernet0/2/0 Original nexthop: 10.1.2.2 Qos information : 0x0 AS-path 65001, origin igp, pref-val 0, valid, external, pre 255, not preferred for router ID Not advertised to any peer yet
The preceding command output shows that DeviceB selects the route learned from DeviceC because the router ID (10.1.1.2) of DeviceC is smaller than that (10.1.2.2) of DeviceD. Table 1-718 describes the attribute comparison of the routes learned from DeviceC and DeviceD.
Route Attribute |
Route Learned from Device C |
Route Learned from Device D |
Comparison |
---|---|---|---|
PrefVal |
0 |
0 |
The same. |
Local_Pref |
- |
- |
The same. |
Route type |
Learned from a peer |
Learned from a peer |
The same. |
AIGP |
- |
- |
The same. |
AS_Path |
65001 |
65001 |
The same length. |
Origin |
IGP |
IGP |
The same. |
MED |
- |
- |
The same. |
Peer type |
EBGP |
EBGP |
The same. |
IGP cost |
- |
- |
The same. |
Cluster_List |
- |
- |
The same length. |
Router ID |
10.1.1.2 |
10.1.2.2 |
The route learned from Device C is optimal. |
- The traffic from ISP1 to 1.1.1.9/32 enters AS 65001 preferentially through DeviceC, with DeviceD as a backup option.
- The traffic from ISP2 to 1.1.1.9/32 enters AS 65001 preferentially through DeviceD, with DeviceC as a backup option.
To meet the preceding requirements, ensure that ISP1 selects the route learned from DeviceC to access 1.1.1.9/32 and that ISP2 selects the route learned from DeviceD to access 1.1.1.9/32. Figure 1-1798 shows the networking.
Configurations on Device C:
# bgp 65001 # ipv4-family unicast undo synchronization peer 10.1.4.1 route-policy addmed100 export //Apply export policy named addmed100 to the routes to be advertised to 10.1.4.1 and use addmed100 to modify the MED value. # route-policy addmed100 permit node 10 //Define the first node of addmed100 and set the MED of the route 1.1.1.9/32 to 100. if-match ip-prefix p1 apply cost 100 # route-policy addmed100 permit node 20 //Define the second node of addmed100 to allow addmed100 to permit all other routes. # ip ip-prefix p1 index 10 permit 1.1.1.9 32 //Configure an IP prefix list to match the route 1.1.1.9/32.
- Configurations on DeviceD:
The following configurations are intended to ensure that DeviceA selects the route learned from DeviceC. However, DeviceA has already selected the route learned from DeviceC because the router ID of DeviceC is smaller than that of DeviceD. Therefore, the following configurations on DeviceD are optional.
# bgp 65001 # ipv4-family unicast undo synchronization peer 10.1.3.1 route-policy addmed200 export //Apply export policy named addmed200 to the routes to be advertised to 10.1.3.1 and use addmed200 to modify the MED value. # route-policy addmed200 permit node 10 //Define the first node of addmed200 and set the MED of the route 1.1.1.9/32 to 200. if-match ip-prefix p1 apply cost 200 # route-policy addmed200 permit node 20 //Define the second node of addmed200 to allow addmed200 to permit all other routes. # ip ip-prefix p1 index 10 permit 1.1.1.9 32 //Configure an IP prefix list to match the route 1.1.1.9/32.
Run the display bgp routing-table [ ip-address ] command to check the configurations. Use Device B as an example.
# Display the routing table of Device B.
[~DeviceB] display bgp routing-table
BGP Local router ID is 10.1.2.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 2 Network NextHop MED LocPrf PrefVal Path/Ogn *> 1.1.1.9/32 10.1.2.2 0 65001i * 10.1.4.2 100 0 65001i
# Display detailed information about the route 1.1.1.9/32 on Device B.
[~DeviceB] display bgp routing-table 1.1.1.9 32
BGP local router ID : 10.1.2.1 Local AS number : 200 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 1.1.1.9/32: From: 10.1.2.2 (10.1.2.2) Route Duration: 01h20m38s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.2.2 Qos information : 0x0 AS-path 65001, origin igp, pref-val 0, valid, external, best, select, active, pre 255 Advertised to such 2 peers: 10.1.2.2 10.1.4.2 BGP routing table entry information of 1.1.1.9/32: From: 10.1.4.2 (10.1.1.2) Route Duration: 01h16m28s Direct Out-interface: GigabitEthernet0/2/0 Original nexthop: 10.1.4.2 Qos information : 0x0 AS-path 65001, origin igp, MED 100, pref-val 0, valid, external, pre 255, not preferred for MED Not advertised to any peer yet
The preceding command output shows that two routes 1.1.1.9/32 are available in the BGP routing table of DeviceB and that only the route with next hop address 10.1.2.2 is selected as the optimal route. The other route with next hop address 10.1.4.2 is not selected due to the MED issue.
Table 1-719 compares the attributes of the routes that DeviceB learns from DeviceC and DeviceD.
Route Attribute |
Route Learned from Device C |
Route Learned from Device D |
Comparison |
---|---|---|---|
PrefVal |
0 |
0 |
The same. |
Local_Pref |
- |
- |
The same. |
Route type |
Learned from a peer |
Learned from a peer |
The same. |
AIGP |
- |
- |
The same. |
AS_Path |
65001 |
65001 |
The same length. |
Origin |
IGP |
IGP |
The same. |
MED |
100 |
- |
The route learned from Device D carries no MED value, and therefore, the default value (0) is used. The route learned from DeviceD is optimal. |
Figure 1-1798 shows that the route learned from DeviceD does not carry the MED attribute. In this case, the default MED value 0 is used by this route. Therefore, this route is selected as the optimal route. To change the route selection result on DeviceB, you can run the bestroute med-none-as-maximum command on DeviceB. Detailed configurations are as follows:
[~DeviceB] display bgp routing-table
BGP Local router ID is 10.1.2.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 2 Network NextHop MED LocPrf PrefVal Path/Ogn *> 1.1.1.9/32 10.1.4.2 100 0 65001i * 10.1.2.2 0 65001i
[~DeviceB] display bgp routing-table 1.1.1.9
BGP local router ID : 10.1.2.1 Local AS number : 200 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 1.1.1.9/32: From: 10.1.4.2 (10.1.1.2) Route Duration: 00h08m42s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.4.2 Qos information : 0x0 AS-path 65001, origin igp, MED 100, pref-val 0, valid, external, best, select, active, pre 255 Advertised to such 2 peers: 10.1.2.2 10.1.4.2 BGP routing table entry information of 1.1.1.9/32: From: 10.1.2.2 (10.1.2.2) Route Duration: 16h33m10s Direct Out-interface: GigabitEthernet0/2/0 Original nexthop: 10.1.2.2 Qos information : 0x0 AS-path 65001, origin igp, pref-val 0, valid, external, pre 255, not preferred for MED Not advertised to any peer yet
The preceding command output shows that two routes 1.1.1.9/32 are available in the BGP routing table of Device B. The MED of the route with the next hop address 10.1.4.2 is 100, and the MED of the route with the next hop address 10.1.2.2 is considered as 4294967295 because it carries no MED. Therefore, the route with the next hop address 10.1.4.2 is selected as the optimal route.
In addition, BGP selects routes in the same sequence they are received. Therefore, the route selection result is relevant to the sequence in which the routes are received. For example, the following three BGP routes are available on a device:
Route A1: AS_Path { 65001 200 }, med 100, igp cost 13, internal, Router id 4.4.4.4
Route A2: AS_Path { 65001 100 }, med 150, igp cost 11, internal, Router id 5.5.5.5
Route B: AS_Path { 65002 300 }, med 0, igp cost 12, internal, Router id 6.6.6.6
- Case 1: Route A1 is received first, followed by route B, and then route A2.
- BGP first compares route A1 and route B. Because the leftmost ASs of route A1 and route B are different, the device does not compare the MEDs of the two routes and prefers the route (route B) with the smallest IGP metric (IGP cost).
- BGP then compares route A2 and route B. Because the leftmost ASs of route A2 and route B are different, the device does not compare the MEDs of the two routes and prefers the route (route A2) with the smallest IGP metric.
- Case 2: Route A2 is received first, followed by route B, and then route A1.
- BGP then compares route A2 and route B. Because the leftmost ASs of route B and route A2 are different, the device does not compare the MEDs of the two routes and prefers the route (route A2) with the smallest IGP metric.
- BGP then compares route A1 and route A2. The leftmost AS number of route A1 is the same as its counterpart in route A2. In this situation, BGP selects route A1 as the optimal route because its MED value is smaller.
- Case 3: If the deterministic-med command is run, BGP groups the routes that are learned from different ASs but are destined for the same network segment based on the leftmost AS number in the AS_Path, selects one optimal route from each group, and then compares the optimal routes of all the groups. Detailed steps are as follows:
- BGP first compares route A1 and route A2. The leftmost AS number of route A1 is the same as its counterpart in route A2. In this situation, BGP selects route A1 as the optimal route because its MED value is smaller.
- BGP then compares route A1 and route B. The leftmost AS number of route A1 is different from its counterpart in route B. Therefore, BGP does not compare the MED values and selects route B as the optimal route because the IGP cost is smaller.
Case 1 and case 2 show that the route selection result is relevant to the sequence in which routes are received if the deterministic-med is not configured. Case 3 shows that the route selection result is irrelevant to the sequence in which routes are received if the deterministic-med is configured.
When IBGP routes (routes learned from IBGP peers) and EBGP routes (routes learned from EBGP peers) are available, BGP preferentially selects EBGP routes.
When one EBGP route and multiple IBGP routes are available, BGP selects the optimal route based on the peer type. If no EBGP route is available or multiple EBGP routes are available, BGP is unable to select the optimal route based on the peer type.
The EBGP route is selected as the optimal route, which prevents the traffic that leaves Device A or Device B for the Internet from being forwarded to the other egress device.
For more peer type-based route selection examples, see Local_Pref.
BGP prefers the route with the smallest IGP cost during BGP route selection.
Run the display bgp routing-table [ ip-address ] command on Device C and Device D to check the configurations. Device C is used as an example.
# Display the routing table of Device C.
[~DeviceC] display bgp routing-table
BGP Local router ID is 10.1.1.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 4 Network NextHop MED LocPrf PrefVal Path/Ogn *>i 1.1.1.9/32 10.1.5.2 0 100 0 100i * i 10.1.6.2 0 100 0 100i *>i 10.1.5.0/30 10.1.3.2 0 100 0 i *>i 10.1.6.0/30 10.1.2.2 0 100 0 i
The preceding command output shows that two routes 1.1.1.9/32 are available in the routing table of Device C and that Device C selects the route learned from Device A.
[~DeviceC] display bgp routing-table 1.1.1.9
BGP local router ID : 10.1.1.1 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 1.1.1.9/32: From: 10.1.3.2 (2.2.2.9) Route Duration: 00h00m44s Relay IP Nexthop: 10.1.3.2 Relay IP Out-Interface: GigabitEthernet0/2/0 Original nexthop: 10.1.5.2 Qos information : 0x0 AS-path 100, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, best, select, active, pre 255 Not advertised to any peer yet BGP routing table entry information of 1.1.1.9/32: From: 10.1.2.2 (10.1.2.2) Route Duration: 00h00m39s Relay IP Nexthop: 10.1.1.2 Relay IP Out-Interface: GigabitEthernet0/1/0 Original nexthop: 10.1.6.2 Qos information : 0x0 AS-path 100, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, pre 255, IGP cost 2, not preferred for IGP cost Not advertised to any peer yet
The preceding command output shows that the route with next hop address 10.1.6.2 is ignored because its IGP cost is larger than that of the other route. Table 1-720 describes the attribute comparison of the routes learned from Device A and Device B.
Route Attribute |
Route Learned from Device A |
Route Learned from Device B |
Comparison |
---|---|---|---|
PrefVal |
0 |
0 |
The same. |
Local_Pref |
100 |
100 |
The same. |
Route type |
Learned from a peer |
Learned from a peer |
The same. |
AIGP |
- |
- |
The same. |
AS_Path |
100 |
100 |
The same length. |
Origin |
IGP |
IGP |
The same. |
MED |
0 |
0 |
The same. |
Peer type |
IBGP |
IBGP |
The same. |
IGP cost |
- |
2 |
The route learned from Device A is optimal. NOTE:
If a BGP route carries no IGP cost value, BGP considers its IGP cost to be 0. If no IGP routes are used during BGP peer relationship establishment or the costs of used IGP routes are 0, the IGP cost is not displayed in the display bgp routing-table ip-address command output. |
BGP prefers the route with the shortest Cluster_List length during BGP route selection.
An RR and its clients form a cluster. In an AS, each RR is uniquely identified by a Cluster_ID.
Similar to an AS_Path, a Cluster_List is composed of a series of Cluster_IDs and is generated by an RR. The Cluster_List records all the RRs through which a route passes.
Before an RR reflects a route between its clients or between its clients and non-clients, the RR adds the local Cluster_ID to the leftmost position of the Cluster_List. If a route does not carry any Cluster_List, the RR creates one for the route.
After the RR receives an updated route, it checks the Cluster_List of the route. If the RR finds that its cluster ID is included in the Cluster_List, the RR discards the route. If its cluster ID is not included in the Cluster_List, the RR adds its cluster ID to the Cluster_List and then reflects the route.
- The RR does not add the Cluster_ID attribute to the routes that are locally imported.
The following example shows how Cluster_List is used in BGP route selection. In Figure 1-1801, an IBGP peer relationship is established between each two neighboring devices in AS 65001. DeviceB functions as a level-1 RR, and DeviceD is its client. DeviceD functions as a level-2 RR, and DeviceE is its client. DeviceC functions as an RR, and DeviceE is its client. DeviceE is configured to import the route 1.1.1.9/32 to BGP.
Run the display bgp routing-table [ ip-address ] command on Device A to check the configurations.
# Display the routing table of Device A.
[~DeviceA] display bgp routing-table
BGP Local router ID is 10.1.3.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 2 Network NextHop MED LocPrf PrefVal Path/Ogn *>i 1.1.1.9/32 10.1.5.2 0 100 0 i * i 10.1.4.2 0 100 0 i
The preceding command output shows that two routes 1.1.1.9/32 are available in the routing table and that Device A selects the route learned from Device C.
[~DeviceA] display bgp routing-table 1.1.1.9
BGP local router ID : 10.1.3.1 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 1.1.1.9/32: From: 10.1.3.2 (2.2.2.9) Route Duration: 00h53m08s Relay IP Nexthop: 10.1.3.2 Relay IP Out-Interface: GigabitEthernet0/1/0 Original nexthop: 10.1.5.2 Qos information : 0x0 AS-path Nil, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, best, select, active, pre 255, IGP cost 3 Originator: 1.1.1.9 Cluster list: 0.0.0.3 Not advertised to any peer yet BGP routing table entry information of 1.1.1.9/32: From: 10.1.1.2 (10.1.2.1) Route Duration: 00h28m05s Relay IP Nexthop: 10.1.1.2 Relay IP Out-Interface: GigabitEthernet0/2/0 Original nexthop: 10.1.4.2 Qos information : 0x0 AS-path Nil, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, pre 255, IGP cost 3, not preferred for Cluster List Originator: 1.1.1.9 Cluster list: 0.0.0.2, 0.0.0.1 Not advertised to any peer yet
The preceding command output shows that the route learned from DeviceB is ignored because its Cluster_List is longer. Table 1-721 describes attribute comparison of the routes learned by DeviceA from DeviceB and DeviceC.
Route Attribute |
Route Learned from Device B |
Route Learned from Device C |
Comparison |
---|---|---|---|
PrefVal |
0 |
0 |
The same. |
Local_Pref |
100 |
100 |
The same. |
Route type |
Learned from a peer |
Learned from a peer |
The same. |
AIGP |
- |
- |
The same. |
AS_Path |
- |
- |
The same length. |
Origin |
IGP |
IGP |
The same. |
MED |
0 |
0 |
The same. |
Peer type |
IBGP |
IBGP |
The same. |
IGP cost |
3 |
3 |
The same. |
Cluster_List |
0.0.0.2, 0.0.0.1 |
0.0.0.3 |
The route learned from Device C is optimal. |
In most cases, BGP does not advertise the routes learned from an AS to the AS again. When RRs are deployed, such routes may be advertised to the AS again although routing loops may occur. Using the Cluster_List attribute can prevent such routing loops.
If routes carry the Originator_ID, the originator ID is substituted for the router ID during route selection. The route with the smallest Originator_ID is preferred.
The Originator_ID attribute is four bytes long and is generated by an RR. It carries the router ID of the route originator in the local AS.
When a route is reflected by an RR for the first time, the RR adds the Originator_ID to this route. If a route already carries the Originator_ID attribute, the RR does not create a new one.
After receiving the route, a BGP speaker checks whether the Originator_ID is the same as its router ID. If Originator_ID is the same as its router ID, the BGP speaker discards this route.
The following example shows how Originator_ID is used during BGP route selection. In Figure 1-1802, an IBGP peer relationship is established between each two neighboring devices in AS 65001. The router IDs of DeviceB and DeviceC are 2.2.2.9 and 3.3.3.9, respectively, and they function as RRs. DeviceD is a client of DeviceB, and DeviceE is a client of DeviceC. DeviceD and DeviceE are configured to import the route 10.1.4.0/30 to BGP.
Run the display bgp routing-table [ ip-address ] command on Device A to check the configurations.
# Display the routing table of Device A.
[~DeviceA] display bgp routing-table
BGP Local router ID is 10.1.3.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 2 Network NextHop MED LocPrf PrefVal Path/Ogn *>i 10.1.4.0/30 10.1.5.2 0 100 0 i * i 10.1.2.2 0 100 0 i
The preceding command output shows that two routes 10.1.4.0/30 are available in the routing table of DeviceA and that DeviceA selects the route learned from DeviceC.
[~DeviceA] display bgp routing-table 10.1.4.0
BGP local router ID : 10.1.3.1 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.1.4.0/30: From: 10.1.3.2 (3.3.3.9) Route Duration: 00h00m01s Relay IP Nexthop: 10.1.3.2 Relay IP Out-Interface: GigabitEthernet0/1/0 Original nexthop: 10.1.5.2 Qos information : 0x0 AS-path Nil, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, best, select, pre 255, IGP cost 2 Originator: 10.1.4.1 Cluster list: 0.0.0.3 Not advertised to any peer yet BGP routing table entry information of 10.1.4.0/30: From: 10.1.1.2 (2.2.2.9) Route Duration: 00h00m17s Relay IP Nexthop: 10.1.1.2 Relay IP Out-Interface: GigabitEthernet0/2/0 Original nexthop: 10.1.2.2 Qos information : 0x0 AS-path Nil, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, pre 255, IGP cost 2, not preferred for router ID Originator: 10.1.4.2 Cluster list: 0.0.0.2 Not advertised to any peer yet
The preceding command output shows that the route learned from DeviceB is not selected due to a router ID issue. In fact, the router ID of DeviceB is 2.2.2.9, smaller than that (3.3.3.9) of DeviceC. The route learned from DeviceB should be selected if the router IDs are used to determine the optimal route. However, the routes carry the Originator_ID attribute. In this situation, Originator_IDs (rather than router IDs) are compared. Consequently, the route learned from DeviceC is selected because the Originator_ID (10.1.4.1) of DeviceC is smaller than that (10.1.4.2) of the route learned from DeviceB.
Table 1-722 describes the attribute comparison of the routes that DeviceA learns from DeviceB and DeviceC.
Route Attribute |
Route Learned from Device B |
Route Learned from Device C |
Comparison |
---|---|---|---|
PrefVal |
0 |
0 |
The same. |
Local_Pref |
100 |
100 |
The same. |
Route type |
Learned from a peer |
Learned from a peer |
The same. |
AIGP |
- |
- |
The same. |
AS_Path |
- |
- |
The same length. |
Origin |
IGP |
IGP |
The same. |
MED |
0 |
0 |
The same. |
Peer type |
IBGP |
IBGP |
The same. |
IGP cost |
2 |
2 |
The same. |
Cluster_List |
0.0.0.2 |
0.0.0.3 |
The same length. |
Originator_ID |
10.1.4.2 |
10.1.4.1 |
The route learned from Device C is optimal. |
If routes carry Originator_ID attributes, the Originator_ID attributes (rather than router IDs) are compared.
If multiple routes to the same destination are available, BGP preferentially selects the route advertised by the device with the smallest router ID.
- Run the router-id { ipv4-address | vpn-instance auto-select } command. If no router ID is configured in the BGP view, BGP selects a router ID configured in the system view. For details on how a router ID configured in the system view is selected.
- Run the router-id (BGP) { ipv4-address | auto-select } command in the BGP VPN instance IPv4/IPv6 address family view. The router-id (BGP VPN instance IPv4/IPv6 address family view) command takes precedence over the router-id (BGP) command.
If each route carries an Originator_ID, the Originator_IDs rather than router IDs are compared during route selection. The route with the smallest Originator_ID is preferred. By default, Cluster_List takes precedence over Originator_ID during BGP route selection. To enable Originator_ID to take precedence over Cluster_List during BGP route selection, run the bestroute router id-prior-clusterlist command.
For more router ID-based route selection examples, see Local_Pref, Origin, and MED.
BGP prefers the route learned from the peer with the smallest IP address during BGP route selection.
The peer IP address is the IP address specified in ipv4-address or ipv6-address in the peer { group-name | ipv4-address | ipv6-address } as-number { as-number-plain | as-number-dot } command. The group-name parameter specified in the command is the one specified in the peer { ipv4-address | ipv6-address } group group-name command.
If the optimal route has not been selected yet before BGP begins to compare peer IP addresses, the local device may have established multiple BGP peer relationships with another device through equal-cost links. In most cases, if a backup physical link is available between two devices, using loopback interfaces to establish a BGP peer relationship is recommended although multiple BGP peer relationships may be established between the two devices through the physical links.
The configurations on Device A are as follows:
# bgp 65001 peer 10.1.1.2 as-number 65002 peer 10.1.2.2 as-number 65002 # ipv4-family unicast peer 10.1.1.2 enable peer 10.1.2.2 enable #
The configurations on Device B are as follows:
# bgp 65002 peer 10.1.1.1 as-number 65001 peer 10.1.2.1 as-number 65001 # ipv4-family unicast network 2.2.2.9 255.255.255.255 peer 10.1.1.1 enable peer 10.1.2.1 enable #
Run the display bgp routing-table [ ip-address ] command to check the configurations.
# Display the routing table of Device A.
[~DeviceA] display bgp routing-table
BGP Local router ID is 192.168.2.3 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 2 Network NextHop MED LocPrf PrefVal Path/Ogn *> 2.2.2.9/32 10.1.1.2 0 0 65002i * 10.1.2.2 0 0 65002i
The preceding command output shows that two routes 2.2.2.9/32 are available in the routing table and that the route with the next hop address 10.1.1.2 is selected as the optimal route.
[~DeviceA] display bgp routing-table 2.2.2.9
BGP local router ID : 192.168.2.3 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 2.2.2.9/32: From: 10.1.1.2 (192.168.2.4) Route Duration: 00h19m10s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.1.2 Qos information : 0x0 AS-path 65002, origin igp, MED 0, pref-val 0, valid, external, best, select, active, pre 255 Advertised to such 2 peers: 10.1.1.2 10.1.2.2 BGP routing table entry information of 2.2.2.9/32: From: 10.1.2.2 (192.168.2.4) Route Duration: 00h19m05s Direct Out-interface: GigabitEthernet0/2/0 Original nexthop: 10.1.2.2 Qos information : 0x0 AS-path 65002, origin igp, MED 0, pref-val 0, valid, external, pre 255, not preferred for peer address Not advertised to any peer yet
The preceding command output shows that the route with the next hop address 10.1.1.2 is selected as the optimal route because its peer IP address is smaller than that of the other route.
(Optional) Configuring BGP to Ignore the Reachability of the Next Hops of Received BGP VPNv4 Routes
Configuring BGP to ignore the reachability of the next hops of received BGP VPNv4 routes ensures that the BGP routes remain active even if their next hops are unreachable.
Usage Scenario
On the network shown in Figure 1-1804, an IGP runs between PE1 and ABR1, and between PE2 and ABR2. All the devices run IBGP. ABR1 and ABR2 are route reflectors (RRs). PE1 and ABR2 are the clients of ABR1, and PE2 and ABR1 are the clients of ABR2. A tunnel is deployed between PE1 and PE2. When ABR2 receives a BGP VPNv4 route with PE1 as the original next hop from ABR1, ABR2 cannot find the IP routing entry corresponding to PE1 and does not have a tunnel to PE1. As a result, ABR2 considers the received BGP VPNv4 route to be invalid, and this route cannot be advertised to PE2. As PE2 does not receive the BGP VPNv4 route originating from PE1, route recursion to the tunnel between PE1 and PE2 cannot be performed, and traffic cannot be forwarded through the tunnel. To address this, configure BGP on ABR2 to ignore the reachability of the next hops of received BGP VPNv4 routes. In this way, PE2 can learn the BGP VPNv4 route originating from PE1 through ABR2 properly, and the route can recurse to the tunnel for traffic forwarding.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family vpnv4
The BGP-VPNv4 address family view is displayed.
- Run bestroute nexthop-resolved none
BGP on the local device is configured to ignore the reachability of the next hops of received BGP VPNv4 routes.
- Run commit
The configuration is committed.
Configuring BGP to Preferentially Select the Routes with Next Hops Recursing to SRv6 TE Policies
Usage Scenario
On the network shown in Figure 1-1805, an SRv6 TE Policy is deployed between PE1 and PE2, and an SRv6 BE tunnel is deployed between PE1 and PE3. PE1 has two routes with the same prefix but different next hops. One of the routes recurses to the SRv6 TE Policy, and the other route recurses to the SRv6 BE tunnel. If services need to be carried over the SRv6 TE Policy, you can configure this function so that BGP compares the types of SRv6 tunnels to which route next hops recurse when selecting the optimal route. Among the routes with next hops recursing to SRv6 Policies, those with next hops recursing to SRv6 TE Policies take precedence over those with next hops recursing to SRv6 BE tunnels.
Procedure
- Run system-view
The system view is displayed.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family unicast
The BGP-IPv4 unicast address family view is displayed.
- Run bestroute nexthop-recursive-priority srv6-te-policy
BGP is configured to compare the types of SRv6 tunnels to which route next hops recurse when selecting the optimal route and preferentially select those with next hops recursing to SRv6 TE Policies over those with next hops recursing to SRv6 BE tunnels.
- Run commit
The configuration is committed.
Configuring BGP to Preferentially Select the Prefix Routes That Are Learned from VPNv4, VPNv6, or EVPN Peers and Are Leaked to a VPN Instance
Usage Scenario
When VPNv4 and EVPN L3VPNv4 services, or VPNv6 and EVPN L3VPNv6 services coexist, a BGP IPv4/IPv6 VPN instance may have two routes with the same prefix but different VPN address family types, with one route learned from a VPNv4 or VPNv6 peer and leaked to a VPN instance, and the other learned from an EVPNv4 or EVPNv6 peer and leaked to a VPN instance. In this case, you can configure BGP to preferentially select either type of the preceding routes.
Procedure
- Run system-view
The system view is displayed.
- Run ip vpn-instance vpn-instance-name
A VPN instance is created and its view is displayed.
- Run ipv4-family
The VPN instance IPv4 address family is enabled, and the view of this address family is displayed.
Or run ipv6-family
The VPN instance IPv6 address family is enabled, and the view of this address family is displayed.
- Run route-distinguisher route-distinguisher
An RD is configured.
- Run vpn-target vpn-target &<1-8> [ both | export-extcommunity | import-extcommunity ]
VPN targets are configured.
- Run quit
Exit the VPN instance IPv4 address family view or VPN instance IPv6 address family view.
- Run quit
Exit the VPN instance view.
- Run bgp as-number
The BGP view is displayed.
- Run ipv4-family vpn-instance vpn-instance-name
The BGP VPN instance IPv4 address family view is displayed.
Or run ipv6-family vpn-instance vpn-instance-name
The BGP VPN instance IPv6 address family view is displayed.
- Perform the following configurations as required:
- To configure BGP to compare the VPN address family types of routes when selecting the optimal route and preferentially select the IPv4 prefix routes leaked from VPNv4 over those leaked from EVPNv4, run the bestroute address-family-priority vpnv4 high-level command in the BGP VPN instance IPv4 address family view.
- To configure BGP to compare the VPN address family types of routes when selecting the optimal route and preferentially select the IPv4 prefix routes leaked from EVPNv4 over those leaked from VPNv4, run the bestroute address-family-priority evpnv4 high-level command in the BGP VPN instance IPv4 address family view.
- To configure BGP to compare the VPN address family types of routes when selecting the optimal route and preferentially select the IPv6 prefix routes leaked from VPNv6 over those leaked from EVPNv6, run the bestroute address-family-priority vpnv6 high-level command.
- To configure BGP to compare the VPN address family types of routes when selecting the optimal route and preferentially select the IPv6 prefix routes leaked from EVPNv6 over those leaked from VPNv6, run the bestroute address-family-priority evpnv6 high-level command.
If there are a large number of BGP IPv4 VPN instances and the bestroute address-family-priority { vpnv4 | evpnv4 } high-level command needs to be run for each instance, you can run the bestroute address-family-priority { vpnv4 | evpnv4 } high-level all-vpn-instance command instead to simplify the configuration because the latter command takes effect for all BGP IPv4 VPN address families.
If there are a large number of BGP IPv6 VPN instances and the bestroute address-family-priority { vpnv6 | evpnv6 } high-level command needs to be run for each instance, you can run the bestroute address-family-priority { vpnv6 | evpnv6 } high-level all-vpn-instance command instead to simplify the configuration because the latter command takes effect for all BGP IPv6 VPN address families.
- Run commit
The configuration is committed.
Verifying the Configuration
- Run the display bgp vpnv4 vpn-instance vpn-instance-name routing-table ipv4-address [ mask-length | mask ] command to check the BGP routes of an IPv4 VPN instance.
- Run the display bgp vpnv6 vpn-instance vpn-instance-name routing-table ipv6-address [ prefix-length ] command to check the BGP routes of an IPv6 VPN instance.
Configuration Examples for BGP
This section provides BGP configuration examples.
Example for Configuring Basic BGP Functions
Before building BGP networks, you need to configure basic BGP functions.
Networking Requirements
If multiple ASs want to access each other, these ASs must exchange their local routes. If multiple routers exist in the ASs, a great deal of routing information will be exchanged between ASs, which consumes lots of bandwidth resources. To address this issue, you can configure basic BGP functions.
In Figure 1-1806, DeviceA is in AS 65008. DeviceB, DeviceC, and DeviceD are in AS 65009. The routing tables of these routers store many routes, and the routes change frequently. After BGP is enabled on the routers, they can exchange routing information. If routes of one router changes, the router sends Update messages carrying only changed routing information to its peers, which greatly reduces bandwidth consumption.
Interfaces 1 through 3 in this example are GE 0/1/0, GE 0/2/0, and GE 0/3/0, respectively.
Device Name |
Interface |
IP Address |
---|---|---|
DeviceA |
Loopback 0 |
1.1.1.1/32 |
GE 0/1/0 |
172.16.0.1/16 |
|
GE 0/2/0 |
192.168.0.1/24 |
|
DeviceB |
Loopback 0 |
2.2.2.2/32 |
GE 0/1/0 |
10.1.1.1/24 |
|
GE 0/2/0 |
192.168.0.2/24 |
|
GE 0/3/0 |
10.1.3.1/24 |
|
DeviceC |
Loopback 0 |
3.3.3.3/32 |
GE 0/2/0 |
10.1.2.1/24 |
|
GE 0/3/0 |
10.1.3.2/24 |
|
DeviceD |
Loopback 0 |
4.4.4.4/32 |
GE 0/1/0 |
10.1.1.2/24 |
|
GE 0/2/0 |
10.1.2.2/24 |
Precautions
When configuring basic BGP functions, note the following rules:
If the peer IP address specified during peer relationship establishment is a loopback interface address or a sub-interface IP address, you need to run the peer connect-interface command on both ends to ensure that the two ends are correctly connected.
If there is no directly connected physical link between EBGP peers, run the peer ebgp-max-hop command to allow EBGP peers to establish TCP connections through multiple hops.
- To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Establish IBGP connections between DeviceB, DeviceC, and DeviceD.
Establish an EBGP connection between DeviceA and DeviceB.
Advertise routes using the network command on DeviceA, and then check the routing tables of DeviceA, DeviceB, and DeviceC.
Configure BGP on DeviceB to import direct routes, and then check the routing tables of DeviceA and DeviceC.
Data Preparation
To complete the configuration, you need the following data:
Router ID and AS number of DeviceA
Router IDs and AS numbers of DeviceB, DeviceC, and DeviceD
Procedure
- Configure an IP address for each interface. For configuration details, see Configuration Files in this section.
- Configure OSPF.
# Configure DeviceB.
[~DeviceB] ospf 1
[*DeviceB-ospf-1] area 0
[*DeviceB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.0] network 10.1.3.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.0] network 2.2.2.2 0.0.0.0
[*DeviceB-ospf-1-area-0.0.0.0] commit
[~DeviceB-ospf-1-area-0.0.0.0] quit
[~DeviceB-ospf-1] quit
# Configure DeviceC.
[~DeviceC] ospf 1
[*DeviceC-ospf-1] area 0
[*DeviceC-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255
[*DeviceC-ospf-1-area-0.0.0.0] network 10.1.3.0 0.0.0.255
[*DeviceC-ospf-1-area-0.0.0.0] network 3.3.3.3 0.0.0.0
[*DeviceC-ospf-1-area-0.0.0.0] commit
[~DeviceC-ospf-1-area-0.0.0.0] quit
[~DeviceC-ospf-1] quit
# Configure DeviceD.
[~DeviceD] ospf 1
[*DeviceD-ospf-1] area 0
[*DeviceD-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[*DeviceD-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255
[*DeviceD-ospf-1-area-0.0.0.0] network 4.4.4.4 0.0.0.0
[*DeviceD-ospf-1-area-0.0.0.0] commit
[~DeviceD-ospf-1-area-0.0.0.0] quit
[~DeviceD-ospf-1] quit
- Configure IBGP connections.
# Configure DeviceB.
[~DeviceB] bgp 65009
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] peer 3.3.3.3 as-number 65009
[*DeviceB-bgp] peer 4.4.4.4 as-number 65009
[*DeviceB-bgp] peer 3.3.3.3 connect-interface LoopBack0
[*DeviceB-bgp] peer 4.4.4.4 connect-interface LoopBack0
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
# Configure DeviceC.
[~DeviceC] bgp 65009
[*DeviceC-bgp] router-id 3.3.3.3
[*DeviceC-bgp] peer 2.2.2.2 as-number 65009
[*DeviceC-bgp] peer 4.4.4.4 as-number 65009
[*DeviceC-bgp] peer 2.2.2.2 connect-interface LoopBack0
[*DeviceC-bgp] peer 4.4.4.4 connect-interface LoopBack0
[*DeviceC-bgp] commit
[~DeviceC-bgp] quit
# Configure DeviceD.
[~DeviceD] bgp 65009
[*DeviceD-bgp] router-id 4.4.4.4
[*DeviceD-bgp] peer 2.2.2.2 as-number 65009
[*DeviceD-bgp] peer 3.3.3.3 as-number 65009
[*DeviceD-bgp] peer 2.2.2.2 connect-interface LoopBack0
[*DeviceD-bgp] peer 3.3.3.3 connect-interface LoopBack0
[*DeviceD-bgp] commit
[~DeviceD-bgp] quit
- Configure an EBGP connection.
# Configure DeviceA.
[~DeviceA] bgp 65008
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] peer 192.168.0.2 as-number 65009
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
# Configure DeviceB.
[~DeviceB] bgp 65009
[*DeviceB-bgp] peer 192.168.0.1 as-number 65008
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
# Check the status of BGP connections.
[~DeviceB] display bgp peer
BGP local router ID : 2.2.2.2
Local AS number : 65009
Total number of peers : 3 Peers in established state : 3
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
3.3.3.3 4 65009 5 5 0 00:44:58 Established 0
4.4.4.4 4 65009 4 4 0 00:40:54 Established 0
192.168.0.1 4 65008 3 3 0 00:44:03 Established 0
The command output shows that DeviceB has established BGP connections with other routers and that the connection status is Established.
- Configure DeviceA to advertise the route to 172.16.0.0/16.
# Configure DeviceA to advertise the route.
[~DeviceA] bgp 65008
[*DeviceA-bgp] ipv4-family unicast
[*DeviceA-bgp-af-ipv4] network 172.16.0.0 255.255.0.0
[*DeviceA-bgp-af-ipv4] network 192.168.0.0 255.255.255.0
[*DeviceA-bgp-af-ipv4] commit
[~DeviceA-bgp-af-ipv4] quit
[~DeviceA-bgp] quit
# Check the routing table of DeviceA.
[~DeviceA] display bgp routing-table
BGP Local router ID is 1.1.1.1
Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V - valid, I - invalid, N - not-found
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 172.16.0.0 0.0.0.0 0 0 i
# Check the routing table of DeviceB.
[~DeviceB] display bgp routing-table
BGP Local router ID is 2.2.2.2
Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V - valid, I - invalid, N - not-found
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 172.16.0.0 192.168.0.1 0 0 65008i
# Check the routing table of DeviceC.
[~DeviceC] display bgp routing-table
BGP Local router ID is 3.3.3.3
Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V - valid, I - invalid, N - not-found
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
i 172.16.0.0 192.168.0.1 0 100 0 65008i
The command output shows that DeviceC has learned the route to 172.16.0.0 from AS 65008. However, this route is invalid because the next hop 192.168.0.1 is unreachable.
- Configure BGP to import direct routes.
# Configure DeviceB.
[~DeviceB] bgp 65009
[*DeviceB-bgp] ipv4-family unicast
[*DeviceB-bgp-af-ipv4] import-route direct
[*DeviceB-bgp-af-ipv4] commit
[~DeviceB-bgp-af-ipv4] quit
[~DeviceB-bgp] quit
# Check the BGP routing table of DeviceA.
[~DeviceA] display bgp routing-table
BGP Local router ID is 1.1.1.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 5 Network NextHop MED LocPrf PrefVal Path/Ogn *> 2.2.2.2/32 192.168.0.2 0 0 65009? *> 172.16.0.0 0.0.0.0 0 0 i *> 10.1.1.0/24 192.168.0.2 0 0 65009? *> 10.1.3.0/24 192.168.0.2 0 0 65009? *> 192.168.0.0 192.168.0.2 0 0 65009?
# Check the routing table of DeviceC.
[~DeviceC] display bgp routing-table
BGP Local router ID is 3.3.3.3 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 5 Network NextHop MED LocPrf PrefVal Path/Ogn i 2.2.2.2/32 2.2.2.2 0 100 0 ? *>i 10.1.1.0/24 2.2.2.2 0 100 0 ? * i 10.1.3.0/24 2.2.2.2 0 100 0 ? *>i 172.16.0.0 192.168.0.1 0 100 0 65008i *>i 192.168.0.0 2.2.2.2 0 100 0 ?
The command output shows that the route to 172.16.0.0 becomes valid and that the next hop is the address of DeviceA.
# Verify the configuration using the ping command.
[~DeviceC] ping 172.16.0.1
PING 172.16.0.1: 56 data bytes, press CTRL_C to break
Reply from 172.16.0.1: bytes=56 Sequence=1 ttl=254 time=31 ms
Reply from 172.16.0.1: bytes=56 Sequence=2 ttl=254 time=47 ms
Reply from 172.16.0.1: bytes=56 Sequence=3 ttl=254 time=31 ms
Reply from 172.16.0.1: bytes=56 Sequence=4 ttl=254 time=16 ms
Reply from 172.16.0.1: bytes=56 Sequence=5 ttl=254 time=31 ms
--- 172.16.0.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 16/31/47 ms
Configuration Files
DeviceA configuration file
#
sysname DeviceA
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 172.16.0.1 255.255.0.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 192.168.0.1 255.255.255.0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
bgp 65008
router-id 1.1.1.1
peer 192.168.0.2 as-number 65009
#
ipv4-family unicast
undo synchronization network 172.16.0.0 255.255.0.0
network 192.168.0.0 255.255.255.0
peer 192.168.0.2 enable
#
return
DeviceB configuration file
sysname DeviceB
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 192.168.0.2 255.255.255.0
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 10.1.3.1 255.255.255.0
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
#
bgp 65009
router-id 2.2.2.2
peer 3.3.3.3 as-number 65009
peer 3.3.3.3 connect-interface LoopBack0
peer 4.4.4.4 as-number 65009
peer 4.4.4.4 connect-interface LoopBack0
peer 192.168.0.1 as-number 65008
#
ipv4-family unicast
undo synchronization import-route direct
peer 3.3.3.3 enable
peer 4.4.4.4 enable
peer 192.168.0.1 enable
#
ospf 1
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.1.3.0 0.0.0.255
#
return
DeviceC configuration file
#
sysname DeviceC
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.2.1 255.255.255.0
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 10.1.3.2 255.255.255.0
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#
bgp 65009
router-id 3.3.3.3
peer 2.2.2.2 as-number 65009
peer 2.2.2.2 connect-interface LoopBack0
peer 4.4.4.4 as-number 65009
peer 4.4.4.4 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization peer 2.2.2.2 enable
peer 4.4.4.4 enable
#
ospf 1
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 10.1.2.0 0.0.0.255
network 10.1.3.0 0.0.0.255
#
return
DeviceD configuration file
#
sysname DeviceD
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.2.2 255.255.255.0
#
interface LoopBack0
ip address 4.4.4.4 255.255.255.255
#
bgp 65009
router-id 4.4.4.4
peer 2.2.2.2 as-number 65009
peer 2.2.2.2 connect-interface LoopBack0
peer 3.3.3.3 as-number 65009
peer 3.3.3.3 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization peer 2.2.2.2 enable
peer 3.3.3.3 enable
#
ospf 1
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.1.2.0 0.0.0.255
#
return
Example for Configuring BGP to Interact with an IGP
Configuring BGP to interact with an IGP can enrich routing tables.
Networking Requirements
As the Internet grows, devices in different networks need to access each other, data needs to be reliably transmitted, and the traffic interruption time needs to be minimized. This requires that routing information be transmitted widely and network convergence be accelerated. BGP can transmit routing information efficiently and widely. BGP, however, does not calculate routes by itself. An IGP can implement rapid route convergence, but it transmits routing information with a low efficiency in a limited scope. After BGP is configured to interact with an IGP, IGP routes can be imported into the BGP routing table and transmitted efficiently. BGP routes can also be imported into the IGP routing table to allow access to other ASs.
The network shown in Figure 1-1807 is divided into AS 65008 and AS 65009. In AS 65009, an IGP is used to calculate routes. In this example, OSPF is used as the IGP. BGP can be configured to enable the two ASs to access each other. Interaction between BGP and the IGP can be configured on edge routers of the two ASs so that the two ASs can exchange routes efficiently. In addition, AS external routes can be imported into the IGP routing table to allow access to the outside of the local AS.
Precautions
To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Configure OSPF on Device B and Device C.
Establish an EBGP connection between Device A and Device B.
Configure BGP and OSPF to import routes from each other on Device B and then check the routes.
Configure BGP route summarization on Device B to simplify the BGP routing table.
Data Preparation
To complete the configuration, you need the following data:
Router ID and AS number of Device A
Router IDs and AS numbers of Device B and Device C
Procedure
- Configure an IP address for each interface. For configuration details, see Configuration Files in this section.
- Configure OSPF.
# Configure Device B.
[~DeviceB] ospf 1
[*DeviceB-ospf-1] area 0
[*DeviceB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.0] commit
[~DeviceB-ospf-1-area-0.0.0.0] quit
[~DeviceB-ospf-1] quit
# Configure Device C.
[~DeviceC] ospf 1
[*DeviceC-ospf-1] area 0
[*DeviceC-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[*DeviceC-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255
[*DeviceC-ospf-1-area-0.0.0.0] commit
[~DeviceC-ospf-1-area-0.0.0.0] quit
[~DeviceC-ospf-1] quit
- Configure an EBGP connection.
# Configure Device A.
[~DeviceA] bgp 65008
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] peer 172.16.1.1 as-number 65009
[*DeviceA-bgp] ipv4-family unicast
[*DeviceA-bgp-af-ipv4] network 192.168.1.0 255.255.255.0
[*DeviceA-bgp-af-ipv4] commit
# Configure Device B.
[~DeviceB] bgp 65009
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] peer 172.16.1.2 as-number 65008
[*DeviceB-bgp] commit
- Configure BGP to interact with an IGP.
# Configure BGP to import OSPF routes on Device B.
[~DeviceB-bgp] ipv4-family unicast
[*DeviceB-bgp-af-ipv4] import-route ospf 1
[*DeviceB-bgp-af-ipv4] commit
[~DeviceB-bgp-af-ipv4] quit
[~DeviceB-bgp] quit
# Check the routing table of Device A.
[~DeviceA] display bgp routing-table
BGP Local router ID is 1.1.1.1
Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V - valid, I - invalid, N - not-found
Total Number of Routes: 3
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 192.168.1.0/24 0.0.0.0 0 0 i
*> 10.1.1.0/24 172.16.1.1 1 0 65009?
*> 10.1.2.0/24 172.16.1.1 2 0 65009?
# Configure OSPF to import BGP routes on Device B.
[~DeviceB] ospf
[*DeviceB-ospf-1] import-route bgp
[*DeviceB-ospf-1] commit
[~DeviceB-ospf-1] quit
# Check the routing table of Device C.
[~DeviceC] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : _public_ Destinations : 12 Routes : 12 Destination/Mask Proto Pre Cost Flags NextHop Interface 192.168.1.0/24 O_ASE 150 1 D 10.1.1.1 GigabitEthernet0/1/0 10.1.1.0/24 Direct 0 0 D 10.1.1.2 GigabitEthernet0/1/0 10.1.1.1/32 Direct 0 0 D 10.1.1.1 GigabitEthernet0/1/0 10.1.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0 10.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0 10.1.2.0/24 Direct 0 0 D 10.1.2.1 GigabitEthernet0/2/0 10.1.2.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/2/0 10.1.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/2/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
- Configure automatic route summarization.
# Configure Device B.
[~DeviceB] bgp 65009
[*DeviceB-bgp] ipv4-family unicast
[*DeviceB-bgp-af-ipv4] summary automatic
[*DeviceB-bgp-af-ipv4] commit
# Check the BGP routing table of Device A.
[~DeviceA] display bgp routing-table
BGP Local router ID is 1.1.1.1
Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V - valid, I - invalid, N - not-found
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 192.168.1.0/24 0.0.0.0 0 0 i
*> 10.0.0.0 172.16.1.1 0 65009?
# Verify the configuration by using the ping command.
[~DeviceA] ping -a 192.168.1.1 10.1.2.1
PING 10.1.2.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.2.1: bytes=56 Sequence=1 ttl=254 time=15 ms
Reply from 10.1.2.1: bytes=56 Sequence=2 ttl=254 time=31 ms
Reply from 10.1.2.1: bytes=56 Sequence=3 ttl=254 time=47 ms
Reply from 10.1.2.1: bytes=56 Sequence=4 ttl=254 time=46 ms
Reply from 10.1.2.1: bytes=56 Sequence=5 ttl=254 time=47 ms
--- 10.1.2.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 15/37/47 ms
Configuration Files
Device A configuration file
#
sysname DeviceA
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.1.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 172.16.1.2 255.255.255.0
#
bgp 65008
router-id 1.1.1.1
peer 172.16.1.1 as-number 65009
#
ipv4-family unicast
undo synchronization network 192.168.1.0 255.255.255.0
peer 172.16.1.1 enable
#
return
Device B configuration file
#
sysname DeviceB
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 172.16.1.1 255.255.255.0
#
bgp 65009
router-id 2.2.2.2
peer 172.16.1.2 as-number 65008
#
ipv4-family unicast
undo synchronization summary automatic
import-route ospf 1
peer 172.16.1.2 enable
#
ospf 1
import-route bgp
area 0.0.0.0
network 10.1.1.0 0.0.0.255
#
return
Device C configuration file
#
sysname DeviceC
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.2.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.1.2.0 0.0.0.255
#
return
Example for Configuring the MED Attribute to Control Route Selection
By setting the MED attribute, you can flexibly control BGP route selection.
Networking Requirements
The MED attribute equals a metric used in an IGP, and is used to determine the optimal route for traffic that enters an AS. When a BGP device obtains multiple routes to the same destination address but with different next hops from EBGP peers, the route with the smallest MED value is selected as the optimal route.
On the network shown in Figure 1-1808, BGP is configured on all routers, routerA is in AS 65008, and routerB and routerC are in AS 65009. In addition, routerA establishes EBGP connections with routerB and routerC, whereas routerB establishes an IBGP connection with routerC. Traffic sent by routerA to 172.16.1.0 can enter AS 65009 through routerB or routerC. If other conditions are the same, you can configure routerB or routerC to change the MED value of the route advertised to routerA to select the ingress for traffic to enter AS 65009.
Precautions
To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Establish EBGP connections between Device A and Device B, and between Device A and Device C, and establish an IBGP connection between Device B and Device C.
- Apply a routing policy to increase the MED value of the route sent by Device B to Device A so that Device A will send traffic to AS 65009 through Device C.
Data Preparation
To complete the configuration, you need the following data:
- Router ID 1.1.1.1 and AS number 65008 of Device A
- Router IDs 2.2.2.2 and 3.3.3.3, and AS number 65009 of Devices B and C
- New MED value 100 of the route on Device B
Procedure
- Configure an IP address for each interface. For configuration details, see Configuration Files in this section.
- Configure BGP connections.
# Configure Device A.
[~DeviceA] bgp 65008
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] peer 10.1.1.1 as-number 65009
[*DeviceA-bgp] peer 10.1.2.1 as-number 65009
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
# Configure Device B.
[~DeviceB] bgp 65009
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] peer 10.1.1.2 as-number 65008
[*DeviceB-bgp] peer 172.16.1.2 as-number 65009
[*DeviceB-bgp] ipv4-family unicast
[*DeviceB-bgp-af-ipv4] network 172.16.1.0 255.255.255.0
[*DeviceB-bgp-af-ipv4] commit
[~DeviceB-bgp-af-ipv4] quit
[~DeviceB-bgp] quit
# Configure Device C.
[~DeviceC] bgp 65009
[*DeviceC-bgp] router-id 3.3.3.3
[*DeviceC-bgp] peer 10.1.2.2 as-number 65008
[*DeviceC-bgp] peer 172.16.1.1 as-number 65009
[*DeviceC-bgp] ipv4-family unicast
[*DeviceC-bgp-af-ipv4] network 172.16.1.0 255.255.255.0
[*DeviceC-bgp-af-ipv4] commit
[~DeviceC-bgp-af-ipv4] quit
[~DeviceC-bgp] quit
# Check the routing table of Device A.
[~DeviceA] display bgp routing-table 172.16.1.0 24 BGP local router ID : 1.1.1.1 Local AS number : 65008 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 172.16.1.0/24: From: 10.1.1.1 (2.2.2.2) Route Duration: 0d00h00m56s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.1.1 Qos information : 0x0 AS-path 65009, origin igp, MED 0, pref-val 0, valid, external, best, select, pre 255 Advertised to such 2 peers: 10.1.1.1 10.1.2.1 BGP routing table entry information of 172.16.1.0/24: From: 10.1.2.1 (3.3.3.3) Route Duration: 0d00h00m06s Direct Out-interface: GigabitEthernet0/2/0 Original nexthop: 10.1.2.1 Qos information : 0x0 AS-path 65009, origin igp, MED 0, pref-val 0, valid, external, pre 255, not preferred for router ID Not advertised to any peers yet
The command output shows that there are two valid routes to 172.16.1.0/24. The route with 10.1.1.1 as the next hop is the optimal route because the router ID of Device B is smaller.
- Configure the MED attribute.
# Set the MED value for the route sent by Device B to Device A based on a routing policy.
[~DeviceB] route-policy 10 permit node 10
[*DeviceB-route-policy] apply cost 100
[*DeviceB-route-policy] commit
[~DeviceB-route-policy] quit
[~DeviceB] bgp 65009
[*DeviceB-bgp] ipv4-family unicast
[*DeviceB-bgp-af-ipv4] peer 10.1.1.2 route-policy 10 export
[~DeviceB-bgp-af-ipv4] commit
# Check the routing table of Device A.
[~DeviceA] display bgp routing-table 172.16.1.0 24 BGP local router ID : 1.1.1.1 Local AS number : 65008 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 172.16.1.0/24: From: 10.1.2.1 (3.3.3.3) Route Duration: 0d00h07m45s Direct Out-interface: GigabitEthernet0/2/0 Original nexthop: 10.1.2.1 Qos information : 0x0 AS-path 65009, origin igp, MED 0, pref-val 0, valid, external, best, select, pre 255 Advertised to such 2 peers: 10.1.1.1 10.1.2.1 BGP routing table entry information of 172.16.1.0/24: From: 10.1.1.1 (2.2.2.2) Route Duration: 0d00h00m08s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.1.1 Qos information : 0x0 AS-path 65009, origin igp, MED 100, pref-val 0, valid, external, pre 255, not preferred for MED Not advertised to any peers yet
The command output shows that the MED value of the next hop 10.1.1.1 (Device B) is 100 and that the MED value of the next hop 10.1.2.1 is 0. Therefore, the route with the smaller MED value is selected.
Configuration Files
Device A configuration file
#
sysname DeviceA
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.2.2 255.255.255.0
#
bgp 65008
router-id 1.1.1.1
peer 10.1.1.1 as-number 65009
peer 10.1.2.1 as-number 65009
#
ipv4-family unicast
peer 10.1.1.1 enable
peer 10.1.2.1 enable
#
return
Device B configuration file
#
sysname DeviceB
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 172.16.1.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
#
bgp 65009
router-id 2.2.2.2
peer 172.16.1.2 as-number 65009
peer 10.1.1.2 as-number 65008
#
ipv4-family unicast
undo synchronization network 172.16.1.0 255.255.255.0
peer 172.16.1.2 enable
peer 10.1.1.2 enable
peer 10.1.1.2 route-policy 10 export
#
route-policy 10 permit node 10
apply cost 100
#
return
Device C configuration file
#
sysname DeviceC
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 172.16.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.2.1 255.255.255.0
#
bgp 65009
router-id 3.3.3.3
peer 172.16.1.1 as-number 65009
peer 10.1.2.2 as-number 65008
#
ipv4-family unicast
undo synchronization network 172.16.1.0 255.255.255.0
peer 172.16.1.1 enable
peer 10.1.2.2 enable
#
return
Example for Configuring an AS_Path Filter
AS_Path filters can be used to improve network performance.
Networking Requirements
Enterprises A, B, and C belong to different ASs. The network of enterprise B communicates with the networks of the other two enterprises through EBGP. Due to the competition relationship, enterprises A and C require that the routes that they advertise to enterprise B be not learned by each other. In this situation, configure an AS_Path filter on enterprise B.
In Figure 1-1809, Device B establish EBGP connections with Devices A and C. To disable devices in AS 10 from communicating with devices in AS 30, you can configure an AS_Path filter on Device B to prevent devices in AS 20 from advertising routes of AS 30 to AS 10 or routes of AS 10 to AS 30.
Precautions
During the configuration process, note the following:
The relationship between multiple filtering rules in the same filter is OR.
- To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Establish EBGP connections between Device A and Device B, and between Device B and Device C, and then import direct routes.
Configure an AS_Path filter on Device B and then apply its filtering rules.
Data Preparation
To complete the configuration, you need the following data:
Router IDs and AS numbers of Device A, Device B, and Device C
Number of the AS_Path filter
Procedure
- Configure an IP address for each interface. For configuration details, see Configuration Files in this section.
- Configure EBGP connections.
# Configure Device A.
[~DeviceA] bgp 10
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] peer 10.1.2.2 as-number 20
[*DeviceA-bgp] import-route direct
[*DeviceA-bgp] commit
# Configure Device B.
[*DeviceB] bgp 20
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] peer 10.1.2.1 as-number 10
[*DeviceB-bgp] peer 10.1.3.2 as-number 30
[*DeviceB-bgp] import-route direct
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
# Configure Device C.
[~DeviceC] bgp 30
[*DeviceC-bgp] router-id 3.3.3.3
[*DeviceC-bgp] peer 10.1.3.1 as-number 20
[*DeviceC-bgp] import-route direct
[*DeviceC-bgp] commit
[~DeviceC-bgp] quit
# Display the routing table advertised by Device B. Use the routes advertised by Device B to Device C as an example. You can view that Device B advertises the routes destined for the network segment between Device A and Device C.
<DeviceB> display bgp routing-table peer 10.1.3.2 advertised-routes
BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 3 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.1.2.0/24 10.1.3.1 0 0 20? *> 10.1.3.0/24 10.1.3.1 0 0 20? *> 10.1.4.0/24 10.1.3.1 0 0 20 10?
Check the routing table of Device C. The command output shows that Device C has learned the two routes advertised by Device B.
<DeviceC> display bgp routing-table
BGP Local router ID is 3.3.3.3 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 7 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.1.2.0/24 10.1.3.1 0 0 20? *> 10.1.3.0/24 0.0.0.0 0 0 ? 10.1.3.1 0 0 20? *> 10.1.3.2/32 0.0.0.0 0 0 ? *> 10.1.4.0/24 0.0.0.0 0 0 ? * 10.1.3.1 0 20 10? *> 10.1.4.2/32 0.0.0.0 0 0 ?
- Configure the AS_Path filter on Device B and then apply the filter on the outbound interface of Device B.
# Create AS_Path filter 1 to deny the routes carrying AS 30. The regular expression "_30_" indicates any AS list that contains AS 30 and "*" matches any character.
[~DeviceB] ip as-path-filter 1 deny _30_
[*DeviceB] ip as-path-filter 1 permit .*
[*DeviceB] commit
# Create AS_Path filter 2 to deny the routes carrying AS 10. The regular expression "_10_" indicates any AS list that contains AS 10 and "*" matches any character.
[~DeviceB] ip as-path-filter 2 deny _10_
[*DeviceB] ip as-path-filter 2 permit .*
[*DeviceB] commit
# Apply the AS_Path filter on two outbound interfaces of Device B.
[~DeviceB] bgp 20
[*DeviceB-bgp] peer 10.1.2.1 as-path-filter 1 export
[*DeviceB-bgp] peer 10.1.3.2 as-path-filter 2 export
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
- Verify the configuration.
# Display the routing table advertised by Device B. The command output shows that the advertised routes to the network segment between Device A and Device C do not exist. Use the routes advertised by Device B to Device C as an example.
<DeviceB> display bgp routing-table peer 10.1.3.2 advertised-routes
BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 2 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.1.2.0/24 10.1.3.1 0 0 20? *> 10.1.3.0/24 10.1.3.1 0 0 20?
Similarly, the BGP routing table of Device C does not have these routes.
<DeviceC> display bgp routing-table
BGP Local router ID is 3.3.3.3 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 6 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.1.2.0/24 10.1.3.1 0 0 20? *> 10.1.3.0/24 0.0.0.0 0 0 ? 10.1.3.1 0 0 20? *> 10.1.3.2/32 0.0.0.0 0 0 ? *> 10.1.4.0/24 0.0.0.0 0 0 ? *> 10.1.4.2/32 0.0.0.0 0 0 ?
Check the routing table advertised by Device B, and you can view that the advertised routes to the network segment between Device A and Device C do not exist. Use the routes advertised by Device B to Device A as an example.
<DeviceB> display bgp routing-table peer 10.1.2.1 advertised-routes
BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 2 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.1.2.0/24 10.1.2.2 0 0 20? *> 10.1.3.0/24 10.1.2.2 0 0 20?
Similarly, the BGP routing table of Device A does not have these routes.
<DeviceA> display bgp routing-table
BGP Local router ID is 1.1.1.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 6 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.1.2.0/24 0.0.0.0 0 0 ? 10.1.2.2 0 0 20? *> 10.1.2.1/32 0.0.0.0 0 0 ? *> 10.1.3.0/24 10.1.2.2 0 0 20? *> 10.1.4.0/24 0.0.0.0 0 0 ? *> 10.1.4.1/32 0.0.0.0 0 0 ?
Configuration Files
Device A configuration file
#
sysname DeviceA
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.4.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.2.1 255.255.255.0
#
bgp 10
router-id 1.1.1.1
peer 10.1.2.2 as-number 20
#
ipv4-family unicast
undo synchronization import-route direct
peer 10.1.2.2 enable
#
return
Device B configuration file
#
sysname DeviceB
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.3.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.2.2 255.255.255.0
#
bgp 20
router-id 2.2.2.2
peer 10.1.2.1 as-number 10
peer 10.1.3.2 as-number 30
#
ipv4-family unicast
undo synchronization import-route direct
peer 10.1.2.1 enable
peer 10.1.2.1 as-path-filter 1 export
peer 10.1.3.2 enable
peer 10.1.3.2 as-path-filter 2 export
#
ip as-path-filter 1 deny _30_
ip as-path-filter 1 permit .*
ip as-path-filter 2 deny _10_
ip as-path-filter 2 permit .*
#
return
Device C configuration file
#
sysname DeviceC
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.4.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.3.2 255.255.255.0
#
bgp 30
router-id 3.3.3.3
peer 10.1.3.1 as-number 20
#
ipv4-family unicast
undo synchronization import-route direct
peer 10.1.3.1 enable
#
return
Example for Configuring BGP RRs
With BGP RRs, IBGP peers do not have to be fully meshed, which reduces configuration workload and facilitates network maintenance.
Networking Requirements
On a large-scale network, multiple routers that run BGP are deployed within an AS. These routers need to use BGP to advertise routes to each other. To meet this need, IBGP peer relationships need to be set up between all the routers. However, fully meshed connections between all routers increase router costs and the configuration workload and are difficult to maintain. A solution that can simplify network configuration and reduce router costs without affecting route transmission is required.
To address this issue, configure RRs. In Figure 1-1810, AS 65010 is divided into two clusters: Cluster 1 and Cluster 2. DeviceB is configured as an RR in Cluster 1, and DeviceD and DeviceE are its clients. DeviceC is configured as an RR in Cluster 2, and DeviceF, DeviceG, and DeviceH are its clients. DeviceA is the non-client of DeviceB and DeviceC. DeviceB and DeviceC are non-clients of each other.
Interfaces 1 through 5 in this example represent GE 0/1/0, GE 0/2/0, GE 0/3/0, GE 0/1/1, and GE 0/1/2, respectively.
Device |
Interface |
IP Address |
Device |
Interface |
IP Address |
---|---|---|---|---|---|
Device A |
GE 0/3/0 |
172.16.1.1/24 |
Device C |
GE 0/1/1 |
10.1.8.1/24 |
GE 0/1/0 |
10.1.1.2/24 |
GE 0/1/2 |
10.1.9.1/24 |
||
GE 0/2/0 |
10.1.3.2/24 |
Device D |
GE 0/1/0 |
10.1.4.2/24 |
|
Device B |
GE 0/1/0 |
10.1.1.1/24 |
GE 0/2/0 |
10.1.6.1/24 |
|
GE 0/2/0 |
10.1.4.1/24 |
Device E |
GE 0/2/0 |
10.1.6.2/24 |
|
GE 0/3/0 |
10.1.5.1/24 |
GE 0/3/0 |
10.1.5.2/24 |
||
GE 0/1/1 |
10.1.2.1/24 |
Device F |
GE 0/1/0 |
10.1.7.2/24 |
|
Device C |
GE 0/1/0 |
10.1.2.2/24 |
Device G |
GE 0/1/0 |
10.1.8.2/24 |
GE 0/2/0 |
10.1.3.1/24 |
Device H |
GE 0/2/0 |
10.1.9.2/24 |
|
GE 0/3/0 |
10.1.7.1/24 |
Precautions
When configuring a BGP RR, note the following rules:
If a cluster has multiple RRs, run the reflector cluster-id command to set the same cluster ID for these RRs to prevent routing loops.
The name of a peer group is case sensitive.
- To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Configure IBGP connections between the clients and the RR, and between the non-client and the RR.
Configure Device B and Device C as RRs, specify their clients, and check routes.
Data Preparation
To complete the configuration, you need the following data:
Router IDs and AS numbers of Device A, Device B, Device C, Device D, Device E, Device F, Device G, and Device H
Cluster ID of Device B
Procedure
- Configure an IP address for each interface. For configuration details, see Configuration Files in this section.
- Configure IBGP connections between the clients and the RR, and between the non-client and the RR.
- Configure RRs.
# Configure Device B.
[~DeviceB] bgp 65010
[*DeviceB–bgp] router-id 2.2.2.2
[*DeviceB–bgp] group in_rr internal
[*DeviceB–bgp] peer 10.1.4.2 group in_rr
[*DeviceB–bgp] peer 10.1.5.2 group in_rr
[*DeviceB–bgp] ipv4-family unicast
[*DeviceB–bgp-af-ipv4] peer in_rr reflect-client
[*DeviceB–bgp-af-ipv4] undo reflect between-clients
[*DeviceB–bgp-af-ipv4] reflector cluster-id 1
[*DeviceB–bgp-af-ipv4] commit
[~DeviceB–bgp-af-ipv4] quit
# Configure Device C.
[~DeviceC] bgp 65010
[*DeviceC-bgp] router-id 3.3.3.3
[*DeviceC-bgp] group in_rr internal
[*DeviceC-bgp] peer 10.1.7.2 group in_rr
[*DeviceC-bgp] peer 10.1.8.2 group in_rr
[*DeviceC-bgp] peer 10.1.9.2 group in_rr
[*DeviceC-bgp] ipv4-family unicast
[*DeviceC-bgp-af-ipv4] peer in_rr reflect-client
[*DeviceC-bgp-af-ipv4] reflector cluster-id 2
[*DeviceC-bgp-af-ipv4] commit
[~DeviceC-bgp-af-ipv4] quit
# Check the routing table of Device D.
[~DeviceD] display bgp routing-table 172.16.1.0
BGP local router ID : 4.4.4.4 Local AS number : 65010 Paths: 1 available, 0 best, 0 select BGP routing table entry information of 172.16.1.0/24: From: 10.1.4.1 (2.2.2.2) Route Duration: 00h00m14s Relay IP Nexthop: 0.0.0.0 Relay IP Out-Interface: Original nexthop: 10.1.1.2 Qos information : 0x0 AS-path Nil, origin igp, MED 0, localpref 100, pref-val 0, internal, pre 255 Originator: 1.1.1.1 Cluster list: 0.0.0.1 Not advertised to any peer yet
The command output shows that Device D has learned from Device B the route advertised by Device A and that the Originator and Cluster_ID attributes of this route are displayed.
Configuration Files
Device A configuration file
#
sysname DeviceA
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.3.2 255.255.255.0
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 172.16.1.1 255.255.255.0
#
bgp 65010
router-id 1.1.1.1
peer 10.1.1.1 as-number 65010
peer 10.1.3.1 as-number 65010
#
ipv4-family unicast
undo synchronization network 172.16.1.0 255.255.255.0
peer 10.1.1.1 enable
peer 10.1.3.1 enable
#
return
Device B configuration file
#
sysname DeviceB
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.4.1 255.255.255.0
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 10.1.5.1 255.255.255.0
#
interface GigabitEthernet0/1/1
undo shutdown
ip address 10.1.2.1 255.255.255.0
#
bgp 65010
router-id 2.2.2.2
peer 10.1.1.2 as-number 65010
peer 10.1.2.2 as-number 65010
group in_rr internal
peer 10.1.4.2 as-number 65010
peer 10.1.4.2 group in_rr
peer 10.1.5.2 as-number 65010
peer 10.1.5.2 group in_rr
#
ipv4-family unicast
undo synchronization undo reflect between-clients
reflector cluster-id 1
peer 10.1.1.2 enable
peer 10.1.2.2 enable
peer in_rr enable
peer in_rr reflect-client
peer 10.1.4.2 enable
peer 10.1.4.2 group in_rr
peer 10.1.5.2 enable
peer 10.1.5.2 group in_rr
#
return
Device C configuration file
#
sysname DeviceC
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.2.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.3.1 255.255.255.0
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 10.1.7.1 255.255.255.0
#
interface GigabitEthernet0/1/1
undo shutdown
ip address 10.1.8.1 255.255.255.0
#
interface GigabitEthernet0/1/2
undo shutdown
ip address 10.1.9.1 255.255.255.0
#
bgp 65010
router-id 3.3.3.3
peer 10.1.2.1 as-number 65010
peer 10.1.3.2 as-number 65010
group in_rr internal
peer 10.1.7.2 as-number 65010
peer 10.1.7.2 group in_rr
peer 10.1.8.2 as-number 65010
peer 10.1.8.2 group in_rr
peer 10.1.9.2 as-number 65010
peer 10.1.9.2 group in_rr
#
ipv4-family unicast
undo synchronization reflector cluster-id 2
peer 10.1.2.1 enable
peer 10.1.3.2 enable
peer in_rr enable
peer in_rr reflect-client
peer 10.1.7.2 enable
peer 10.1.7.2 group in_rr
peer 10.1.8.2 enable
peer 10.1.8.2 group in_rr
peer 10.1.9.2 enable
peer 10.1.9.2 group in_rr
#
return
Device D configuration file
#
sysname DeviceD
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.4.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.6.1 255.255.255.0
#
bgp 65010
router-id 4.4.4.4
peer 10.1.4.1 as-number 65010
#
ipv4-family unicast
undo synchronization peer 10.1.4.1 enable
#
return
Configuration files of other routers are similar to the Device D configuration file.
Example for Configuring a BGP Confederation
BGP confederations can be used to reduce the number of IBGP connections.
Networking Requirements
If multiple devices are deployed in an AS and fully meshed IBGP connections must be implemented between every two devices in the AS, a large number of IBGP connections will be established, increasing operation and maintenance costs. To address this issue, configure BGP confederations.
In Figure 1-1811, to implement interworking between devices in AS 200, full-mesh IBGP connections need to be established between the devices. However, because multiple routers run BGP in AS 200, the cost for establishing a fully meshed network is high. To reduce the number of IBGP connections to be established, you can configure the confederation function on the devices in AS 200. The confederation solution can deal with the increase of IBGP connections in an AS. As shown in Figure 1-1811, AS 200 is divided into three sub-ASs: AS 65001, AS 65002, and AS 65003. AS 65001 establishes confederation EBGP peer relationships with AS 65002 and AS 65003. The three routers in AS 65001 establish IBGP fully meshed connections. This greatly reduces the number of IBGP connections to be established in AS 200 and reduces O&M costs.
Precautions
To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Configure a BGP confederation on each router in AS 200.
Configure the IBGP connection in AS 65001.
Configure the EBGP connection between AS 100 and AS 200, and check the routes.
Data Preparation
To complete the configuration, you need the following data:
The Router IDs of DeviceA, DeviceB, DeviceC, DeviceD, DeviceE, and DeviceF (1.1.1.1, 2.2.2.2, 3.3.3.3, 4.4.4.4, 5.5.5.5, and 6.6.6.6)
The AS number (100), and the three sub-ASs of AS 200 (AS 65001, AS 65002, and AS 65003)
Procedure
- Assign an IP address to each interface.
For configuration details, see Configuration Files in this section.
- Configure the BGP confederation.
# Configure DeviceA.
[~DeviceA] bgp 65001
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] confederation id 200
[*DeviceA-bgp] confederation peer-as 65002 65003
[*DeviceA-bgp] peer 10.1.1.2 as-number 65002
[*DeviceA-bgp] peer 10.1.2.2 as-number 65003
[*DeviceA-bgp] ipv4-family unicast
[*DeviceA-bgp-af-ipv4] peer 10.1.1.2 next-hop-local
[*DeviceA-bgp-af-ipv4] peer 10.1.2.2 next-hop-local
[*DeviceA-bgp-af-ipv4] commit
[~DeviceA-bgp-af-ipv4] quit
[~DeviceA-bgp] quit
# Configure DeviceB.
[~DeviceB] bgp 65002
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] confederation id 200
[*DeviceB-bgp] confederation peer-as 65001
[*DeviceB-bgp] peer 10.1.1.1 as-number 65001
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
# Configure DeviceC.
[~DeviceC] bgp 65003
[*DeviceC-bgp] router-id 3.3.3.3
[*DeviceC-bgp] confederation id 200
[*DeviceC-bgp] confederation peer-as 65001
[*DeviceC-bgp] peer 10.1.2.1 as-number 65001
[*DeviceC-bgp] commit
[~DeviceC-bgp] quit
- Configure IBGP connections inside AS 65001.
# Configure DeviceA.
[~DeviceA] bgp 65001
[*DeviceA-bgp] peer 10.1.3.2 as-number 65001
[*DeviceA-bgp] peer 10.1.4.2 as-number 65001
[*DeviceA-bgp] ipv4-family unicast
[*DeviceA-bgp-af-ipv4] peer 10.1.3.2 next-hop-local
[*DeviceA-bgp-af-ipv4] peer 10.1.4.2 next-hop-local
[*DeviceA-bgp-af-ipv4] commit
[~DeviceA-bgp-af-ipv4] quit
[~DeviceA-bgp] quit
# Configure DeviceD.
[~DeviceD] bgp 65001
[*DeviceD-bgp] router-id 4.4.4.4
[*DeviceD-bgp] confederation id 200
[*DeviceD-bgp] peer 10.1.3.1 as-number 65001
[*DeviceD-bgp] peer 10.1.5.2 as-number 65001
[*DeviceD-bgp] commit
[~DeviceD-bgp] quit
# Configure DeviceE.
[~DeviceE] bgp 65001
[*DeviceE-bgp] router-id 5.5.5.5
[*DeviceE-bgp] confederation id 200
[*DeviceE-bgp] peer 10.1.4.1 as-number 65001
[*DeviceE-bgp] peer 10.1.5.1 as-number 65001
[*DeviceE-bgp] commit
[~DeviceE-bgp] quit
- Configure the EBGP connection between AS 100 and AS 200.
# Configure DeviceA.
[~DeviceA] bgp 65001
[*DeviceA-bgp] peer 10.216.1.2 as-number 100
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
# Configure DeviceF.
[~DeviceF] bgp 100
[*DeviceF-bgp] router-id 6.6.6.6
[*DeviceF-bgp] peer 10.216.1.1 as-number 200
[*DeviceF-bgp] ipv4-family unicast
[*DeviceF-bgp-af-ipv4] network 192.168.1.0 255.255.255.0
[*DeviceF-bgp-af-ipv4] commit
[~DeviceF-bgp-af-ipv4] quit
[~DeviceF-bgp] quit
- Verify the configuration.
# Check the BGP routing table of DeviceB.
[~DeviceB] display bgp routing-table
BGP Local router ID is 2.2.2.2
Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V - valid, I - invalid, N - not-found
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 192.168.1.0/24 10.1.1.1 0 100 0 (65001) 100i
[~DeviceB] display bgp routing-table 192.168.1.0
BGP local router ID : 2.2.2.2 Local AS number : 65002 Paths: 1 available, 1 best, 1 select BGP routing table entry information of 192.168.1.0/24: From: 10.1.1.1 (1.1.1.1) Route Duration: 00h12m29s Relay IP Nexthop: 0.0.0.0 Relay IP Out-Interface: GigabitEthernet0/1/0 Original nexthop: 10.1.1.1 Qos information : 0x0 AS-path (65001) 100, origin igp, MED 0, localpref 100, pref-val 0, valid, external-confed, best, select, active, pre 255 Not advertised to any peer yet
# Check the BGP routing table of DeviceD.
[~DeviceD] display bgp routing-table
BGP Local router ID is 4.4.4.4
Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V - valid, I - invalid, N - not-found
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 192.168.1.0/24 10.1.3.1 0 100 0 100i
[~DeviceD] display bgp routing-table 192.168.1.0
BGP local router ID : 4.4.4.4 Local AS number : 65001 Paths: 1 available, 1 best, 1 select BGP routing table entry information of 192.168.1.0/24: From: 10.1.3.1 (1.1.1.1) Route Duration: 00h23m57s Relay IP Nexthop: 0.0.0.0 Relay IP Out-Interface: GigabitEthernet0/1/0 Original nexthop: 10.1.3.1 Qos information : 0x0 AS-path 100, origin igp, MED 0, localpref 100, pref-val 0, valid, internal-confed, best, select, active, pre 255 Not advertised to any peer yet
Configuration Files
DeviceA configuration file
#
sysname DeviceA
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.216.1.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 10.1.2.1 255.255.255.0
#
interface GigabitEthernet0/1/1
undo shutdown
ip address 10.1.3.1 255.255.255.0
#
interface GigabitEthernet0/1/2
undo shutdown
ip address 10.1.4.1 255.255.255.0
#
bgp 65001
router-id 1.1.1.1
confederation id 200
confederation peer-as 65002 65003
peer 10.1.1.2 as-number 65002
peer 10.1.2.2 as-number 65003
peer 10.1.3.2 as-number 65001
peer 10.1.4.2 as-number 65001
peer 10.216.1.2 as-number 100
#
ipv4-family unicast
undo synchronization peer 10.216.1.2 enable
peer 10.1.1.2 enable
peer 10.1.1.2 next-hop-local
peer 10.1.2.2 enable
peer 10.1.2.2 next-hop-local
peer 10.1.3.2 enable
peer 10.1.3.2 next-hop-local
peer 10.1.4.2 enable
peer 10.1.4.2 next-hop-local
#
return
DeviceB configuration file
#
sysname DeviceB
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.2 255.255.255.0
#
bgp 65002
router-id 2.2.2.2
confederation id 200
confederation peer-as 65001
peer 10.1.1.1 as-number 65001
#
ipv4-family unicast
undo synchronization peer 10.1.1.1 enable
#
return
The configuration file of DeviceC is similar to that of DeviceB.
DeviceD configuration file
#
sysname DeviceD
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.3.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.5.1 255.255.255.0
#
bgp 65001
router-id 4.4.4.4
confederation id 200
peer 10.1.3.1 as-number 65001
peer 10.1.5.2 as-number 65001
#
ipv4-family unicast
undo synchronization peer 10.1.3.1 enable
peer 10.1.5.2 enable
#
return
The configuration file of DeviceE is similar to that of DeviceD.
DeviceF configuration file
#
sysname DeviceF
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.216.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 192.168.1.1 255.255.255.0
#
bgp 100
router-id 6.6.6.6
peer 10.216.1.1 as-number 200
#
ipv4-family unicast
undo synchronization network 192.168.1.0 255.255.255.0
peer 10.216.1.1 enable
#
return
Example for Configuring the BGP Community Attribute
By setting the community attribute, you can flexibly control BGP route selection.
Networking Requirements
Enterprises A, B, and C belong to different ASs, and enterprise B's network communicates with the networks of the other two enterprises through EBGP connections. Enterprise A and C are rivals, and enterprise A requires that the routes it sends to enterprise B be transmitted only within enterprise B. In this situation, you can configure the community attribute on the router in enterprise A that sends routes to enterprise B.
In Figure 1-1812, EBGP connections are established between Device B and Device A, and between Device B and Device C. It is required that the routes advertised from AS 10 to AS 20 are not advertised to other ASs by AS 20. In this situation, configure the community attribute No_Export on Device A.
Precautions
To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Establish EBGP connections between Device A andDevice B, and between Device B and Device C.
Configure a routing policy on Device A to advertise the community attribute No_Export.
Data Preparation
To complete the configuration, you need the following data:
Router ID and AS number of Device A
Router ID and AS number of Device B
Router ID and AS number of Device C
Procedure
- Configure an IP address for each interface. For configuration details, see Configuration Files in this section.
- Configure EBGP connections.
# Configure Device A.
[~DeviceA] bgp 10
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] peer 10.1.2.2 as-number 20
[*DeviceA-bgp] ipv4-family unicast
[*DeviceA-bgp-af-ipv4] network 10.5.1.0 255.255.255.0
[*DeviceA-bgp-af-ipv4] commit
[~DeviceA-bgp-af-ipv4] quit
# Configure Device B.
[~DeviceB] bgp 20
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] peer 10.1.2.1 as-number 10
[*DeviceB-bgp] peer 10.1.3.2 as-number 30
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
# Configure Device C.
[~DeviceC] bgp 30
[*DeviceC-bgp] router-id 3.3.3.3
[*DeviceC-bgp] peer 10.1.3.1 as-number 20
[*DeviceC-bgp] commit
[~DeviceC-bgp] quit
# Check the routing table of Device B.
[~DeviceB] display bgp routing-table 10.5.1.0
BGP local router ID : 2.2.2.2 Local AS number : 20 Paths: 1 available, 1 best, 1 select BGP routing table entry information of 10.5.1.0/24: From: 10.1.2.1 (1.1.1.1) Route Duration: 0d00h00m37s Direct Out-interface: GigabitEthernet0/2/0 Original nexthop: 10.1.2.1 Qos information : 0x0 AS-path 10, origin igp, MED 0, pref-val 0, valid, external, best, select, pre 255 Advertised to such 2 peers: 10.1.2.1 10.1.3.2
The command output shows that Device B advertises the received routes to Device C in AS 30.
# Check the routing table of Device C.
[~DeviceC] display bgp routing-table
BGP Local router ID is 3.3.3.3
Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V - valid, I - invalid, N - not-found
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 10.5.1.0/24 10.1.3.1 0 20 10i
In the routing table, you can view that Device C learns the route to 10.5.1.0/24 from Device B.
- Configure the BGP community attribute.
# Configure a routing policy on Device A to ensure that the routes advertised by Device A to Device B are not advertised by Device B to any other AS.
[~DeviceA] route-policy comm_policy permit node 10
[*DeviceA-route-policy] apply community no-export
[*DeviceA-route-policy] commit
[~DeviceA-route-policy] quit
# Apply the routing policy.
[~DeviceA] bgp 10
[*DeviceA-bgp] ipv4-family unicast
[*DeviceA-bgp-af-ipv4] peer 10.1.2.2 route-policy comm_policy export
[*DeviceA-bgp-af-ipv4] peer 10.1.2.2 advertise-community
[*DeviceA-bgp-af-ipv4] commit
# Check the routing table of Device B.
[~DeviceB] display bgp routing-table 10.5.1.0
BGP local router ID : 2.2.2.2 Local AS number : 20 Paths: 1 available, 1 best, 1 select BGP routing table entry information of 10.5.1.0/24: From: 10.1.2.1 (1.1.1.1) Route Duration: 0d00h00m12s Direct Out-interface: GigabitEthernet0/2/0 Original nexthop: 10.1.2.1 Qos information : 0x0 Community:no-export AS-path 10, origin igp, MED 0, pref-val 0, valid, external, best, select, pre 255 Not advertised to any peers yet
The command output on DeviceB shows the configured community attribute and that the route to 10.5.1.0/24 has not been advertised to DeviceC.
Configuration Files
Device A configuration file
#
sysname DeviceA
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.5.1.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.2.1 255.255.255.0
#
bgp 10
router-id 1.1.1.1
peer 10.1.2.2 as-number 20
#
ipv4-family unicast
undo synchronization network 10.5.1.0 255.255.255.0
peer 10.1.2.2 enable
peer 10.1.2.2 route-policy comm_policy export
peer 10.1.2.2 advertise-community
#
route-policy comm_policy permit node 10
apply community no-export
#
return
Device B configuration file
#
sysname DeviceB
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.2.2 255.255.255.0
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 10.1.3.1 255.255.255.0
#
bgp 20
router-id 2.2.2.2
peer 10.1.2.1 as-number 10
peer 10.1.3.2 as-number 30
#
ipv4-family unicast
undo synchronization peer 10.1.2.1 enable
peer 10.1.3.2 enable
#
return
Device C configuration file
#
sysname DeviceC
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 10.1.3.2 255.255.255.0
#
bgp 30
router-id 3.3.3.3
peer 10.1.3.1 as-number 20
#
ipv4-family unicast
undo synchronization peer 10.1.3.1 enable
#
return
Example for Configuring Prefix-based BGP ORF
Prefix-based BGP ORF is used to implement on-demand BGP route advertisement.
Networking Requirements
On the network shown in Figure 1-1813, Devices A and B are in AS 100. Devices C, D, and E are in AS 200. Device A requires Device C to send only routing information matching the import policy of Device A, but Device C does not want to maintain a separate export policy for Device A. Prefix-based BGP ORF can be configured in such a situation.
Precautions
To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Establish an EBGP peer relationship between Devices A and C, and establish IBGP peer relationships between Devices A and B, between Devices C and D, and between Devices C and E.
Configure a prefix-based import policy on Device A, and enable prefix-based BGP ORF on Devices A and C.
Data Preparation
To complete the configuration, you need the following data:
Router IDs 1.1.1.1 and 2.2.2.2 and AS number 100 of Devices A and B respectively
Router IDs 3.3.3.3, 4.4.4.4, and 5.5.5.5 and AS number 200 of Devices C, D, and E respectively
Procedure
- Configure an IP address for each interface.
Configure an IP address for each interface, as shown in Figure 1-1813. For details on configuration procedures, see corresponding configuration files.
- Establish BGP peer relationships.
# Configure Device A.
[~DeviceA] bgp 100 [*DeviceA-bgp] router-id 1.1.1.1 [*DeviceA-bgp] peer 10.2.1.1 as-number 100 [*DeviceA-bgp] peer 10.1.1.2 as-number 200 [*DeviceA-bgp] ipv4-family unicast [*DeviceA-bgp-af-ipv4] import-route direct [*DeviceA-bgp-af-ipv4] quit [*DeviceA-bgp] commit [~DeviceA-bgp] quit
# Configure Device B.
[~DeviceB] bgp 100 [*DeviceB-bgp] router-id 2.2.2.2 [*DeviceB-bgp] peer 10.2.1.2 as-number 100 [*DeviceB-bgp] commit [~DeviceB-bgp] quit
# Configure Device C.
[~DeviceC] bgp 200 [*DeviceC-bgp] router-id 3.3.3.3 [*DeviceC-bgp] peer 10.1.1.1 as-number 100 [*DeviceC-bgp] peer 10.3.1.1 as-number 200 [*DeviceC-bgp] peer 10.4.1.1 as-number 200 [*DeviceC-bgp] ipv4-family unicast [*DeviceC-bgp-af-ipv4] import-route direct [*DeviceC-bgp-af-ipv4] quit [*DeviceC-bgp] commit [~DeviceC-bgp] quit
# Configure Device D.
[~DeviceD] bgp 200 [*DeviceD-bgp] router-id 4.4.4.4 [*DeviceD-bgp] peer 10.3.1.2 as-number 200 [*DeviceD-bgp] commit [~DeviceD-bgp] quit
# Configure Device E.
[~DeviceE] bgp 200 [*DeviceE-bgp] router-id 5.5.5.5 [*DeviceE-bgp] peer 10.4.1.2 as-number 200 [*DeviceE-bgp] commit [~DeviceE-bgp] quit
- Configure a prefix-based import policy on Device A.
# Configure Device A.
[~DeviceA] ip ip-prefix 1 index 10 permit 10.3.1.0 24 less-equal 32 [*DeviceA] bgp 100 [*DeviceA-bgp] peer 10.1.1.2 ip-prefix 1 import [*DeviceA-bgp] commit [~DeviceA-bgp] quit
# View routing information sent by Device C.
[~DeviceC] display bgp routing-table peer 10.1.1.1 advertised-routes
BGP Local router ID is 3.3.3.3 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 7 Network NextHop MED LocPrf PrefVal Path/Ogn *> 3.3.3.3/32 10.1.1.2 0 0 200? *> 10.1.1.0/30 10.1.1.2 0 0 200? *> 10.1.1.1/32 10.1.1.2 0 0 200? *> 10.3.1.0/30 10.1.1.2 0 0 200? *> 10.3.1.1/32 10.1.1.2 0 0 200? *> 10.4.1.0/30 10.1.1.2 0 0 200? *> 10.4.1.1/32 10.1.1.2 0 0 200?
# View routing information accepted by Device A.
[~DeviceA] display bgp routing-table peer 10.1.1.2 received-routes
BGP Local router ID is 1.1.1.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 2 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.3.1.0/30 10.1.1.2 0 0 200? *> 10.3.1.1/32 10.1.1.2 0 0 200?
When prefix-based BGP ORF is not enabled, Device C sends seven routes, but Device A accepts only two routes because Device A applies the prefix-based import policy to the seven routes.
- Enable prefix-based BGP ORF.
# Enable prefix-based BGP ORF on DeviceA.
[~DeviceA] bgp 100 [*DeviceA-bgp] peer 10.1.1.2 capability-advertise orf ip-prefix both [*DeviceA-bgp] commit [~DeviceA-bgp] quit
# Enable prefix-based BGP ORF on DeviceC.
[~DeviceC] bgp 200 [*DeviceC-bgp] peer 10.1.1.1 capability-advertise orf ip-prefix both [*DeviceC-bgp] commit [~DeviceC-bgp] quit
- Verify the configuration.
# View prefix-based BGP ORF negotiation information on Device A.
[~DeviceA] display bgp peer 10.1.1.2 verbose
BGP Peer is 10.1.1.2, remote AS 200 Type: EBGP link BGP version 4, Remote router ID 3.3.3.3 Update-group ID: 1 BGP current state: Established, Up for 00h00m01s BGP current event: RecvRouteRefresh BGP last state: OpenConfirm BGP Peer Up count: 2 Received total routes: 0 Received active routes total: 0 Advertised total routes: 5 Port: Local - 179 Remote - 54545 Configured: Active Hold Time: 180 sec Keepalive Time:60 sec Received : Active Hold Time: 180 sec Negotiated: Active Hold Time: 180 sec Keepalive Time:60 sec Peer optional capabilities: Peer supports bgp multi-protocol extension Peer supports bgp route refresh capability Peer supports bgp outbound route filter capability Support Address-Prefix: IPv4-UNC address-family, rfc-compatible, both Peer supports bgp 4-byte-as capability Address family IPv4 Unicast: advertised and received Received: Total 3 messages Update messages 1 Open messages 1 KeepAlive messages 1 Notification messages 0 Refresh messages 1 Sent: Total 9 messages Update messages 5 Open messages 2 KeepAlive messages 1 Notification messages 0 Refresh messages 1 Authentication type configured: None Last keepalive received: 2012-03-06 19:17:37 UTC-8:00 Last keepalive sent : 2012-03-06 19:17:37 UTC-8:00 Last update received: 2012-03-06 19:17:43 UTC-8:00 Last update sent : 2012-03-06 19:17:37 UTC-8:00 Minimum route advertisement interval is 30 seconds Optional capabilities: Route refresh capability has been enabled Outbound route filter capability has been enabled Enable Address-Prefix: IPv4-UNC address-family, rfc-compatible, both 4-byte-as capability has been enabled Multi-hop ebgp has been enabled Peer Preferred Value: 0 Routing policy configured: No import update filter list No export update filter list Import prefix list is: 1 No export prefix list No import route policy No export route policy No import distribute policy No export distribute policy
# View routing information sent by Device C.
[~DeviceC] display bgp routing-table peer 10.1.1.1 advertised-routes
BGP Local router ID is 3.3.3.3 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 2 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.3.1.0/30 10.1.1.2 0 0 200? *> 10.3.1.1/32 10.1.1.2 0 0 200?
# View routing information accepted by Device A.
[~A] display bgp routing-table peer 10.1.1.2 received-routes
BGP Local router ID is 1.1.1.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 2 Network NextHop MED LocPrf PrefVal Path/Ogn *> 10.3.1.0/30 10.1.1.2 0 0 200? *> 10.3.1.1/32 10.1.1.2 0 0 200?
After BGP ORF is enabled, Device C sends only two routes based on the prefix-based import policy provided by Device A, and Device A accepts only the two routes.
Configuration Files
DeviceA configuration file
# sysname DeviceA # interface GigabitEthernet0/2/0 ip address 10.2.1.2 255.255.255.252 # interface GigabitEthernet0/1/0 ip address 10.1.1.1 255.255.255.252 # interface LoopBack1 ip address 1.1.1.1 255.255.255.255 # bgp 100 router-id 1.1.1.1 peer 10.1.1.2 as-number 200 peer 10.2.1.1 as-number 100 # ipv4-family unicast undo synchronization import-route direct peer 10.1.1.2 enable peer 10.1.1.2 ip-prefix 1 import peer 10.1.1.2 capability-advertise orf ip-prefix both peer 10.2.1.1 enable # ip ip-prefix 1 index 10 permit 10.3.1.0 24 greater-equal 24 less-equal 32 # return
DeviceB configuration file
# sysname DeviceB # interface GigabitEthernet0/1/0 ip address 10.2.1.1 255.255.255.252 # interface LoopBack1 ip address 2.2.2.2 255.255.255.255 # bgp 100 router-id 2.2.2.2 peer 10.2.1.2 as-number 100 # ipv4-family unicast undo synchronization peer 10.2.1.2 enable # return
DeviceC configuration file
# sysname DeviceC # interface GigabitEthernet0/2/0 ip address 10.3.1.2 255.255.255.252 # interface GigabitEthernet0/1/0 ip address 10.1.1.2 255.255.255.252 # interface GigabitEthernet0/3/0 ip address 10.4.1.2 255.255.255.252 # interface LoopBack1 ip address 3.3.3.3 255.255.255.255 # bgp 200 router-id 3.3.3.3 peer 10.1.1.1 as-number 100 peer 10.3.1.1 as-number 200 peer 10.4.1.1 as-number 200 # ipv4-family unicast undo synchronization import-route direct peer 10.1.1.1 enable peer 10.1.1.1 capability-advertise orf ip-prefix both peer 10.3.1.1 enable peer 10.4.1.1 enable # return
DeviceD configuration file
# sysname DeviceD # interface GigabitEthernet0/1/0 ip address 10.3.1.1 255.255.255.252 # interface LoopBack1 ip address 4.4.4.4 255.255.255.255 # bgp 200 router-id 4.4.4.4 peer 10.3.1.2 as-number 200 # ipv4-family unicast undo synchronization peer 10.3.1.2 enable # return
DeviceE configuration file
# sysname DeviceE # interface GigabitEthernet0/1/1 ip address 10.4.1.1 255.255.255.252 # interface LoopBack1 ip address 5.5.5.5 255.255.255.255 # bgp 200 router-id 5.5.5.5 peer 10.4.1.2 as-number 200 # ipv4-family unicast undo synchronization peer 10.4.1.2 enable # return
Example for Configuring BGP Route Dampening
Configuring BGP route dampening can improve network stability.
Networking Requirements
In Figure 1-1814, all routers are configured with BGP; DeviceA resides in AS 100; DeviceB resides in AS 200; DeviceC resides in AS 300; DeviceD resides in AS 400. EBGP runs between Device C and Device A, between Device C and Device B, and between Device C and Device D. For routes from different EBGP peers, DeviceC applies different route dampening policies. It is required that BGP route dampening be configured to suppress unstable routes and improve network stability.
Precautions
When configuring BGP route dampening, note the following rules:
BGP route dampening takes effect only on EBGP routes.
Set a small MaxSuppressTime value for routes with smaller destination address masks.
- To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Establish EBGP connections between Device A and Device C, between Device B and Device C, and between Device D and Device C.
Configure route dampening policies on Device C and then check routes.
Data Preparation
To complete the configuration, you need the following data:
Router IDs and AS numbers of Device A, Device B, Device C, and Device D
Name of the route flap dampening policy to be applied to Device C
Procedure
- Configure an IP address for each interface. For configuration details, see Configuration Files in this section.
- Configure BGP connections.
# Configure Device A.
[~DeviceA] bgp 100
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] peer 10.10.1.2 as-number 300
[*DeviceA-bgp] ipv4-family unicast
[*DeviceA-bgp-af-ipv4] network 172.16.1.0 24
[*DeviceA-bgp-af-ipv4] commit
[~DeviceA-bgp-af-ipv4] quit
[~DeviceA-bgp] quit
# Configure Device B.
[~DeviceB] bgp 200
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] peer 10.10.2.2 as-number 300
[*DeviceB-bgp] ipv4-family unicast
[*DeviceB-bgp-af-ipv4] network 192.168.1.0 24
[*DeviceB-bgp-af-ipv4] commit
[~DeviceB-bgp-af-ipv4] quit
[~DeviceB-bgp] quit
# Configure Device C.
[~DeviceC] bgp 300
[*DeviceC-bgp] router-id 3.3.3.3
[*DeviceC-bgp] peer 10.10.1.1 as-number 100
[*DeviceC-bgp] peer 10.10.2.1 as-number 200
[*DeviceC-bgp] peer 10.10.3.1 as-number 400
[*DeviceC-bgp] commit
[~DeviceC-bgp] quit
# Configure Device D.
[~DeviceD] bgp 400
[*DeviceD-bgp] router-id 4.4.4.4
[*DeviceD-bgp] peer 10.10.3.2 as-number 300
[*DeviceD-bgp] commit
[~DeviceD-bgp] quit
# Check the BGP peers of Device C.
[*DeviceC] display bgp peer BGP local router ID : 3.3.3.3 Local AS number : 300 Total number of peers : 3 Peers in established state : 3 Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv 10.10.1.1 4 100 3 3 0 00:00:01 Established 0 10.10.2.1 4 200 3 3 0 00:00:00 Established 0 10.10.3.1 4 400 3 3 0 00:00:01 Established 0
The command output shows that the BGP connection status of with each peer is Established.
- Configure BGP route dampening policies.
# Configure an IP prefix list named prefix-a on DeviceC to permit the routes with prefix 172.16.1.0/24.
[~DeviceC] ip ip-prefix prefix-a index 10 permit 172.16.1.0 24
[*DeviceC] commit
# Configure an IP prefix list named prefix-b on DeviceC to permit the routes with prefix 192.168.1.0/24.
[~DeviceC] ip ip-prefix prefix-b index 20 permit 192.168.1.0 24
[*DeviceC] commit
# Configure a route-policy named dampen-policy on Device C and then apply different route dampening policies to the routes with different prefix lengths.
[~DeviceC] route-policy dampen-policy permit node 10
[*DeviceC-route-policy] if-match ip-prefix prefix-a
[*DeviceC-route-policy] apply dampening 10 1000 2000 5000
[*DeviceC-route-policy] commit
[~DeviceC-route-policy] quit
[*DeviceC] route-policy dampen-policy permit node 20
[*DeviceC-route-policy] if-match ip-prefix prefix-b
[*DeviceC-route-policy] apply dampening 10 800 3000 10000
[*DeviceC-route-policy] commit
[~DeviceC-route-policy] quit
# Apply route dampening policies to the routes that flap.
[*DeviceC] bgp 300
[*DeviceC-bgp] ipv4-family unicast
[*DeviceC-bgp-af-ipv4] dampening route-policy dampen-policy
[*DeviceC-bgp-af-ipv4] commit
[~DeviceC-bgp] quit
# Check the configured route dampening parameters on Device C.
[~DeviceC] display bgp routing-table dampening parameter Maximum Suppress Time(in second) : 3973 Ceiling Value : 16000 Reuse Value : 750 HalfLife Time(in second) : 900 Suppress-Limit : 2000 Route-policy : dampen-policy
Configuration Files
Device A configuration file
#
sysname DeviceA
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.10.1.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 172.16.1.1 255.0.0.0
#
bgp 100
router-id 1.1.1.1
peer 10.10.1.2 as-number 300
#
ipv4-family unicast
undo synchronization network 172.16.1.0 255.255.255.0
peer 10.10.1.2 enable
#
return
Device B configuration file
#
sysname DeviceB
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.10.2.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 192.168.1.1 255.255.255.0
#
bgp 200
router-id 2.2.2.2
peer 10.10.2.2 as-number 300
#
ipv4-family unicast
undo synchronization network 192.168.1.0 255.255.255.0
peer 10.10.2.2 enable
#
return
Device C configuration file
#
sysname DeviceC
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.10.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.10.2.2 255.255.255.0
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 10.10.3.2 255.255.255.0
#
bgp 300
router-id 3.3.3.3
peer 10.10.1.1 as-number 100
peer 10.10.2.1 as-number 200
peer 10.10.3.1 as-number 400
#
ipv4-family unicast
undo synchronization dampening route-policy dampen-policy
peer 10.10.1.1 enable
peer 10.10.2.1 enable
peer 10.10.3.1 enable
#
route-policy dampen-policy permit node 10
if-match ip-prefix prefix-a
apply dampening 10 1000 2000 5000
#
route-policy dampen-policy permit node 20
if-match ip-prefix prefix-b
apply dampening 10 800 3000 10000
#
ip ip-prefix prefix-a index 10 permit 172.16.1.0 24
#
ip ip-prefix prefix-b index 20 permit 192.168.1.0 24
#
return
Device D configuration file
#
sysname DeviceD
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.10.3.1 255.255.255.0
#
bgp 400
router-id 4.4.4.4
peer 10.10.3.2 as-number 300
#
ipv4-family unicast
undo synchronization peer 10.10.3.2 enable
#
return
Example for Configuring BGP Default Route Advertisement
By controlling the advertising of default routes, you can specify traffic from a specific path to enter ASs.
Networking Requirements
In Figure 1-1815, all routers run BGP. To ensure that the traffic that leaves AS 200 is forwarded by Device E and Device F, EBGP connections are established between Device A and Device B, between Device C and Device E, and between Device D and Device F; IBGP connections are established between Device B and Device C, and between Device B and Device D.
Interfaces 1 through 3 in this example are GE 0/1/0, GE 0/2/0, GE 0/3/0, respectively.
Device Name |
Interface |
IP Address |
---|---|---|
Device A |
GE 0/1/0 |
10.20.1.1/24 |
Loopback 0 |
1.1.1.1/32 |
|
Device B |
GE 0/1/0 |
10.20.1.2/24 |
GE 0/2/0 |
10.0.1.1/24 |
|
GE 0/3/0 |
10.0.3.2/24 |
|
Loopback 0 |
2.2.2.2/32 |
|
Device C |
GE 0/1/0 |
10.20.2.2/24 |
GE 0/2/0 |
10.0.1.2/24 |
|
GE 0/3/0 |
10.0.2.1/24 |
|
Loopback 0 |
3.3.3.3/32 |
|
Device D |
GE 0/1/0 |
10.20.3.2/24 |
GE 0/2/0 |
10.0.3.1/24 |
|
GE 0/3/0 |
10.0.2.2/24 |
|
Loopback 0 |
4.4.4.4/32 |
|
Device E |
GE 0/1/0 |
10.20.2.1/24 |
GE 0/2/0 |
10.1.1.1/24 |
|
Loopback 0 |
5.5.5.5/32 |
|
Device F |
GE 0/1/0 |
10.20.3.1/24 |
GE 0/2/0 |
10.2.1.1/24 |
|
Loopback 0 |
6.6.6.6/32 |
Precautions
During the configuration, note the following:
A default route can represent all routes on the entire network. For example, in a stub AS scenario, the local device can use a default route, instead of advertising network-wide routes, to forward traffic to an external network. A default route can also represent all routes except specific ones.
During the establishment of a peer relationship, if the IP address of the specified peer is a loopback interface address or a sub-interface address, the peer connect-interface command must be run on both ends to ensure correct connection.
- To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Configure OSPF on Device B, Device C, and Device D.
Establish EBGP connections between Device A and Device B, between Device C and Device E, and between Device D and Device F.
Establish IBGP connections between Device B and Device C, and between Device B and Device D.
Configure an import routing policy on Device C to accept only default routes.
Configure an import routing policy on Device D to accept default routes and all specific routes, and then set Local_Pref values for the accepted default routes.
Data Preparation
To complete the configuration, you need the following data:
Router IDs and AS numbers of Device A, Device B, Device C, Device D, Device E, and Device F
Names of the import routing policies to be configured on Device C and Device D
Local_Pref values to be set for the accepted default routes on Device D
Procedure
- Configure an IP address for each interface. For configuration details, see Configuration Files in this section.
- Configure OSPF.
# Configure Device B.
[~DeviceB] ospf 1
[*DeviceB-ospf-1] area 0
[*DeviceB-ospf-1-area-0.0.0.0] network 10.0.1.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.0] network 10.0.3.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.0] network 2.2.2.2 0.0.0.0
[*DeviceB-ospf-1-area-0.0.0.0] commit
[~DeviceB-ospf-1-area-0.0.0.0] quit
[~DeviceB-ospf-1] quit
# Configure Device C.
[~DeviceC] ospf 1
[*DeviceC-ospf-1] area 0
[*DeviceC-ospf-1-area-0.0.0.0] network 10.0.1.0 0.0.0.255
[*DeviceC-ospf-1-area-0.0.0.0] network 10.0.2.0 0.0.0.255
[*DeviceC-ospf-1-area-0.0.0.0] network 3.3.3.3 0.0.0.0
[*DeviceC-ospf-1-area-0.0.0.0] commit
[~DeviceC-ospf-1-area-0.0.0.0] quit
[~DeviceC-ospf-1] quit
# Configure Device D.
[~DeviceD] ospf 1
[*DeviceD-ospf-1] area 0
[*DeviceD-ospf-1-area-0.0.0.0] network 10.0.2.0 0.0.0.255
[*DeviceD-ospf-1-area-0.0.0.0] network 10.0.3.0 0.0.0.255
[*DeviceD-ospf-1-area-0.0.0.0] network 4.4.4.4 0.0.0.0
[*DeviceD-ospf-1-area-0.0.0.0] commit
[~DeviceD-ospf-1-area-0.0.0.0] quit
[~DeviceD-ospf-1] quit
- Configure BGP connections.
# Configure Device A.
[~DeviceA] bgp 100
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] peer 10.20.1.2 as-number 200
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
# Configure Device B.
[~DeviceB] bgp 200
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] peer 10.20.1.1 as-number 100
[*DeviceB-bgp] network 10.20.1.0 24
[*DeviceB-bgp] peer 3.3.3.3 as-number 200
[*DeviceB-bgp] peer 3.3.3.3 connect-interface LoopBack0
[*DeviceB-bgp] peer 4.4.4.4 as-number 200
[*DeviceB-bgp] peer 4.4.4.4 connect-interface LoopBack0
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
# Configure Device C.
[~DeviceC] bgp 200
[*DeviceC-bgp] router-id 3.3.3.3
[*DeviceC-bgp] peer 10.20.2.1 as-number 300
[*DeviceC-bgp] network 10.20.2.0 24
[*DeviceC-bgp] peer 2.2.2.2 as-number 200
[*DeviceC-bgp] peer 2.2.2.2 connect-interface LoopBack0
[*DeviceC-bgp] commit
[~DeviceC-bgp] quit
# Configure Device D.
[~DeviceD] bgp 200
[*DeviceD-bgp] router-id 4.4.4.4
[*DeviceD-bgp] peer 10.20.3.1 as-number 400
[*DeviceD-bgp] network 10.20.3.0 24
[*DeviceD-bgp] peer 2.2.2.2 as-number 200
[*DeviceD-bgp] peer 2.2.2.2 connect-interface LoopBack0
[*DeviceD-bgp] commit
[~DeviceD-bgp] quit
# Configure Device E.
[~DeviceE] bgp 300
[*DeviceE-bgp] router-id 5.5.5.5
[*DeviceE-bgp] peer 10.20.2.2 as-number 200
[*DeviceE-bgp] network 10.1.1.0 24
[*DeviceE-bgp] commit
[~DeviceE-bgp] quit
# Configure Device F.
[~DeviceF] bgp 400
[*DeviceF-bgp] router-id 6.6.6.6
[*DeviceF-bgp] peer 10.20.3.2 as-number 200
[*DeviceF-bgp] network 10.2.1.0 24
[*DeviceF-bgp] commit
[~DeviceF-bgp] quit
- Configure Device E and Device F to advertise default routes.
# Configure Device E to advertise default routes.
[~DeviceE-bgp] ipv4-family unicast
[*DeviceE-bgp-af-ipv4] peer 10.20.2.2 default-route-advertise
[*DeviceE-bgp-af-ipv4] commit
# Configure Device F to advertise default routes.
[~DeviceF-bgp] ipv4-family unicast
[*DeviceF-bgp-af-ipv4] peer 10.20.3.2 default-route-advertise
[*DeviceF-bgp-af-ipv4] commit
# Check the routing table of Device B.
[~DeviceB] display bgp routing-table
BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 7 Network NextHop MED LocPrf PrefVal Path/Ogn *>i 0.0.0.0 10.20.2.1 0 100 0 300i * i 10.20.3.1 0 100 0 400i *>i 10.1.1.0/24 10.20.2.1 0 100 0 300i *>i 10.2.1.0/24 10.20.3.1 0 100 0 400i *> 10.20.1.0 0.0.0.0 0 0 i *>i 10.20.2.0 3.3.3.3 0 100 0 i *>i 10.20.3.0 4.4.4.4 0 100 0 i
The command output shows that Device B has received the default routes and all specific routes of AS 300 and AS 400.
- Configure import routing policies.
# Configure an IP prefix list named default on Device C to accept only default routes.
[~DeviceC] ip ip-prefix default permit 0.0.0.0 0
[*DeviceC] commit
[*DeviceC] bgp 200
[*DeviceC-bgp] peer 10.20.2.1 ip-prefix default import
[*DeviceC-bgp] commit
# Configure a route-policy named set-default-low on Device D to accept default routes and all specific routes, and set Local_Pref values for the accepted default routes.
[~DeviceD] ip as-path-filter 10 permit ^(400_)+$
[*DeviceD] ip as-path-filter 10 permit ^(400_)+_[0-9]+$
[*DeviceD] ip ip-prefix default permit 0.0.0.0 0
[*DeviceD] route-policy set-default-low permit node 10
[*DeviceD-route-policy] if-match ip-prefix default
[*DeviceD-route-policy] apply local-preference 80
[*DeviceD-route-policy] quit
[*DeviceD] route-policy set-default-low permit node 20
[*DeviceD-route-policy] quit
[*DeviceD] commit
[~DeviceD] bgp 200
[*DeviceD-bgp] peer 10.20.3.1 as-path-filter 10 import
[*DeviceD-bgp] peer 10.20.3.1 route-policy set-default-low import
[*DeviceD-bgp] commit
# Check the routing table of Device B.
[~DeviceB] display bgp routing-table
BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 6 Network NextHop MED LocPrf PrefVal Path/Ogn *>i 0.0.0.0 10.20.2.1 0 100 0 300i * i 10.20.3.1 0 80 0 400i *>i 10.2.1.0/24 10.20.3.1 0 100 0 400i *> 10.20.1.0 0.0.0.0 0 0 i *>i 10.20.2.0 3.3.3.3 0 100 0 i *>i 10.20.3.0 4.4.4.4 0 100 0 i
The command output shows that Device B has received only the default routes of AS 300 and the default routes and all specific routes of AS 400 and that the Local_Pref of the accepted default routes destined of AS 400 has been set to 80.
Configuration Files
Device A configuration file
# sysname DeviceA # interface GigabitEthernet0/1/0 undo shutdown ip address 10.20.1.1 255.255.255.0 # interface LoopBack0 ip address 1.1.1.1 255.255.255.255 # bgp 100 peer 10.20.1.2 as-number 200 # ipv4-family unicast peer 10.20.1.2 enable # return
Device B configuration file
# sysname DeviceB # interface GigabitEthernet0/1/0 undo shutdown ip address 10.20.1.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.0.1.1 255.255.255.0 # interface GigabitEthernet0/3/0 undo shutdown ip address 10.0.3.2 255.255.255.0 # interface LoopBack0 ip address 2.2.2.2 255.255.255.255 # bgp 200 peer 3.3.3.3 as-number 200 peer 3.3.3.3 connect-interface LoopBack0 peer 4.4.4.4 as-number 200 peer 4.4.4.4 connect-interface LoopBack0 peer 10.20.1.1 as-number 100 # ipv4-family unicast network 10.20.1.0 255.255.255.0 peer 3.3.3.3 enable peer 4.4.4.4 enable peer 10.20.1.1 enable # ospf 1 area 0.0.0.0 network 2.2.2.2 0.0.0.0 network 10.0.1.0 0.0.0.255 network 10.0.3.0 0.0.0.255 # return
Device C configuration file
# sysname DeviceC # interface GigabitEthernet0/1/0 undo shutdown ip address 10.20.2.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.0.1.2 255.255.255.0 # interface GigabitEthernet0/3/0 undo shutdown ip address 10.0.2.1 255.255.255.0 # interface LoopBack0 ip address 3.3.3.3 255.255.255.255 # bgp 200 peer 2.2.2.2 as-number 200 peer 2.2.2.2 connect-interface LoopBack0 peer 10.20.2.1 as-number 300 # ipv4-family unicast network 10.20.2.0 255.255.255.0 peer 2.2.2.2 enable peer 10.20.2.1 enable peer 10.20.2.1 ip-prefix default import # ospf 1 area 0.0.0.0 network 3.3.3.3 0.0.0.0 network 10.0.1.0 0.0.0.255 network 10.0.2.0 0.0.0.255 # ip ip-prefix default index 10 permit 0.0.0.0 0 # return
Device D configuration file
# sysname DeviceD # interface GigabitEthernet0/1/0 undo shutdown ip address 10.20.3.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.0.3.1 255.255.255.0 # interface GigabitEthernet0/3/0 undo shutdown ip address 10.0.2.2 255.255.255.0 # interface LoopBack0 ip address 4.4.4.4 255.255.255.255 # bgp 200 peer 2.2.2.2 as-number 200 peer 2.2.2.2 connect-interface LoopBack0 peer 10.20.3.1 as-number 400 # ipv4-family unicast network 10.20.3.0 255.255.255.0 peer 2.2.2.2 enable peer 10.20.3.1 enable peer 10.20.3.1 as-path-filter 10 import peer 10.20.3.1 route-policy set-default-low import # ospf 1 area 0.0.0.0 network 4.4.4.4 0.0.0.0 network 10.0.2.0 0.0.0.255 network 10.0.3.0 0.0.0.255 # route-policy set-default-low permit node 10 if-match ip-prefix default apply local-preference 80 # route-policy set-default-low permit node 20 # ip ip-prefix default index 10 permit 0.0.0.0 0 # ip as-path-filter 10 permit ^(400_)+$ ip as-path-filter 10 permit ^(400_)+_[0-9]+$ # return
Device E configuration file
# sysname DeviceE # interface GigabitEthernet0/1/0 undo shutdown ip address 10.20.2.1 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.1.1 255.255.255.0 # interface LoopBack0 ip address 5.5.5.5 255.255.255.255 # bgp 300 peer 10.20.2.2 as-number 200 # ipv4-family unicast network 10.1.1.0 255.255.255.0 peer 10.20.2.2 enable peer 10.20.2.2 default-route-advertise # return
Device F configuration file
# sysname DeviceF # interface GigabitEthernet0/1/0 undo shutdown ip address 10.20.3.1 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.2.1.1 255.255.255.0 # interface LoopBack0 ip address 6.6.6.6 255.255.255.255 # bgp 400 peer 10.20.3.2 as-number 200 # ipv4-family unicast network 10.2.1.0 255.255.255.0 peer 10.20.3.2 enable peer 10.20.3.2 default-route-advertise # return
Example for Configuring BGP Load Balancing
Configuring load balancing can fully utilize network resources and reduce network congestion.
Networking Requirements
In Figure 1-1816, all routers run BGP; Device A resides in AS 100; Device B and Device C reside in AS 300; Device D resides in AS 200. EBGP connections are established between Device A and Device B, between Device A and Device C, between Device D and Device B, and between Device D and Device C. On Device A, there are two BGP routes to 172.16.1.0/24. Traffic to 172.16.1.0/24 can reach the destination through Device B and Device C. It is required that BGP load balancing be configured to fully utilize network resources and reduce network congestion.
Precautions
During the configuration process, note the following:
Route load balancing can be implemented by configuring BGP attributes, for example, configuring the device to ignore the comparison of IGP metrics. Ensure that no routing loops occur when configuring BGP attributes to implement load balancing.
- To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Establish EBGP connections between Device A and Device B, and between Device A and Device C, and establish an IBGP connection between Device B and Device C.
Establish EBGP connections between Device D and Device B, and between Device D and Device C.
Configure load balancing on Device A and then check routes.
Data Preparation
To complete the configuration, you need the following data:
Router IDs and AS numbers of Device A, Device B, Device C, and Device D
Number of routes for load balancing
Procedure
- Configure an IP address for each interface. For configuration details, see Configuration Files in this section.
- Configure BGP connections.
# Configure Device A.
[~DeviceA] bgp 100
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] peer 10.1.1.2 as-number 300
[*DeviceA-bgp] peer 10.1.2.2 as-number 300
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
# Configure Device B.
[~DeviceB] bgp 300
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] peer 10.1.1.1 as-number 100
[*DeviceB-bgp] peer 10.1.3.1 as-number 200
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
# Configure Device C.
[~DeviceC] bgp 300
[*DeviceC-bgp] router-id 3.3.3.3
[*DeviceC-bgp] peer 10.1.2.1 as-number 100
[*DeviceC-bgp] peer 10.1.4.1 as-number 200
[*DeviceC-bgp] commit
[~DeviceC-bgp] quit
# Configure Device D.
[~DeviceD] bgp 200
[*DeviceD-bgp] router-id 4.4.4.4
[*DeviceD-bgp] peer 10.1.3.2 as-number 300
[*DeviceD-bgp] peer 10.1.4.2 as-number 300
[*DeviceD-bgp] ipv4-family unicast
[*DeviceD-bgp-af-ipv4] network 172.16.1.0 255.255.255.0
[*DeviceD-bgp-af-ipv4] commit
[~DeviceD-bgp-af-ipv4] quit
[~DeviceD-bgp] quit
# Check the routing table of Device A.
[~DeviceA] display bgp routing-table 172.16.1.0 24 BGP local router ID : 1.1.1.1 Local AS number : 100 Paths : 2 available, 1 best, 1 select BGP routing table entry information of 172.16.1.0/24: From: 10.1.1.2 (2.2.2.2) Route Duration: 0d00h00m50s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.1.2 Qos information : 0x0 AS-path 200 300, origin igp, pref-val 0, valid, external, best, select, pre 255 Advertised to such 2 peers: 10.1.1.2 10.1.2.2 BGP routing table entry information of 172.16.1.0/24: From: 10.1.2.2 (3.3.3.3) Route Duration: 0d00h00m51s Direct Out-interface: GigabitEthernet0/2/0 Original nexthop: 10.1.2.2 Qos information : 0x0 AS-path 200 300, origin igp, pref-val 0, valid, external, pre 255, not preferred for router ID Not advertised to any peers yet
The command output shows that there are two valid routes from Device A to 172.16.1.0/24. The route with the next hop 10.1.1.2 is the optimal route because the router ID of Device B is smaller.
- Configure load balancing.
# Configure load balancing on Device A.
[~DeviceA] bgp 100
[*DeviceA-bgp] ipv4-family unicast
[*DeviceA-bgp-af-ipv4] maximum load-balancing 2
[*DeviceA-bgp-af-ipv4] commit
[~DeviceA-bgp-af-ipv4] quit
[~DeviceA-bgp] quit
- Verify the configuration.
# Check the routing table of Device A.
[~DeviceA] display bgp routing-table 172.16.1.0 24 BGP local router ID : 1.1.1.1 Local AS number : 100 Paths : 2 available, 1 best, 2 select BGP routing table entry information of 172.16.1.0/24: From: 10.1.1.2 (2.2.2.2) Route Duration: 0d00h03m55s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.1.2 Qos information : 0x0 AS-path 200 300, origin igp, pref-val 0, valid, external, best, select, pre 255 Advertised to such 2 peers 10.1.1.2 10.1.2.2 BGP routing table entry information of 172.16.1.0/24: From: 10.1.2.2 (3.3.3.3) Route Duration: 0d00h03m56s Direct Out-interface: GigabitEthernet0/2/0 Original nexthop: 10.1.2.2 Qos information : 0x0 AS-path 200 300, origin igp, pref-val 0, valid, external, select, pre 255, not preferred for router ID Not advertised to any peers yet
The routing table shows that the BGP route 172.16.1.0/24 has two next hops: 10.1.1.2 and 10.1.2.2.
Configuration Files
Device A configuration file
#
sysname DeviceA
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.2.1 255.255.255.0
#
bgp 100
router-id 1.1.1.1
peer 10.1.1.2 as-number 300
peer 10.1.2.2 as-number 300
#
ipv4-family unicast
maximum load-balancing 2
peer 10.1.1.2 enable
peer 10.1.2.2 enable
#
return
Device B configuration file
#
sysname DeviceB
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.3.2 255.255.255.0
#
bgp 300
router-id 2.2.2.2
peer 10.1.1.1 as-number 100
peer 10.1.3.1 as-number 200
#
ipv4-family unicast
undo synchronization peer 10.1.1.1 enable
peer 10.1.3.1 enable
#
return
Device C configuration file
#
sysname DeviceC
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.4.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.2.2 255.255.255.0
#
bgp 300
router-id 3.3.3.3
peer 10.1.2.1 as-number 100
peer 10.1.4.1 as-number 200
#
ipv4-family unicast
undo synchronization peer 10.1.2.1 enable
peer 10.1.4.1 enable
#
return
Device D configuration file
#
sysname DeviceD
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.4.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.3.1 255.255.255.0
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 172.16.1.1 255.255.255.0
#
bgp 200
router-id 4.4.4.4
peer 10.1.3.2 as-number 300
peer 10.1.4.2 as-number 300
#
ipv4-family unicast
undo synchronization network 172.16.1.0 255.255.255.0
peer 10.1.3.2 enable
peer 10.1.4.2 enable
#
return
Example for Configuring BGP Next Hop Recursion Based on a Routing Policy
Configuring BGP next hop recursion based on a routing policy prevents traffic loss in case of route changes.
Networking Requirements
As shown in Figure 1-1817, OSPF is used as the IGP in AS 100. An IBGP peer relationship is established between loopback0s of DeviceA and DeviceB, and between loopback0s of DeviceA and DeviceC. DeviceB and DeviceC advertise the BGP route 10.20.1.0/24 to DeviceA. Because the router ID of Device B is smaller, Device A chooses the route 10.20.1.0/24 that is learned from Device B as the optimal route, with the original next hop of 2.2.2.2/32.
In most cases, Device A recurses the next hop of the BGP route destined for 10.20.1.0/24 to an IGP route destined for 2.2.2.2/32 with GE0/1/0 as the outbound interface. When Device B is faulty, Device A deletes the IGP route destined for 2.2.2.2/32 immediately. However, Device A still considers the BGP route with 2.2.2.2/32 being the original next hop as the optimal route because it does not know the BGP route change before the BGP hold timer expires. Based on the longest matching rule, Device A mistakenly recurses the BGP route destined for 10.20.1.0/24 to the direct route destined for 2.2.2.10/24, with GE0/1/2 as the outbound interface, causing traffic loss.
Interfaces 1 through 4 in this example are GE 0/1/0, GE 0/1/1, GE 0/1/2, Loopback0, respectively.
To prevent traffic loss, configure BGP next hop recursion based on a routing policy on Device A to control the recursive routes. In this example, only the recursive routes with a mask length of 32 bits match the routing policy, and those that do not match the routing policy are considered unreachable. As such, when DeviceB is faulty, DeviceA can rapidly detect the route change and re-select a correct BGP route with the original next hop of 3.3.3.3/32, preventing traffic loss.
Precautions
When configuring BGP next hop recursion based on a routing policy, note the following:
Ensure that all desirable recursive routes match the routing policy. Otherwise, BGP routes may be considered unreachable, unable to guide traffic forwarding.
- To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Configure OSPF on Device A, Device B, and Device C to enable the devices in AS 100 to communicate with each other.
Establish an IBGP peer relationship between Loopback 0s of Device A and Device B, and between Loopback 0s of Device A and Device C.
Enable Device B and Device C to advertise a BGP route destined for 10.20.1.0/24 to Device A.
Configure BGP next hop recursion based on a routing policy on Device A. This configuration allows Device A to know the route change in time when Device B is faulty and re-select a correct BGP route, preventing traffic loss.
Data Preparation
To complete the configuration, you need the following data:
Router IDs of Device A, Device B, and Device C (1.1.1.1, 2.2.2.2, and 3.3.3.3, respectively) and AS number (100)
Routing policy (np-by-rp) configured on Device A to control route recursion.
Procedure
- Configure an IP address for each interface. For configuration details, see Configuration File.
- Configure OSPF in AS 100.
# Configure Device A.
[~DeviceA] ospf 1
[*DeviceA-ospf-1] area 0
[*DeviceA-ospf-1-area-0.0.0.0] network 1.1.1.1 0.0.0.0
[*DeviceA-ospf-1-area-0.0.0.0] network 10.1.0.0 0.0.255.255
[*DeviceA-ospf-1-area-0.0.0.0] commit
[~DeviceA-ospf-1-area-0.0.0.0] quit
[~DeviceA-ospf-1] quit
# Configure Device B.
[~DeviceB] ospf 1
[*DeviceB-ospf-1] area 0
[*DeviceC-ospf-1-area-0.0.0.0] network 2.2.2.2 0.0.0.0
[*DeviceB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.0] commit
[~DeviceB-ospf-1-area-0.0.0.0] quit
[~DeviceB-ospf-1] quit
# Configure Device C.
[~DeviceC] ospf 1
[*DeviceC-ospf-1] area 0
[*DeviceC-ospf-1-area-0.0.0.0] network 3.3.3.3 0.0.0.0
[*DeviceC-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255
[*DeviceC-ospf-1-area-0.0.0.0] commit
[~DeviceC-ospf-1-area-0.0.0.0] quit
[~DeviceC-ospf-1] quit
- Establish IBGP connections.
# Configure Device A.
[~DeviceA] bgp 100
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] peer 2.2.2.2 as-number 100
[*DeviceA-bgp] peer 3.3.3.3 as-number 100
[*DeviceA-bgp] peer 2.2.2.2 connect-interface Loopback 0
[*DeviceA-bgp] peer 3.3.3.3 connect-interface Loopback 0
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
# Configure Device B.
[~DeviceB] bgp 100
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] peer 1.1.1.1 as-number 100
[*DeviceB-bgp] peer 1.1.1.1 connect-interface Loopback 0
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
# Configure Device C.
[~DeviceC] bgp 100
[*DeviceC-bgp] router-id 3.3.3.3
[*DeviceC-bgp] peer 1.1.1.1 as-number 100
[*DeviceC-bgp] peer 1.1.1.1 connect-interface Loopback 0
[*DeviceC-bgp] commit
[~DeviceC-bgp] quit
- Enable Device B and Device C to advertise a BGP route destined for 10.20.1.0/24.
# Configure Device B.
[~DeviceB] ip route-static 10.20.1.0 24 NULL 0
[*DeviceB] commit
[~DeviceB] bgp 100
[*DeviceB-bgp] import-route static
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
# Configure Device C.
[~DeviceC] ip route-static 10.20.1.0 24 NULL 0
[*DeviceC] commit
[~DeviceC] bgp 100
[*DeviceC-bgp] import-route static
[*DeviceC-bgp] commit
[~DeviceC-bgp] quit
- Configure BGP next hop recursion based on a routing policy on Device A.
# Configure Device A.
[~DeviceA] ip ip-prefix np-by-rp-ip permit 0.0.0.0 32
[*DeviceA] route-policy np-by-rp permit node 0
[*DeviceA-route-policy] if-match ip-prefix np-by-rp-ip
[*DeviceA-route-policy] quit
[*DeviceA] bgp 100
[*DeviceA-bgp] nexthop recursive-lookup route-policy np-by-rp
[*DeviceA-bgp] quit
[*DeviceA] commit
- Verify the configuration.
# Display detailed information about the BGP route destined for 10.20.1.0/24 on Device A when Device B is running properly.
[~DeviceA] display bgp routing-table 10.20.1.0 24
BGP local router ID : 1.1.1.1 Local AS number : 100 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.20.1.0/24: From: 2.2.2.2 (2.2.2.2) Route Duration: 0d00h00m36s Relay IP Nexthop: 10.1.1.2 Relay IP Out-interface: GigabitEthernet0/1/0 Original nexthop: 2.2.2.2 Qos information : 0x0 AS-path Nil, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal, best, select, pre 255 Not advertised to any peer yet BGP routing table entry information of 10.20.1.0/24: From: 3.3.3.3 (3.3.3.3) Route Duration: 0d02h53m45s Relay IP Nexthop: 10.1.2.2 Relay IP Out-interface: GigabitEthernet0/1/1 Original nexthop: 3.3.3.3 Qos information : 0x0 AS-path Nil, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal, pre 255, not preferred for router ID Not advertised to any peers yet
# Run the shutdown command on GE 0/1/0 of Device B to simulate a fault on Device B.
[~DeviceB] interface GigabitEthernet 0/1/0
[~DeviceB-GigabitEthernet0/1/0] shutdown
[*DeviceB-GigabitEthernet0/1/0] commit
[~DeviceB-GigabitEthernet0/1/0] quit
# Display detailed information about the BGP route destined for 10.20.1.0/24 on Device A.
[~DeviceA] display bgp routing-table 10.20.1.0 24
BGP local router ID : 1.1.1.1 Local AS number : 100 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.20.1.0/24: From: 3.3.3.3 (3.3.3.3) Route Duration: 0d03h10m58s Relay IP Nexthop: 10.1.2.2 Relay IP Out-interface: GigabitEthernet0/1/1 Original nexthop: 3.3.3.3 Qos information : 0x0 AS-path Nil, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal, best, select, pre 255 Not advertised to any peer yet BGP routing table entry information of 10.20.1.0/24: From: 2.2.2.2 (2.2.2.2) Route Duration: 0d00h00m50s Relay IP Nexthop: 0.0.0.0 Relay IP Out-interface: Original nexthop: 2.2.2.2 Qos information : 0x0 AS-path Nil, origin incomplete, MED 0, localpref 100, pref-val 0, internal, pre 255 Not advertised to any peers yet
After DeviceB becomes faulty, the route which is destined for 10.20.1.0/24 and has the original next hop of 2.2.2.2/32 recurses to the direct route destined for 2.2.2.10/24. However, because the direct route destined for 2.2.2.10/24 is not a specific route with a 32-bit mask, this direct route does not match the route-policy np-by-rp. As a result, the recursive route is considered unreachable. Then, the correct route with 3.3.3.3/32 as the original next hop is selected by BGP.
Configuration Files
DeviceA configuration file
#
sysname DeviceA
# interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.1.1 255.255.255.0 # interface GigabitEthernet0/1/1 undo shutdown ip address 10.1.2.1 255.255.255.0 # interface GigabitEthernet0/1/2 undo shutdown ip address 2.2.2.10 255.255.255.0 # interface LoopBack0 ip address 1.1.1.1 255.255.255.255 # bgp 100 router-id 1.1.1.1 peer 2.2.2.2 as-number 100 peer 2.2.2.2 connect-interface LoopBack0 peer 3.3.3.3 as-number 100 peer 3.3.3.3 connect-interface LoopBack0 # ipv4-family unicast undo synchronization nexthop recursive-lookup route-policy np-by-rp peer 2.2.2.2 enable peer 3.3.3.3 enable # ospf 1 area 0.0.0.0 network 1.1.1.1 0.0.0.0 network 10.1.0.0 0.0.255.255 # route-policy np-by-rp permit node 10 if-match ip-prefix np-by-rp-ip # ip ip-prefix np-by-rp-ip index 10 permit 0.0.0.0 32 # return
DeviceB configuration file
#
sysname DeviceB
# interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.1.2 255.255.255.0 # interface LoopBack0 ip address 2.2.2.2 255.255.255.255 # bgp 100 router-id 2.2.2.2 peer 1.1.1.1 as-number 100 peer 1.1.1.1 connect-interface LoopBack0 # ipv4-family unicast undo synchronization import-route static peer 1.1.1.1 enable # ospf 1 area 0.0.0.0 network 2.2.2.2 0.0.0.0 network 10.1.1.0 0.0.0.255 # ip route-static 10.20.1.0 24 NULL 0 # return
DeviceC configuration file
#
sysname DeviceC
# interface GigabitEthernet0/1/1 undo shutdown ip address 10.1.2.2 255.255.255.0 # interface LoopBack0 ip address 3.3.3.3 255.255.255.255 # bgp 100 router-id 3.3.3.3 peer 1.1.1.1 as-number 100 peer 1.1.1.1 connect-interface LoopBack0 # ipv4-family unicast undo synchronization import-route static peer 1.1.1.1 enable # ospf 1 area 0.0.0.0 network 3.3.3.3 0.0.0.0 network 10.1.2.0 0.0.0.255 # ip route-static 10.20.1.0 24 NULL 0 # return
Example for Configuring Routing Policies to Control BGP Route Advertisement and Acceptance
Routing policies can be configured to flexibly filter BGP routes, allowing only desired routes to be advertised and accepted so that these routes guide network traffic forwarding properly.
Networking Requirements
On the network shown in Figure 1-1818, DeviceB, DeviceC, and DeviceD reside in AS 200 and run OSPF, whereas DeviceA resides in AS 100. DeviceA receives routes from the Internet. It is required that DeviceA provide only the routes 172.16.17.0/24, 172.16.18.0/24, and 172.16.19.0/24 for DeviceB, DeviceC accept only the route 172.16.18.0/24, and DeviceD accept all the routes provided by DeviceB.
Precautions
When configuring routing policies to control BGP route advertisement and acceptance, note the following:
When configuring an IP prefix list, specify a proper IP prefix range according to actual requirements.
Note that the name of a configured IP prefix list is case-sensitive.
- To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
- Configure basic OSPF functions on DeviceB, DeviceC, and DeviceD.
- Establish an EBGP peer relationship between DeviceA and DeviceB. Establish IBGP peer relationships between DeviceB and DeviceC, and between DeviceB and DeviceD.
Configure static routes on DeviceA and import them to the BGP routing table.
Configure an export routing policy for BGP routes on DeviceA and check the filtering result on DeviceB.
Configure an import routing policy for BGP routes on DeviceC and check the filtering result on DeviceC.
Data Preparation
To complete the configuration, you need the following data:
Five static routes configured and imported on DeviceA
OSPF backbone area (area 0) where DeviceB, DeviceC, and DeviceD reside
Names of IP prefix lists and routes to be filtered
Procedure
- Assign an IP address to each interface. For configuration details, see Configuration Files.
- Configure OSPF in AS 100.
# Configure DeviceB.
[~DeviceB] ospf
[*DeviceB-ospf-1] area 0
[*DeviceB-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.0] network 192.168.2.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.0] network 192.168.3.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.0] commit
[~DeviceB-ospf-1-area-0.0.0.0] quit
# Configure DeviceC.
[~DeviceC] ospf
[*DeviceC-ospf-1] area 0
[*DeviceC-ospf-1-area-0.0.0.0] network 192.168.2.0 0.0.0.255
[*DeviceC-ospf-1-area-0.0.0.0] commit
[~DeviceC-ospf-1-area-0.0.0.0] quit
[~DeviceC-ospf-1] quit
# Configure DeviceD.
[~DeviceD] ospf
[*DeviceD-ospf-1] area 0
[*DeviceD-ospf-1-area-0.0.0.0] network 192.168.3.0 0.0.0.255
[*DeviceD-ospf-1-area-0.0.0.0] commit
[~DeviceD-ospf-1-area-0.0.0.0] quit
- Configure basic BGP functions.
# Configure DeviceA.
[~DeviceA] bgp 100
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] peer 192.168.1.2 as-number 200
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
# Configure DeviceB.
[~DeviceB] bgp 200
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] peer 192.168.1.1 as-number 100
[*DeviceB-bgp] peer 192.168.2.2 as-number 200
[*DeviceB-bgp] peer 192.168.3.2 as-number 200
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
# Configure DeviceC.
[~DeviceC] bgp 200
[*DeviceC-bgp] router-id 3.3.3.3
[*DeviceC-bgp] peer 192.168.2.1 as-number 200
[*DeviceC-bgp] commit
[~DeviceC-bgp] quit
# Configure DeviceD.
[~DeviceD] bgp 200
[*DeviceD-bgp] router-id 4.4.4.4
[*DeviceD-bgp] peer 192.168.3.1 as-number 200
[*DeviceD-bgp] commit
[~DeviceD-bgp] quit
- Configure five static routes on DeviceA and import them to the BGP routing table.
[~DeviceA] ip route-static 172.16.16.0 24 NULL0
[*DeviceA] ip route-static 172.16.17.0 24 NULL0
[*DeviceA] ip route-static 172.16.18.0 24 NULL0
[*DeviceA] ip route-static 172.16.19.0 24 NULL0
[*DeviceA] ip route-static 172.16.20.0 24 NULL0
[*DeviceA] bgp 100
[*DeviceA-bgp] import-route static
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
# Check the BGP routing table of DeviceB. The command output shows that DeviceB has learned the imported static routes.
[~DeviceB] display bgp routing-table
BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 5 Network NextHop MED LocPrf PrefVal Path/Ogn *> 172.16.16.0/24 192.168.1.1 0 0 100? *> 172.16.17.0/24 192.168.1.1 0 0 100? *> 172.16.18.0/24 192.168.1.1 0 0 100? *> 172.16.19.0/24 192.168.1.1 0 0 100? *> 172.16.20.0/24 192.168.1.1 0 0 100?
- Configure a routing policy to filter the BGP routes to be advertised.
# Configure an IP prefix list named a2b on DeviceA.
[~DeviceA] ip ip-prefix a2b index 10 permit 172.16.17.0 24
[*DeviceA] ip ip-prefix a2b index 20 permit 172.16.18.0 24
[*DeviceA] ip ip-prefix a2b index 30 permit 172.16.19.0 24
[*DeviceA] commit
# Configure an export routing policy based on the IP prefix list a2b on DeviceA.
[~DeviceA] bgp 100
[*DeviceA-bgp] filter-policy ip-prefix a2b export static
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
# Check the BGP routing table of DeviceB. The command output shows that DeviceB has received only the three routes that match the IP prefix list a2b.
[~DeviceB] display bgp routing-table
BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 3 Network NextHop MED LocPrf PrefVal Path/Ogn *> 172.16.17.0/24 192.168.1.1 0 0 100? *> 172.16.18.0/24 192.168.1.1 0 0 100? *> 172.16.19.0/24 192.168.1.1 0 0 100?
- Configure a routing policy to filter the BGP routes to be accepted.
# Configure an IP prefix list named in on DeviceC.
[~DeviceC] ip ip-prefix in index 10 permit 172.16.18.0 24
[*DeviceC] commit
# Configure an import routing policy based on the IP prefix list in on DeviceC.
[~DeviceC] bgp 200
[*DeviceC-bgp] filter-policy ip-prefix in import
[*DeviceC-bgp] commit
# Check the BGP routing table of DeviceC. The command output shows that DeviceC has accepted only the route that matches the IP prefix list in.
[~DeviceC] display bgp routing-table
BGP Local router ID is 3.3.3.3 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 1 Network NextHop MED LocPrf PrefVal Path/Ogn *> 172.16.18.0/24 192.168.1.1 0 0 100?
Configuration Files
DeviceA configuration file
#
sysname DeviceA
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.1.1 255.255.255.0
#
bgp 100
router-id 1.1.1.1
peer 192.168.1.2 as-number 200
#
ipv4-family unicast
undo synchronization
filter-policy ip-prefix a2b export static
import-route static
peer 192.168.1.2 enable
#
ip ip-prefix a2b index 10 permit 172.16.17.0 24
ip ip-prefix a2b index 20 permit 172.16.18.0 24
ip ip-prefix a2b index 30 permit 172.16.19.0 24
#
ip route-static 172.16.16.0 255.255.255.0 NULL0
ip route-static 172.16.17.0 255.255.255.0 NULL0
ip route-static 172.16.18.0 255.255.255.0 NULL0
ip route-static 172.16.19.0 255.255.255.0 NULL0
ip route-static 172.16.20.0 255.255.255.0 NULL0
#
return
DeviceB configuration file
#
sysname DeviceB
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 192.168.3.1 255.255.255.0
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 192.168.2.1 255.255.255.0
#
bgp 200
router-id 2.2.2.2
peer 192.168.1.2 as-number 200
peer 192.168.2.2 as-number 200
peer 192.168.3.2 as-number 200
#
ipv4-family unicast
undo synchronization
peer 192.168.1.1 enable
peer 192.168.2.2 enable
peer 192.168.3.2 enable
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
network 192.168.3.0 0.0.0.255
#
return
DeviceC configuration file
#
sysname DeviceC
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.2.2 255.255.255.0
#
bgp 200
router-id 3.3.3.3
peer 192.168.2.1 as-number 200
#
ipv4-family unicast
undo synchronization
filter-policy ip-prefix in import
peer 192.168.2.1 enable
#
ospf 1
area 0.0.0.0
network 192.168.2.0 0.0.0.255
#
ip ip-prefix in index 10 permit 172.16.18.0 24
#
return
DeviceD configuration file
#
sysname DeviceD
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.3.2 255.255.255.0
#
bgp 200
router-id 4.4.4.4
peer 192.168.3.1 as-number 200
#
ipv4-family unicast
undo synchronization
peer 192.168.3.1 enable
#
ospf 1
area 0.0.0.0
network 192.168.3.0 0.0.0.255
#
return
Example for Configuring BFD for BGP
After BFD for BGP is configured, BFD can fast detect the link fault between BGP peers and notify it to BGP so that service traffic can be transmitted along the backup link.
Networking Requirements
Voice and video services have high requirements for network reliability and stability. If a fault occurs on a network, quick service recovery is required (within 50 ms). BFD for BGP can meet this requirement.
In Figure 1-1819, a primary link and a backup link are deployed on the network to ensure service transmission stability. EBGP peer relationships are established between indirectly connected DeviceA and DeviceB, and between indirectly connected DeviceA and DeviceC. In most cases, traffic is transmitted along the primary link between DeviceA and DeviceB. If the primary link fails, it is required that BGP quickly detect this failure and switch traffic to the backup link (DeviceA -> DeviceC -> DeviceB).
BFD for BGP can be configured to speed up the link switchover. Specifically, BFD is configured to track the BGP peer relationship between DeviceA and DeviceB. If the primary link between DeviceA and DeviceB fails, BFD will quickly detect the fault and notify BGP of the fault so that service traffic is switched to the backup link for transmission.
Interfaces 1 through 3 in this example are GE 0/1/0, GE 0/2/0, and GE 0/3/0, respectively.
If two routers establish an EBGP peer relationship over a direct link, BFD for BGP is not required because the ebgp-interface-sensitive command is enabled by default for directly connected EBGP peers.
Precautions
When configuring BFD for BGP, note the following rules:
Before configuring BFD for BGP, enable BFD globally.
When configuring BFD for BGP, ensure that parameters configured on the two ends of a BFD session are consistent.
- To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Configure basic BGP functions on each router.
Configure the MED attribute to control route selection.
Enable BFD on DeviceA and DeviceB
Data Preparation
To complete the configuration, you need the following data:
Router IDs and AS numbers of DeviceA, DeviceB, and DeviceC
Peer IP address to be detected by BFD
Minimum interval at which BFD Control packets are received and sent and the local detection multiplier
Procedure
- Configure an IP address for each interface on the routers. For configuration details, see Configuration Files in this section.
- Configure basic BGP functions, establish EBGP connections between DeviceA and DeviceB, and between DeviceA and DeviceC, and establish an IBGP connection between DeviceB and DeviceC.
# Configure DeviceA.
[~DeviceA] bgp 100
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] peer 10.20.1.2 as-number 200
[*DeviceA-bgp] peer 10.20.1.2 ebgp-max-hop
[*DeviceA-bgp] peer 10.20.2.2 as-number 200
[*DeviceA-bgp] peer 10.20.2.2 ebgp-max-hop
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
# Configure DeviceB.
[~DeviceB] bgp 200
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] peer 10.20.1.1 as-number 100
[*DeviceB-bgp] peer 10.20.1.1 ebgp-max-hop
[*DeviceB-bgp] peer 10.1.1.2 as-number 200
[*DeviceB-bgp] network 172.16.1.0 255.255.255.0
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
# Configure DeviceC.
[~DeviceC] bgp 200
[*DeviceC-bgp] router-id 3.3.3.3
[*DeviceC-bgp] peer 10.20.2.1 as-number 100
[*DeviceC-bgp] peer 10.20.2.1 ebgp-max-hop
[*DeviceC-bgp] peer 10.1.1.1 as-number 200
[*DeviceC-bgp] commit
[~DeviceC-bgp] quit
# Display peer information on DeviceA. The following command output shows that the BGP peer relationship has been established.
<DeviceA> display bgp peer
BGP local router ID : 1.1.1.1
Local AS number : 100
Total number of peers : 2 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
10.20.1.2 4 200 2 5 0 00:01:25 Established 0
10.20.2.2 4 200 2 4 0 00:00:55 Established 0
- Configure BFD to detect the BGP peer relationship between DeviceA and DeviceB.
# Enable BFD on DeviceA and establish a BFD session to detect the link between DeviceA and DeviceB.
[~DeviceA] bfd
[*DeviceA-bfd] quit
[*DeviceA] commit
# Enable BFD on DeviceB and establish a BFD session to detect the link between DeviceB and DeviceA.
[~DeviceB] bfd
[*DeviceB-bfd] quit
[*DeviceB] commit
- Configure the MED attribute.
# Configure a route-policy to set the MED value for the routes that DeviceB and DeviceC send to DeviceA.
# Configure DeviceB.
[~DeviceB] route-policy 10 permit node 10
[*DeviceB-route-policy] apply cost 100
[*DeviceB-route-policy] commit
[~DeviceB-route-policy] quit
[~DeviceB] bgp 200
[*DeviceB-bgp] peer 10.20.1.1 route-policy 10 export
[*DeviceB-bgp] commit
# Configure DeviceC.
[~DeviceC] route-policy 10 permit node 10
[*DeviceC-route-policy] apply cost 150
[*DeviceC-route-policy] commit
[~DeviceC-route-policy] quit
[~DeviceC] bgp 200
[*DeviceC-bgp] peer 10.20.2.1 route-policy 10 export
[*DeviceC-bgp] commit
# Display the BGP routing table of DeviceA.
<DeviceA> display bgp routing-table
BGP Local router ID is 1.1.1.1
Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V - valid, I - invalid, N - not-found
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 172.16.1.0/24 10.20.1.2 100 0 200i
* 10.20.2.2 150 0 200i
According to the preceding BGP routing table, the next hop address of the route to 172.16.1.0/24 is 10.20.1.2, indicating that traffic is transmitted on the primary link (DeviceA→DeviceB).
- Configure BFD, and set the interval at which BFD Control packets are received and sent and the local detection multiplier.
# Enable BFD on DeviceA, set the minimum interval at which BFD Control packets are received and sent to 100 ms, and set the local detection multiplier to 4.
[~DeviceA] bfd
[*DeviceA-bfd] quit
[*DeviceA] bgp 100
[*DeviceA-bgp] peer 10.20.1.2 bfd enable
[*DeviceA-bgp] peer 10.20.1.2 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4
[*DeviceA-bgp] commit
# Enable BFD on DeviceB, set the minimum interval at which BFD Control packets are received and sent to 100 ms, and set the local detection multiplier to 4.
[~DeviceB] bfd
[*DeviceB-bfd] quit
[*DeviceB] bgp 200
[*DeviceB-bgp] peer 10.20.1.1 bfd enable
[*DeviceB-bgp] peer 10.20.1.1 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4
[*DeviceB-bgp] commit
# Check all the BFD sessions established by BGP on DeviceA.
<DeviceA> display bgp bfd session all
--------------------------------------------------------------------------------
Local_Address Peer_Address Interface
10.20.1.1 10.20.1.2 GigibitEthernet0/1/0
Tx-interval(ms) Rx-interval(ms) Multiplier Session-State
100 100 4 Up
Wtr-interval(m) 0
--------------------------------------------------------------------------------
- Verify the configuration.
# Run the shutdown command on GE 0/2/0 of DeviceB to simulate a fault on the primary link.
[~DeviceB] interface gigabitethernet 0/2/0
[*DeviceB-GigabitEthernet0/2/0] shutdown
[*DeviceB-GigabitEthernet0/2/0] commit
# Display the BGP routing table of DeviceA.
<DeviceA> display bgp routing-table
BGP Local router ID is 1.1.1.1
Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V - valid, I - invalid, N - not-found
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 172.16.1.0/24 10.20.2.2 150 0 200i
The command output shows that the backup link DeviceA→DeviceC→DeviceB takes effect after the primary link fails and that the next hop address of the route to 172.16.1.0/24 has become 10.20.2.2.
Configuration Files
DeviceA configuration file
#
sysname DeviceA
#
bfd
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.20.1.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.20.2.1 255.255.255.0
#
bgp 100
router-id 1.1.1.1
peer 10.20.1.2 as-number 200
peer 10.20.1.2 ebgp-max-hop 255
peer 10.20.1.2 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4
peer 10.20.1.2 bfd enable
peer 10.20.2.2 as-number 200
peer 10.20.2.2 ebgp-max-hop 255
#
ipv4-family unicast
undo synchronization peer 10.20.1.2 enable
peer 10.20.2.2 enable
#
return
DeviceB configuration file
#
sysname DeviceB
#
bfd
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.20.1.2 255.255.255.0
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 172.16.1.1 255.255.255.0
#
bgp 200
router-id 2.2.2.2
peer 10.1.1.2 as-number 200
peer 10.20.1.1 as-number 100
peer 10.20.1.1 ebgp-max-hop 255
peer 10.20.1.1 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4
peer 10.20.1.1 bfd enable
#
ipv4-family unicast
undo synchronization network 172.16.1.0 255.255.255.0
peer 10.1.1.2 enable
peer 10.20.1.1 enable
peer 10.20.1.1 route-policy 10 export
#
route-policy 10 permit node 10
apply cost 100
#
return
DeviceC configuration file
#
sysname DeviceC
#
bfd
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.20.2.2 255.255.255.0
#
bgp 200
router-id 3.3.3.3
peer 10.1.1.1 as-number 200
peer 10.20.2.1 as-number 100
peer 10.20.2.1 ebgp-max-hop 255
#
ipv4-family unicast
undo synchronization peer 10.1.1.1 enable
peer 10.20.2.1 enable
peer 10.20.2.1 route-policy 10 export
#
route-policy 10 permit node 10
apply cost 150
#
return
Example for Configuring BGP Auto FRR
BGP Auto FRR provides backup forwarding entries for routes, minimizing the delay for important services.
Networking Requirements
As networks evolve continuously, voice, on-line video, and financial services raise increasingly high requirements for real-time performance. Usually, primary and backup links are deployed on a network to ensure the stability of these services. If the primary link fails, the device needs to wait for route convergence to be completed. After that, the device reselects an optimal route and delivers this route to the FIB to start a link switchover. This is the traditional switchover mode. In this mode, service interruption lasts a long time, which does not meet the services' requirement.
BGP Auto FRR addresses this problem. After BGP Auto FRR is enabled on a device, the device selects the optimal route to forward packets. In addition, the device automatically adds information about the sub-optimal route to the backup forwarding entries of the optimal route and delivers the backup forwarding entries to the FIB. If the primary link fails, the device quickly switches traffic to the backup link. The switchover does not depend on route convergence and reduces service interruption time. The switchover can be performed within sub-seconds.
As shown in Figure 1-1820, Device A belongs to AS 100; Device B, Device C, and Device D belong to AS 200. BGP Auto FRR needs to be configured to ensure that the route from Device A to DeviceD has the backup route.
Precautions
When configuring BGP Auto FRR, note the following rules:
When configuring BGP FRR, ensure that there are at least two routes to the same destination network segment.
The name of a route-policy is case sensitive.
- To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Configure EBGP connections between Device A and Device B, and between Device A and Device C. Configure IBGP connections between Device D and Device B, and between Device D and Device C.
Configure route-policies on Device B and Device C to change the MED values of routes to Device D for route selection.
Configure BGP Auto FRR on Device A.
Data Preparation
To complete the configuration, you need the following data:
Router IDs and AS numbers of Device A, Device B, Device C, and Device D
Names of route-policies and MED values of routes on Device B and Device C
Procedure
- Configure an IP address for each interface. For configuration details, see Configuration Files in this section.
- Configure EBGP connections between Device A and Device B, and between Device A and Device C, and configure IBGP connections between Device B and Device D, and between Device C and Device D.
# Configure EBGP connections on Device A.
<DeviceA> system-view
[~DeviceA] bgp 100
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] peer 10.1.1.2 as-number 200
[*DeviceA-bgp] peer 10.2.1.2 as-number 200
[*DeviceA-bgp] commit
The configurations on Device B and Device C are similar to the configuration on Device A.
# Configure IBGP connections on Device D.
<DeviceD> system-view
[~DeviceD] bgp 200
[*DeviceD-bgp] router-id 4.4.4.4
[*DeviceD-bgp] peer 10.3.1.1 as-number 200
[*DeviceD-bgp] peer 10.4.1.1 as-number 200
[*DeviceD-bgp] commit
The configurations on Device B and Device C are similar to the configuration on Device D.
- Configure BFD for BGP on Device A, Device B, Device C and Device D.
# Configure BFD for BGP on Device A.
<DeviceA> system-view
[~DeviceA] bfd
[*DeviceA-bfd] quit
[*DeviceA] bgp 100
[*DeviceA-bgp] peer 10.1.1.2 bfd enable
[*DeviceA-bgp] peer 10.1.1.2 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4
[*DeviceA-bgp] peer 10.2.1.2 bfd enable
[*DeviceA-bgp] peer 10.2.1.2 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
[~DeviceA] quit
The configurations on Device B, Device C and Device D are similar to the configuration on Device A.
- Configure route-policies on Device B and Device C to ensure that the MED values of routes to Device D are different.
# Configure a route-policy on Device B.
<DeviceB> system-view
[~DeviceB] route-policy rtb permit node 10
[*DeviceB-route-policy] apply cost 80
[*DeviceB-route-policy] quit
[*DeviceB] bgp 200
[*DeviceB-bgp] ipv4-family unicast
[*DeviceB-bgp-af-ipv4] peer 10.1.1.1 route-policy rtb export
[*DeviceB-bgp-af-ipv4] commit
[~DeviceB-bgp-af-ipv4] quit
# Configure a route-policy on Device C.
<DeviceC> system-view
[~DeviceC] route-policy rtc permit node 10
[*DeviceC-route-policy] apply cost 120
[*DeviceC-route-policy] quit
[*DeviceC] bgp 200
[*DeviceC-bgp] ipv4-family unicast
[*DeviceC-bgp-af-ipv4] peer 10.2.1.1 route-policy rtc export
[*DeviceC-bgp-af-ipv4] commit
[~DeviceC-bgp-af-ipv4] quit
# Advertise a route to 4.4.4.4/32 on Device D.
[~DeviceD] bgp 200
[*DeviceD-bgp] ipv4-family unicast
[*DeviceD-bgp] network 4.4.4.4 32
[*DeviceD-bgp] commit
# Run the display ip routing-table verbose command on Device A to check detailed information about the route to 4.4.4.4/32 it learns.
<DeviceA> display ip routing-table 4.4.4.4 32 verbose Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : _public_ Summary Count : 1 Destination: 4.4.4.4/32 Protocol: EBGP Process ID: 0 Preference: 255 Cost: 80 NextHop: 10.1.1.2 Neighbour: 10.1.1.2 State: Active Adv Age: 00h00m12s Tag: 0 Priority: low Label: NULL QoSInfo: 0x0 IndirectID: 0x4 RelayNextHop: 0.0.0.0 Interface: GigabitEthernet0/1/0 TunnelID: 0x0 Flags: D
Because the MED value of the route learned from Device B is smaller, Device A selects the path Device A→Device B→Device D to transmit traffic to 4.4.4.4/32. Because FRR has not been configured yet, no information about the backup route is available.
- Enable BGP Auto FRR on Device A, and check the routing information.
# Enable BGP Auto FRR on Device A.
<DeviceA> system-view
[~DeviceA] bgp 100
[*DeviceA-bgp] ipv4-family unicast
[*DeviceA-bgp-af-ipv4] auto-frr
[*DeviceA-bgp-af-ipv4] commit
[~DeviceA-bgp-af-ipv4] quit
# Run the display ip routing-table verbose command on Device A to check the routing information.
<DeviceA> display ip routing-table 4.4.4.4 32 verbose Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : _public_ Summary Count : 1 Destination: 4.4.4.4/32 Protocol: EBGP Process ID: 0 Preference: 255 Cost: 80 NextHop: 10.1.1.2 Neighbour: 10.1.1.2 State: Active Adv Age: 00h52m45s Tag: 0 Priority: low Label: NULL QoSInfo: 0x0 IndirectID: 0x4 RelayNextHop: 0.0.0.0 Interface: GigabitEthernet0/1/0 TunnelID: 0x0 Flags: D BkNextHop: 10.2.1.2 BkInterface: GigabitEthernet0/2/0 BkLabel: NULL SecTunnelID: 0x0 BkPETunnelID: 0x0 BkPESecTunnelID: 0x0 BkIndirectID: 0x2
The command output shows that DeviceA has a backup next hop and a backup outbound interface to 4.4.4.4/32.
Configuration Files
DeviceA configuration file
# sysname DeviceA # bfd # interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.1.1 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.2.1.1 255.255.255.0 # bgp 100 router-id 1.1.1.1 peer 10.1.1.2 as-number 200 peer 10.1.1.2 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4 peer 10.1.1.2 bfd enable peer 10.2.1.2 as-number 200 peer 10.2.1.2 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4 peer 10.2.1.2 bfd enable # ipv4-family unicast undo synchronization auto-frr peer 10.1.1.2 enable peer 10.2.1.2 enable # return
Device B configuration file
# sysname DeviceB # bfd # interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.1.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.3.1.1 255.255.255.0 # bgp 200 router-id 2.2.2.2 peer 10.1.1.1 as-number 100 peer 10.1.1.1 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4 peer 10.1.1.1 bfd enable peer 10.3.1.2 as-number 200 peer 10.3.1.2 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4 peer 10.3.1.2 bfd enable # ipv4-family unicast undo synchronization peer 10.1.1.1 route-policy rtb export peer 10.1.1.1 enable peer 10.3.1.2 enable # route-policy rtb permit node 10 apply cost 80 # return
Device C configuration file
# sysname DeviceC # bfd # interface GigabitEthernet0/1/0 undo shutdown ip address 10.2.1.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.4.1.1 255.255.255.0 # bgp 200 router-id 3.3.3.3 peer 10.2.1.1 as-number 100 peer 10.2.1.1 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4 peer 10.2.1.1 bfd enable peer 10.4.1.2 as-number 200 peer 10.4.1.2 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4 peer 10.4.1.2 bfd enable # ipv4-family unicast undo synchronization peer 10.2.1.1 route-policy rtc export peer 10.2.1.1 enable peer 10.4.1.2 enable # route-policy rtc permit node 10 apply cost 120 # return
Device D configuration file
# sysname DeviceD # bfd # interface GigabitEthernet0/1/0 undo shutdown ip address 10.3.1.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.4.1.2 255.255.255.0 # interface LoopBack1 ip address 4.4.4.4 255.255.255.255 # bgp 200 router-id 4.4.4.4 peer 10.3.1.1 as-number 200 peer 10.3.1.1 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4 peer 10.3.1.1 bfd enable peer 10.4.1.1 as-number 200 peer 10.4.1.1 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4 peer 10.4.1.1 bfd enable # ipv4-family unicast undo synchronization network 4.4.4.4 255.255.255.255 peer 10.3.1.1 enable peer 10.4.1.1 enable # return
Example for Configuring BGP ADD-PATH
With BGP ADD-PATH, a route reflector (RR) can send two or more routes with the same prefix to a specified IBGP peer. After reaching the IBGP peer, these routes can back up each other or load-balance traffic, which ensures high reliability in data transmission.
Networking Requirements
In a scenario with an RR and clients, if the RR has multiple routes to the same destination (with the same prefix), the RR selects an optimal route from these routes and then sends only the optimal route to its clients. Therefore, the clients have only one route to the destination. If a link along this route fails, route convergence takes a long time, which cannot meet the requirements for high reliability.
To address this issue, deploy the BGP ADD-PATH feature on the RR. With BGP ADD-PATH, the RR can send two or more routes with the same prefix to a specified IBGP peer. These routes can back up each other or load-balance traffic, which ensures high reliability in data transmission.
On the network shown in Figure 1-1821, Device A, Device B, and Device C are clients of the RR, and Device D is an EBGP peer of Device B and Device C.
To ensure high reliability in data transmission, configure BGP Add-Path on the RR and enable DeviceA to receive Add-Path routes from the RR so that DeviceA can have multiple routes with the same prefix.
Precautions
When configuring the BGP Add-Path function, enable the capability of sending Add-Path routes on the route sender and the capability of receiving Add-Path routes on the route receiver so that Add-Path routes can be exchanged between the two ends.
To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Configure an IP address for each interface on each router.
Configure basic BGP functions on each router.
Enable BGP ADD-PATH on the RR, enable the RR to send ADD-PATH routes to Device A, and configure the number of routes that the RR can send to Device A.
Enable Device A to receive BGP ADD-PATH routes from the RR.
Data Preparation
To complete the configuration, you need the following data:
Router IDs of Device A, Device B, Device C, Device D, and the RR, and their AS numbers, as listed in Table 1-724
Device |
Router ID |
Interface |
IP Address |
AS Number |
---|---|---|---|---|
Device A |
1.1.1.1 |
GigabitEthernet 0/3/0 |
172.16.3.1/24 |
AS 65008 |
GigabitEthernet 0/1/1 |
172.16.2.1/24 |
|||
GigabitEthernet 0/1/3 |
172.16.1.1/24 |
|||
Device B |
2.2.2.2 |
GigabitEthernet 0/3/0 |
172.16.3.2/24 |
AS 65008 |
GigabitEthernet 0/3/2 |
172.16.7.1/24 |
|||
GigabitEthernet 0/1/2 |
172.16.5.2/24 |
|||
Device C |
3.3.3.3 |
GigabitEthernet 0/3/0 |
172.16.6.1/24 |
AS 65008 |
GigabitEthernet 0/3/3 |
172.16.4.2/24 |
|||
GigabitEthernet 0/1/3 |
172.16.1.2/24 |
|||
Device D |
4.4.4.4 |
GigabitEthernet 0/3/0 |
172.16.6.2/24 |
AS 65009 |
GigabitEthernet 0/3/2 |
172.16.7.2/24 |
|||
LoopBack0 |
1.1.1.1/32 |
|||
RR |
5.5.5.5 |
GigabitEthernet 0/3/3 |
172.16.4.1/24 |
AS 65008 |
GigabitEthernet 0/1/1 |
172.16.2.2/24 |
|||
GigabitEthernet 0/1/2 |
172.16.5.1/24 |
Procedure
- Configure an IP address for each interface on each router. For configuration details, see Configuration Files in this section.
- Configure basic BGP functions. Establish an IBGP peer relationship between DeviceA and the RR, between DeviceB and the RR, and between DeviceC and the RR. Configure DeviceA, DeviceB, and DeviceC as clients of the RR. Establish an EBGP peer relationship between DeviceB and DeviceD, and between DeviceC and DeviceD.
# Configure Device A.
[~DeviceA] bgp 65008
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] peer 172.16.2.2 as-number 65008
[*DeviceA-bgp] import-route direct
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
# Configure Device B.
[~DeviceB] bgp 65008
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] peer 172.16.5.1 as-number 65008
[*DeviceB-bgp] peer 172.16.7.2 as-number 65009
[*DeviceB-bgp] import-route direct
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
# Configure Device C.
[~DeviceC] bgp 65008
[*DeviceC-bgp] router-id 3.3.3.3
[*DeviceC-bgp] peer 172.16.4.1 as-number 65008
[*DeviceC-bgp] peer 172.16.6.2 as-number 65009
[*DeviceC-bgp] import-route direct
[*DeviceC-bgp] commit
[~DeviceC-bgp] quit
# Configure Device D.
[~DeviceD] bgp 65009
[*DeviceD-bgp] router-id 4.4.4.4
[*DeviceD-bgp] peer 172.16.6.1 as-number 65008
[*DeviceD-bgp] peer 172.16.7.1 as-number 65008
[*DeviceD-bgp] import-route direct
[*DeviceD-bgp] commit
[~DeviceD-bgp] quit
# Configure the RR.
[~RR] bgp 65008
[*RR-bgp] router-id 5.5.5.5
[*RR-bgp] peer 172.16.2.1 as-number 65008
[*RR-bgp] peer 172.16.4.2 as-number 65008
[*RR-bgp] peer 172.16.5.2 as-number 65008
[*RR-bgp] peer 172.16.2.1 reflect-client
[*RR-bgp] peer 172.16.4.2 reflect-client
[*RR-bgp] peer 172.16.5.2 reflect-client
[*RR-bgp] import-route direct
[*RR-bgp] commit
[~RR-bgp] quit
# Display information about the routes to 1.1.1.1 on Device A.
[~DeviceA] display bgp routing-table 1.1.1.1
BGP local router ID : 1.1.1.1 Local AS number : 65008 Paths: 1 available, 1 best, 1 select, 0 best-external, 0 add-path BGP routing table entry information of 1.1.1.1/32: From: 172.16.2.2 (5.5.5.5) Route Duration: 0d00h00m25s Relay IP Nexthop: 172.16.2.2 Relay IP Out-interface: GigabitEthernet0/1/1 Original nexthop: 172.16.7.2 Qos information : 0x0 AS-path 65009, origin incomplete, MED 0, localpref 100, pref-val 0, valid, inte rnal, best, select, pre 255 Originator: 2.2.2.2 Cluster list: 5.5.5.5 Not advertised to any peer yet
The command output shows that Device A received only one BGP route to 1.1.1.1 from the RR before BGP ADD-PATH is configured.
- Enable BGP ADD-PATH on the RR and enable Device A to receive BGP ADD-PATH routes from the RR.
# Configure the RR.
[~RR] bgp 65008
[~RR-bgp] bestroute add-path path-number 2
[*RR-bgp] peer 172.16.2.1 capability-advertise add-path send
[*RR-bgp] peer 172.16.2.1 advertise add-path path-number 2
[*RR-bgp] commit
[~RR-bgp] quit
# Configure Device A.
[~DeviceA] bgp 65008
[~DeviceA-bgp] peer 172.16.2.2 capability-advertise add-path receive
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
# Display information about the routes to 1.1.1.1 on Device A.
[~DeviceA] display bgp routing-table 1.1.1.1
BGP local router ID : 1.1.1.1 Local AS number : 65008 Paths: 2 available, 1 best, 1 select, 0 best-external, 0 add-path BGP routing table entry information of 1.1.1.1/32: From: 172.16.2.2 (5.5.5.5) Route Duration: 0d00h00m48s Relay IP Nexthop: 172.16.2.2 Relay IP Out-interface: GigabitEthernet0/1/1 Original nexthop: 172.16.7.2 Qos information : 0x0 AS-path 65009, origin incomplete, MED 0, localpref 100, pref-val 0, valid, inte rnal, best, select, pre 255 Received path-id: 0 Originator: 2.2.2.2 Cluster list: 5.5.5.5 Not advertised to any peer yet BGP routing table entry information of 1.1.1.1/32: From: 172.16.2.2 (5.5.5.5) Route Duration: 0d00h00m48s Relay IP Nexthop: 172.16.2.2 Relay IP Out-interface: GigabitEthernet0/1/1 Original nexthop: 172.16.6.2 Qos information : 0x0 AS-path 65009, origin incomplete, MED 0, localpref 100, pref-val 0, valid, inte rnal, pre 255, not preferred for router ID Received path-id: 1 Originator: 3.3.3.3 Cluster list: 5.5.5.5 Not advertised to any peer yet
The command output shows that Device A received two routes from the RR. The route with the original nexthop 172.16.7.2 is the optimal route selected by the RR, and the other one with the original nexthop 172.16.6.2 is an ADD-PATH route.
# Display information about the routes to 1.1.1.1 on the RR.
[~RR] display bgp routing-table 1.1.1.1
BGP local router ID : 5.5.5.5 Local AS number : 65008 Paths: 2 available, 1 best, 1 select, 0 best-external, 1 add-path BGP routing table entry information of 1.1.1.1/32: RR-client route. From: 172.16.5.2 (2.2.2.2) Route Duration: 0d00h19m39s Relay IP Nexthop: 172.16.5.2 Relay IP Out-interface: GigabitEthernet0/1/2 Original nexthop: 172.16.7.2 Qos information : 0x0 AS-path 65009, origin incomplete, MED 0, localpref 100, pref-val 0, valid, inte rnal, best, select, pre 255 Advertised to such 3 peers: 172.16.5.2 172.16.4.2 172.16.2.1 BGP routing table entry information of 1.1.1.1/32: RR-client route. From: 172.16.4.2 (3.3.3.3) Route Duration: 0d00h19m41s Relay IP Nexthop: 172.16.4.2 Relay IP Out-interface: GigabitEthernet0/3/3 Original nexthop: 172.16.6.2 Qos information : 0x0 AS-path 65009, origin incomplete, MED 0, localpref 100, pref-val 0, valid, inte rnal, add-path, pre 255, not preferred for router ID Advertised to such 1 peers: 172.16.2.1
The command output shows that the RR sent the optimal route to all its clients but sent the ADD-PATH route only to Device A.
Configuration Files
Device A configuration file
# sysname DeviceA # interface GigabitEthernet0/3/0 undo shutdown ip address 172.16.3.1 255.255.255.0 # interface GigabitEthernet0/1/1 undo shutdown ip address 172.16.2.1 255.255.255.0 # interface GigabitEthernet0/1/3 undo shutdown ip address 172.16.1.1 255.255.255.0 # bgp 65008 router-id 1.1.1.1 peer 172.16.2.2 as-number 65008 # ipv4-family unicast undo synchronization import-route direct peer 172.16.2.2 enable peer 172.16.2.2 capability-advertise add-path receive # return
Device B configuration file
# sysname DeviceB # interface GigabitEthernet0/3/0 undo shutdown ip address 172.16.3.2 255.255.255.0 # interface GigabitEthernet0/3/2 undo shutdown ip address 172.16.7.1 255.255.255.0 # interface GigabitEthernet0/1/2 undo shutdown ip address 172.16.5.2 255.255.255.0 # bgp 65008 router-id 2.2.2.2 peer 172.16.5.1 as-number 65008 peer 172.16.7.2 as-number 65009 # ipv4-family unicast undo synchronization import-route direct peer 172.16.5.1 enable peer 172.16.7.2 enable # return
Device C configuration file
# sysname DeviceC # interface GigabitEthernet0/3/0 undo shutdown ip address 172.16.6.1 255.255.255.0 # interface GigabitEthernet0/3/3 undo shutdown ip address 172.16.4.2 255.255.255.0 # interface GigabitEthernet0/1/3 undo shutdown ip address 172.16.1.2 255.255.255.0 # bgp 65008 router-id 3.3.3.3 peer 172.16.4.1 as-number 65008 peer 172.16.6.2 as-number 65009 # ipv4-family unicast undo synchronization import-route direct peer 172.16.4.1 enable peer 172.16.6.2 enable # return
Device D configuration file
# sysname DeviceD # interface GigabitEthernet0/3/0 undo shutdown ip address 172.16.6.2 255.255.255.0 # interface GigabitEthernet0/3/2 undo shutdown ip address 172.16.7.2 255.255.255.0 # interface LoopBack0 ip address 1.1.1.1 255.255.255.255 # bgp 65009 router-id 4.4.4.4 peer 172.16.6.1 as-number 65008 peer 172.16.7.1 as-number 65008 # ipv4-family unicast undo synchronization import-route direct peer 172.16.6.1 enable peer 172.16.7.1 enable # return
RR configuration file
# sysname RR # interface GigabitEthernet0/3/3 undo shutdown ip address 172.16.4.1 255.255.255.0 # interface GigabitEthernet0/1/1 undo shutdown ip address 172.16.2.2 255.255.255.0 # interface GigabitEthernet0/1/2 undo shutdown ip address 172.16.5.1 255.255.255.0 # bgp 65008 router-id 5.5.5.5 peer 172.16.2.1 as-number 65008 peer 172.16.4.2 as-number 65008 peer 172.16.5.2 as-number 65008 # ipv4-family unicast undo synchronization import-route direct bestroute add-path path-number 2 peer 172.16.2.1 enable peer 172.16.2.1 reflect-client peer 172.16.2.1 capability-advertise add-path send peer 172.16.2.1 advertise add-path path-number 2 peer 172.16.4.2 enable peer 172.16.4.2 reflect-client peer 172.16.5.2 enable peer 172.16.5.2 reflect-client # return
Example for Configuring BGP Keychain Authentication
By configuring keychain authentication between BGP peers, you can enhance the security of BGP connections.
Networking Requirements
On the network shown in Figure 1-1822, Device A belongs to AS 100, and Device B belongs to AS 200. BGP runs on the network, and BGP keychain authentication is used to protect EBGP connections against attacks.
Precautions
When configuring BGP keychain authentication, pay attention to the following:
Keychain authentication must be configured on both BGP peers. The keychains configured at both ends must use the same encryption algorithm and password so that a TCP connection can be set up and BGP messages can be exchanged properly.
- For security purposes, you are advised not to use weak security algorithms in this feature. If you need to use such an algorithm, run the undo crypto weak-algorithm disable command to enable the weak security algorithm function first.
Configuration Roadmap
The configuration roadmap is as follows:
Establish an EBGP connection between Device A and Device B.
Configure keychain authentication on Device A and Device B.
Data Preparation
To complete the configuration, you need the following data:
Router IDs and AS numbers of Device A and Device B
Name of keychain authentication between Device A and Device B
- Passwords to be encrypted using the HMAC-SHA256 algorithm for the authentication on Device A and Device B
Procedure
- Configure an IP address for each interface. For configuration details, see Configuration Files in this section.
- Establish an EBGP connection.
# Configure Device A.
[~DeviceA] bgp 100
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] peer 10.20.1.2 as-number 200
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
# Configure Device B.
[~DeviceB] bgp 200
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] peer 10.20.1.1 as-number 100
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
- Configure keychain authentication.
# Configure Device A.
[~DeviceA] keychain AMode mode absolute
[*DeviceA-keychain] tcp-kind 179
[*DeviceA-keychain] tcp-algorithm-id hmac-sha-256 17
[*DeviceA-keychain] receive-tolerance 100
[*DeviceA-keychain] key-id 1
[*DeviceA-keychain-keyid-1] algorithm hmac-sha-256
[*DeviceA-keychain-keyid-1] key-string hello
[*DeviceA-keychain-keyid-1] send-time 11:00 2009-12-24 to 12:00 2009-12-24
[*DeviceA-keychain-keyid-1] receive-time 11:00 2009-12-24 to 12:00 2009-12-24
[*DeviceA-keychain-keyid-1] commit
[~DeviceA-keychain-keyid-1] quit
[~DeviceA-keychain] quit
# Configure Device B.
[~DeviceB] keychain AMode mode absolute
[*DeviceB-keychain] tcp-kind 179
[*DeviceB-keychain] tcp-algorithm-id hmac-sha-256 17
[*DeviceB-keychain] receive-tolerance 100
[*DeviceB-keychain] key-id 1
[*DeviceB-keychain-keyid-1] algorithm hmac-sha-256
[*DeviceB-keychain-keyid-1] key-string hello
[*DeviceB-keychain-keyid-1] send-time 11:00 2009-12-24 to 12:00 2009-12-24
[*DeviceB-keychain-keyid-1] receive-time 11:00 2009-12-24 to 12:00 2009-12-24
[*DeviceB-keychain-keyid-1] commit
[~DeviceB-keychain-keyid-1] quit
[~DeviceB-keychain] quit
- Apply keychain authentication on the EBGP connection between Device A and Device B.
# Configure Device A.
[~DeviceA] bgp 100
[*DeviceA-bgp] peer 10.20.1.2 keychain AMode
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
# Configure Device B.
[*DeviceB] bgp 200
[*DeviceB-bgp] peer 10.20.1.1 keychain AMode
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
- Verify the configuration.
# On DeviceA, check the BGP connection status after keychain authentication is configured.
<~DeviceA> display bgp peer
BGP local router ID : 10.20.1.1 Local AS number : 100 Total number of peers : 1 Peers in established state : 1 Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv 10.20.1.2 4 200 21 24 0 00:00:23 Established 0
You can view that the status of the BGP connection is Established after keychain authentication is configured.
# Run the display keychain keychain-name command on DeviceA to check the Key-id in Active state.
<~DeviceA> display keychain Amode
Keychain Information: ---------------------- Keychain Name : amode Timer Mode : Absolute Receive Tolerance(min) : 100 Digest Length : 32 Time Zone : LMT TCP Kind : 179 TCP Algorithm IDs : HMAC-MD5 : 5 HMAC-SHA1-12 : 2 HMAC-SHA1-20 : 6 MD5 : 3 SHA1 : 4 HMAC-SHA-256 : 17 SHA-256 : 8 SM3 : 9 AES-128-CMAC : 10 HMAC-SHA-384 : 11 HMAC-SHA-512 : 12 Number of Key IDs : 1 Active Send Key ID : 1 Active Receive Key IDs : 01 Default send Key ID : Not configured Key ID Information: ---------------------- Key ID : 1 Key string : ****** Algorithm : HMAC-SHA-256 SEND TIMER : Start time : 2013-08-10 10:00 End time : 2022-10-28 12:00 Status : Active RECEIVE TIMER : Start time : 2013-08-10 10:00 End time : 2022-10-28 12:00 Status : Active
# Run the display bgp peer ipv4-address verbose command to verify that the authentication type configured for the BGP peer is Keychain(Amode).
<~DeviceA> display bgp ipv6 peer 10.20.1.2 verbose
BGP Peer is 10.20.1.2, remote AS 200 Type: EBGP link BGP version 4, Remote router ID 2.2.2.2 Update-group ID: 3 BGP current state: Established, Up for 00h03m36s BGP current event: KATimerExpired BGP last state: OpenConfirm BGP Peer Up count: 1 Received total routes: 0 Received active routes total: 0 Advertised total routes: 0 Port: Local - 179 Remote - 55423 Configured: Connect-retry Time: 32 sec Configured: Min Hold Time: 0 sec Configured: Active Hold Time: 180 sec Keepalive Time:60 sec Received : Active Hold Time: 180 sec Negotiated: Active Hold Time: 180 sec Keepalive Time:60 sec Peer optional capabilities: Peer supports bgp multi-protocol extension Peer supports bgp route refresh capability Peer supports bgp 4-byte-as capability Address family IPv4 Unicast: advertised and received Received: Total 6 messages Update messages 1 Open messages 1 KeepAlive messages 4 Notification messages 0 Refresh messages 0 Sent: Total 7 messages Update messages 1 Open messages 1 KeepAlive messages 5 Notification messages 0 Refresh messages 0 Authentication type configured: Keychain(amode) Last keepalive received: 2013-08-15 17:51:17+00:00 Last keepalive sent : 2013-08-15 17:51:52+00:00 Last update received: 2013-08-15 17:48:27+00:00 Last update sent : 2013-08-15 17:48:27+00:00 No refresh received since peer has been configured No refresh sent since peer has been configured Minimum route advertisement interval is 30 seconds Optional capabilities: Route refresh capability has been enabled 4-byte-as capability has been enabled Peer Preferred Value: 0 Memory Priority: medium Routing policy configured: No routing policy is configured
Configuration Files
Device A configuration file
# sysname DeviceA # keychain AMode mode absolute receive-tolerance 100 tcp-kind 179 tcp-algorithm-id hmac-sha-256 17 # key-id 1 algorithm hmac-sha-256 key-string cipher %#%#e^1}%%w;/C[M)OQc7"j+,2)}%#%# send-time 11:00 2009-12-24 to 12:00 2009-12-24 receive-time 11:00 2009-12-24 to 12:00 2009-12-24 # interface GigabitEthernet0/1/0 undo shutdown ip address 10.20.1.1 255.255.255.0 # bgp 100 router-id 1.1.1.1 peer 10.20.1.2 as-number 200 peer 10.20.1.2 keychain AMode # ipv4-family unicast undo synchronization peer 10.20.1.2 enable # return
Device B configuration file
# sysname DeviceB # keychain AMode mode absolute receive-tolerance 100 tcp-kind 179 tcp-algorithm-id hmac-sha-256 17 # key-id 1 algorithm hmac-sha-256 key-string cipher %#%#ub(70WJ"^=i(kxPK@*fK,)}t%#%# send-time 11:00 2009-12-24 to 12:00 2009-12-24 receive-time 11:00 2009-12-24 to 12:00 2009-12-24 # interface GigabitEthernet0/1/0 undo shutdown ip address 10.20.1.2 255.255.255.0 # bgp 200 router-id 2.2.2.2 peer 10.20.1.1 as-number 100 peer 10.20.1.1 keychain AMode # ipv4-family unicast undo synchronization peer 10.20.1.1 enable # return
Example for Configuring BGP-LS
BGP-link state (LS) enables BGP to report topology information collected by IGPs to the controller.
Networking Requirements
- Reduces computing capability requirements and spares the necessity of IGPs on the controller.
- Facilitates route selection and calculation on the controller by using BGP to summarize process or AS topology information and report the complete information to the controller.
- Requires only one routing protocol (BGP) to report topology information to the controller.
In Figure 1-1823, Device C is connected to the controller and reports topology information to the controller. Device A, Device B, Device C, and Device D use IS-IS to communicate with each other at the network layer. Device A, Device B, and Device C reside in area 10, whereas Device D resides in area 20. Device A and Device B are Level-1 devices, Device C is a Level-1-2 device, and Device D is a Level-2 device.
Precautions
To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Configure an IP address for each interface on each router.
Configure basic IS-IS functions.
Deploy BGP-LS on Device C and the controller.
Data Preparation
To complete the configuration, you need the following data:
Area addresses of Device A, Device B, Device C, and Device D
Levels of Device A, Device B, Device C, and Device D
BGP-LS identifier of Device C
BGP AS numbers, BGP-LS domain AS numbers, and BGP-LS domain IDs of Device C and the controller
Procedure
- Assign an IP address to each interface on each router. For configuration details, see Configuration Files in this section.
- Configure basic IS-IS functions.
# Configure Device A.
[~DeviceA] isis 1
[*DeviceA-isis-1] is-level level-1
[*DeviceA-isis-1] network-entity 10.0000.0000.0001.00
[*DeviceA-isis-1] quit
[*DeviceA] interface gigabitethernet 0/2/0
[*DeviceA-GigabitEthernet0/2/0] isis enable 1
[*DeviceA-GigabitEthernet0/2/0] commit
[~DeviceA-GigabitEthernet0/2/0] quit
# Configure Device B.
[~DeviceB] isis 1
[*DeviceB-isis-1] is-level level-1
[*DeviceB-isis-1] network-entity 10.0000.0000.0002.00
[*DeviceB-isis-1] quit
[*DeviceB] interface gigabitethernet 0/4/0
[*DeviceB-GigabitEthernet0/4/0] isis enable 1
[*DeviceA-GigabitEthernet0/4/0] commit
[~DeviceB-GigabitEthernet0/4/0] quit
# Configure Device C.
[~DeviceC] isis 1
[*DeviceC-isis-1] network-entity 10.0000.0000.0003.00
[*DeviceC-isis-1] quit
[*DeviceC] interface gigabitethernet 0/2/0
[*DeviceC-GigabitEthernet0/2/0] isis enable 1
[*DeviceC-GigabitEthernet0/2/0] quit
[*DeviceC] interface gigabitethernet 0/3/0
[*DeviceC-GigabitEthernet0/3/0] isis enable 1
[*DeviceC-GigabitEthernet0/3/0] quit
[*DeviceC] interface gigabitethernet 0/4/0
[*DeviceC-GigabitEthernet0/4/0] isis enable 1
[*DeviceC-GigabitEthernet0/4/0] commit
[~DeviceC-GigabitEthernet0/4/0] quit
# Configure Device D.
[~DeviceD] isis 1
[*DeviceD-isis-1] is-level level-2
[*DeviceD-isis-1] network-entity 20.0000.0000.0004.00
[*DeviceD-isis-1] quit
[*DeviceD] interface gigabitethernet 0/3/0
[*DeviceD-GigabitEthernet0/3/0] isis enable 1
[*DeviceD-GigabitEthernet0/3/0] quit
[*DeviceD] interface LoopBack0
[*DeviceD-LoopBack0] isis enable 1
[*DeviceD-LoopBack0] commit
[~DeviceD-LoopBack0] quit
# Check IS-IS routing information on each router. The following example uses the command output on Device C.
[~DeviceC] display isis route
Route information for ISIS(1) ----------------------------- ISIS(1) Level-1 Forwarding Table -------------------------------- IPV4 Destination IntCost ExtCost ExitInterface NextHop Flags ------------------------------------------------------------------------------- 1.1.1.0/24 10 NULL GE0/1/0 Direct D/-/L/- 10.1.1.0/24 10 NULL GE0/2/0 Direct D/-/L/- 10.1.2.0/24 10 NULL GE0/4/0 Direct D/-/L/- 192.168.0.0/24 10 NULL GE0/3/0 Direct D/-/L/- Flags: D-Direct, A-Added to URT, L-Advertised in LSPs, S-IGP Shortcut, U-Up/Down Bit Set ISIS(1) Level-2 Forwarding Table -------------------------------- IPV4 Destination IntCost ExtCost ExitInterface NextHop Flags ------------------------------------------------------------------------------- 1.1.1.0/24 10 NULL GE0/1/0 Direct D/-/L/- 10.1.1.0/24 10 NULL GE0/2/0 Direct D/-/L/- 10.1.2.0/24 10 NULL GE0/4/0 Direct D/-/L/- 172.16.1.1/32 10 NULL GE0/3/0 192.168.0.2 A/-/-/- 192.168.0.0/24 10 NULL GE0/3/0 Direct D/-/L/- Flags: D-Direct, A-Added to URT, L-Advertised in LSPs, S-IGP Shortcut, U-Up/Down Bit Set
- Deploy BGP-LS on Device C and the controller.
# Enable IS-IS topology advertisement to BGP on Device C.
[~DeviceC] isis 1
[*DeviceC-isis-1] bgp-ls enable
[*DeviceC-isis-1] bgp-ls identifier 20
[*DeviceC-isis-1] commit
[~DeviceC-isis-1] quit
# Enable BGP-LS on Device C and configure the controller as a BGP-LS peer of Device C.
[~DeviceC] bgp 100
[*DeviceC-bgp] peer 1.1.1.2 as-number 100
[*DeviceC-bgp] link-state-family unicast
[*DeviceC-bgp-af-ls] peer 1.1.1.2 enable
[*DeviceC-bgp-af-ls] commit
[~DeviceC-bgp-af-ls] quit
[~DeviceC-bgp] quit
# Enable BGP-LS on the controller and configure Device C as a BGP-LS peer of the controller.
[~Controller] bgp 100
[*Controller-bgp] peer 1.1.1.1 as-number 100
[*Controller-bgp] link-state-family unicast
[*Controller-bgp-af-ls] peer 1.1.1.1 enable
[*Controller-bgp-af-ls] commit
[~Controller-bgp-af-ls] quit
[~Controller-bgp] quit
- Verify the configuration.
# Display information about BGP-LS peers and their status on Device C.
[~DeviceC] display bgp link-state unicast peer
BGP local router ID : 10.1.1.1 Local AS number : 100 Total number of peers : 1 Peers in established state : 1 Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv 1.1.1.2 4 100 27 48 0 00:29:11 Established 17
# Display BGP-LS routes on Device C.
[~DeviceC] display bgp link-state unicast routing-table
BGP Local router ID is 10.1.1.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Total Number of Node Routes: 6 *> Network : [NODE][ISIS-LEVEL-1][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0002.00]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [NODE][ISIS-LEVEL-1][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.00]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [NODE][ISIS-LEVEL-2][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.00]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [NODE][ISIS-LEVEL-2][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0004.00]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [NODE][ISIS-LEVEL-1][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.02]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [NODE][ISIS-LEVEL-2][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0004.01]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? Total Number of Link Routes: 8 *> Network : [LINK][ISIS-LEVEL-1][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0002.00]][REMOTE[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.02]][LINK[if-address0.0.0.0][peer-address0.0.0.0][if-address::][peer-address::]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [LINK][ISIS-LEVEL-1][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.00]][REMOTE[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.02]][LINK[if-address0.0.0.0][peer-address0.0.0.0][if-address::][peer-address::]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [LINK][ISIS-LEVEL-1][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.02]][REMOTE[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0002.00]][LINK[if-address0.0.0.0][peer-address0.0.0.0][if-address::][peer-address::]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [LINK][ISIS-LEVEL-1][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.02]][REMOTE[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.00]][LINK[if-address0.0.0.0][peer-address0.0.0.0][if-address::][peer-address::]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [LINK][ISIS-LEVEL-2][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.00]][REMOTE[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0004.01]][LINK[if-address0.0.0.0][peer-address0.0.0.0][if-address::][peer-address::]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [LINK][ISIS-LEVEL-2][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0004.00]][REMOTE[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0004.01]][LINK[if-address0.0.0.0][peer-address0.0.0.0][if-address::][peer-address::]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [LINK][ISIS-LEVEL-2][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0004.01]][REMOTE[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.00]][LINK[if-address0.0.0.0][peer-address0.0.0.0][if-address::][peer-address::]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [LINK][ISIS-LEVEL-2][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0004.01]][REMOTE[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0004.00]][LINK[if-address0.0.0.0][peer-address0.0.0.0][if-address::][peer-address::]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? Total Number of IPv4 Prefix Routes: 11 *> Network : [IPV4-PREFIX][ISIS-LEVEL-1][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0002.00]][PREFIX[ospf-route-type0][prefix10.1.2.0/24]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [IPV4-PREFIX][ISIS-LEVEL-1][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.00]][PREFIX[ospf-route-type0][prefix1.1.1.0/24]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [IPV4-PREFIX][ISIS-LEVEL-1][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.00]][PREFIX[ospf-route-type0][prefix10.1.1.0/24]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [IPV4-PREFIX][ISIS-LEVEL-1][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.00]][PREFIX[ospf-route-type0][prefix10.1.2.0/24]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [IPV4-PREFIX][ISIS-LEVEL-1][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.00]][PREFIX[ospf-route-type0][prefix192.168.0.0/24]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [IPV4-PREFIX][ISIS-LEVEL-2][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.00]][PREFIX[ospf-route-type0][prefix1.1.1.0/24]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [IPV4-PREFIX][ISIS-LEVEL-2][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.00]][PREFIX[ospf-route-type0][prefix10.1.1.0/24]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [IPV4-PREFIX][ISIS-LEVEL-2][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.00]][PREFIX[ospf-route-type0][prefix10.1.2.0/24]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [IPV4-PREFIX][ISIS-LEVEL-2][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0003.00]][PREFIX[ospf-route-type0][prefix192.168.0.0/24]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [IPV4-PREFIX][ISIS-LEVEL-2][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0004.00]][PREFIX[ospf-route-type0][prefix192.168.0.0/24]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ? *> Network : [IPV4-PREFIX][ISIS-LEVEL-2][IDENTIFIER20][LOCAL[as100][bgp-ls-identifier10.1.1.1][ospf-area-id0.0.0.0][igp-router-id0000.0000.0004.00]][PREFIX[ospf-route-type0][prefix172.16.1.1/32]] NextHop : 0.0.0.0 LocPrf : MED : 0 PrefVal : 0 Path/Ogn : ?
The preceding command output shows that Device C obtains the topology information on the whole IS-IS network. Device C can use BGP-LS routes to report the topology information to its BGP-LS peer (the controller).
Configuration Files
Device A configuration file
# sysname DeviceA # isis 1 is-level level-1 network-entity 10.0000.0000.0001.00 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.1.2 255.255.255.0 isis enable 1 # return
Device B configuration file
# sysname DeviceB # isis 1 is-level level-1 network-entity 10.0000.0000.0002.00 # interface GigabitEthernet0/4/0 undo shutdown ip address 10.1.2.2 255.255.255.0 isis enable 1 # return
Device C configuration file
# sysname DeviceC # isis 1 bgp-ls enable level-1-2 bgp-ls identifier 20 network-entity 10.0000.0000.0003.00 # interface GigabitEthernet0/1/0 undo shutdown ip address 1.1.1.1 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.1.1 255.255.255.0 isis enable 1 # interface GigabitEthernet0/3/0 undo shutdown ip address 192.168.0.1 255.255.255.0 isis enable 1 # interface GigabitEthernet0/4/0 undo shutdown ip address 10.1.2.1 255.255.255.0 isis enable 1 # bgp 100 peer 1.1.1.2 as-number 100 # ipv4-family unicast undo synchronization peer 1.1.1.2 enable # link-state-family unicast peer 1.1.1.2 enable # return
Device D configuration file
# sysname DeviceD # isis 1 is-level level-2 network-entity 20.0000.0000.0004.00 # interface GigabitEthernet0/3/0 undo shutdown ip address 192.168.0.2 255.255.255.0 isis enable 1 # interface LoopBack0 ip address 172.16.1.1 255.255.255.255 isis enable 1 # return
Controller configuration file
# sysname Controller # interface GigabitEthernet0/1/0 undo shutdown ip address 1.1.1.2 255.255.255.0 # bgp 100 peer 1.1.1.1 as-number 100 # ipv4-family unicast undo synchronization peer 1.1.1.1 enable # link-state-family unicast peer 1.1.1.1 enable # return
Example for Configuring BGP RPD
BGP RPD ensures that route-policies are distributed dynamically.
Networking Requirements
In a MAN ingress or IGW scenario, uneven link resource usage or link faults may cause link congestion. To fully use network bandwidth, you can deploy an inbound traffic optimization solution to adjust route priorities so that traffic is diverted to idle links. In such a scenario, the router functions as a forwarder, and RPD needs to be deployed on it.
In Figure 1-1824, BGP runs on all routers. router A and router B reside in AS 100, router C in AS 200, and NCE in AS 300. The traffic that Device C in AS 200 sends to the destination IP address 192.168.1.0 can enter AS 100 through router A or router B. However, NCE finds that the link between router A and router C is congested. In this case, a traffic optimization policy can be configured so that an RPD route is delivered to divert the traffic to router B when the traffic enters AS 100.
Precautions
To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Configure EBGP connections between Device A and Device C, and between Device B and Device C.
On Device A and Device B, enable RPD and establish RPD peer relationships with the NCE.
Configure IPv4 unicast on Device A, Device B, and Device C so that IPv4 unicast peer relationships are established between Device A and Device C, and between Device B and Device C.
This section provides only the configurations and procedures for forwarders. For details about NCE's configurations, such as the BGP, BGP RPD address family, and traffic optimization policy configurations, see the NCE manual.
Data Preparation
To complete the configuration, you need the following data:
- Router ID (4.1.1.1) of Device A, router ID (2.2.2.2) of Device B, and their AS number 100
- Router ID 3.3.3.3 of Device C and its AS number 200
Procedure
- Assign an IP address to each interface. For configuration details, see Configuration Files in this section.
- Configure BGP connections.
# Configure Device A.
[~DeviceA] bgp 100
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] peer 10.2.1.2 as-number 200
[*DeviceB-bgp] peer 1.1.1.1 as-number 300
[*DeviceA-bgp] ipv4-family unicast
[*DeviceA-bgp-af-ipv4] network 192.168.1.0 255.255.255.0
[*DeviceA-bgp-af-ipv4] commit
[~DeviceA-bgp-af-ipv4] quit
[~DeviceA-bgp] quit
# Configure Device B.
[~DeviceB] bgp 100
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] peer 10.3.1.2 as-number 200
[*DeviceB-bgp] peer 2.1.1.1 as-number 300
[*DeviceB-bgp] ipv4-family unicast
[*DeviceB-bgp-af-ipv4] network 192.168.1.0 255.255.255.0
[*DeviceB-bgp-af-ipv4] commit
[~DeviceB-bgp-af-ipv4] quit
[~DeviceB-bgp] quit
# Configure Device C.
[~DeviceC] bgp 200
[*DeviceC-bgp] router-id 3.3.3.3
[*DeviceC-bgp] peer 10.2.1.1 as-number 100
[*DeviceC-bgp] peer 10.3.1.1 as-number 100
[*DeviceC-bgp] ipv4-family unicast
[*DeviceC-bgp-af-ipv4] commit
[~DeviceC-bgp-af-ipv4] quit
[~DeviceC-bgp] quit
# Check the routing table of Device C.
[~DeviceC] display bgp routing-table 192.168.1.0 24 BGP local router ID : 3.3.3.3 Local AS number : 200 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 192.168.1.0/24: From: 10.2.1.1 (1.1.1.1) Route Duration: 0d00h00m56s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.2.1.1 Qos information : 0x0 AS-path 100, origin igp, MED 0, pref-val 0, valid, external, best, select, pre 255 Advertised to such 2 peers: 10.2.1.1 10.3.1.1 BGP routing table entry information of 192.168.1.0/24: From: 10.3.1.1 (2.2.2.2) Route Duration: 0d00h00m06s Direct Out-interface: GigabitEthernet0/1/1 Original nexthop: 10.3.1.1 Qos information : 0x0 AS-path 100, origin igp, MED 0, pref-val 0, valid, external, pre 255, not preferred for router ID Not advertised to any peers yet
The preceding command output shows that there are two valid routes to 192.168.1.0/24. The route with the next-hop address of 10.2.1.1 is the optimal route because the router ID of Device A is smaller. In this case, traffic enters AS 100 through Device A.
- Configure BGP RPD functions on forwarders so that the forwarders receive RPD routes delivered by the NCE and execute corresponding route-policies.
# Configure Device A.
[~DeviceA] bgp 100
[*DeviceA-bgp] peer 1.1.1.1 as-number 300
[*DeviceA-bgp] rpd-family
[*DeviceA-bgp-af-rpd] peer 1.1.1.1 enable
[*DeviceA-bgp-af-rpd] quit
[*DeviceA-bgp] ipv4-family unicast
[*DeviceA-bgp-af-ipv4] peer 10.2.1.2 rpd-policy export enable
[*DeviceA-bgp-af-ipv4] commit
[~DeviceA-bgp-af-ipv4] quit
[~DeviceA-bgp] quit
# Configure Device B.
[~DeviceB] bgp 100
[*DeviceB-bgp] peer 2.1.1.1 as-number 300
[*DeviceB-bgp] rpd-family
[*DeviceB-bgp-af-rpd] peer 2.1.1.1 enable
[*DeviceB-bgp-af-rpd] quit
[*DeviceB-bgp] ipv4-family unicast
[*DeviceB-bgp-af-ipv4] peer 10.3.1.2 rpd-policy export enable
[*DeviceB-bgp-af-ipv4] commit
[~DeviceB-bgp-af-ipv4] quit
[~DeviceB-bgp] quit
# Check information about RPD routes on Device A.[~DeviceA] display bgp rpd routing-table Total number of Routes : 1 BGP Local router ID is 4.1.1.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Network Peer MED LocPrf PrefVal Path/Ogn *> 1/10.2.1.2/1 1.1.1.1 50 0 100?
# Check the routing table of Device C.[~DeviceC] display bgp routing-table 192.168.1.0 24 BGP local router ID : 3.3.3.3 Local AS number : 200 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 192.168.1.0/24: From: 10.3.1.1 (2.2.2.2) Route Duration: 0d00h00m06s Direct Out-interface: GigabitEthernet1/0/1 Original nexthop: 10.3.1.1 Qos information : 0x0 AS-path 100, origin igp, MED 0, pref-val 0, valid, external, best, select, pre 255 Advertised to such 2 peers: 10.2.1.1 10.3.1.1 BGP routing table entry information of 192.168.1.0/24: From: 10.2.1.1 (1.1.1.1) Route Duration: 0d00h00m56s Direct Out-interface: GigabitEthernet1/0/0 Original nexthop: 10.2.1.1 Qos information : 0x0 AS-path 100, origin igp, MED 50, pref-val 0, valid, external, pre 255, not preferred for MED Not advertised to any peers yet
The preceding command output shows that the route with the next hop of 10.3.1.1 (Device B) is selected by Device C as the optimal route because its MED value 0 is smaller than that (50) of the route with the next hop of 10.2.1.1 (Device A). In this case, the traffic bypasses the congested link.
Configuration Files
Device A configuration file
#
sysname DeviceA
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.2.1.1 255.255.255.0
#
interface GigabitEthernet0/1/1
undo shutdown
ip address 1.1.1.2 255.255.255.0
#
bgp 100
router-id 1.1.1.1
peer 1.1.1.1 as-number 300
peer 10.2.1.2 as-number 200
#
ipv4-family unicast
network 192.168.1.0 255.255.255.0
peer 10.2.1.2 enable
peer 10.2.1.2 rpd-policy export enable
#
rpd-family
peer 1.1.1.1 enable
#
return
Device B configuration file
#
sysname DeviceB
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.3.1.1 255.255.255.0
#
interface GigabitEthernet0/1/1
undo shutdown
ip address 2.1.1.2 255.255.255.0
#
bgp 100
router-id 2.2.2.2
peer 2.1.1.1 as-number 300
peer 10.3.1.2 as-number 200
#
ipv4-family unicast
network 192.168.1.0 255.255.255.0
peer 10.3.1.2 enable
peer 10.3.1.2 rpd-policy export enable
#
rpd-family
peer 2.1.1.1 enable
#
return
Device C configuration file
#
sysname DeviceC
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.2.1.2 255.255.255.0
#
interface GigabitEthernet0/1/1
undo shutdown
ip address 10.3.1.2 255.255.255.0
#
bgp 200
router-id 3.3.3.3
peer 10.2.1.1 as-number 100
peer 10.3.1.1 as-number 100
#
ipv4-family unicast
peer 10.2.1.1 enable
peer 10.3.1.1 enable
#
return
Example for Configuring Dynamic BGP Peer Groups
Configuring dynamic BGP peer groups reduces network maintenance workload.
Networking Requirements
On a BGP network, multiple peers may frequently change, causing the establishment of peer relationships to change accordingly. If you configure peers in static mode, you need to frequently add or delete peer configurations on the local device, which increases the maintenance workload. To address this problem, configure the dynamic BGP peer function to enable BGP to listen for BGP connection requests from a specified network segment, dynamically establish BGP peer relationships, and add these peers to the same dynamic peer group. This spares you from adding or deleting BGP peer configurations in response to each change in BGP peers.
On the network shown in Figure 1-1825, DeviceA, DeviceD, and DeviceE are in AS 65008, and DeviceB and DeviceC are in AS 65009. Because many devices are on the same network segment in an AS, you can configure dynamic peer groups on DeviceA.
Precautions
To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Configure a dynamic IBGP peer group on DeviceA to listen for BGP connection requests from network segment 10.2.0.0/16.
Configure a dynamic EBGP peer group on DeviceA to listen for BGP connection requests from network segment 10.1.0.0/16.
Configure IBGP connections between DeviceD and DeviceA, and between DeviceE and DeviceA.
Configure EBGP connections between DeviceB and DeviceA, and between DeviceC and DeviceA.
Data Preparation
To complete the configuration, you need the following data:
AS numbers of DeviceA, DeviceD, and DeviceE
AS numbers of DeviceB and DeviceC
Procedure
- Assign an IP address to each interface. For configuration details, see Configuration Files in this section.
- Configure dynamic BGP peer groups.
# Configure dynamic BGP peer groups on DeviceA.
[~DeviceA] bgp 65008
[*DeviceA-bgp] bgp dynamic-session-limit 5
[*DeviceA-bgp] group a listen internal
[*DeviceA-bgp] peer a listen-net 10.2.0.0 16
[*DeviceA-bgp] group b listen external
[*DeviceA-bgp] peer b listen-as 65009
[*DeviceA-bgp] peer b listen-net 10.1.0.0 16
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
- Configure IBGP connections.
# Configure DeviceD.
[~DeviceD] bgp 65008
[*DeviceD-bgp] peer 10.2.1.1 as-number 65008
[*DeviceD-bgp] commit
[~DeviceD-bgp] quit
# Configure DeviceE.
[~DeviceE] bgp 65008
[*DeviceE-bgp] peer 10.2.2.1 as-number 65008
[*DeviceE-bgp] commit
[~DeviceE-bgp] quit
- Configure EBGP connections.
# Configure DeviceB.
[~DeviceB] bgp 65009
[*DeviceB-bgp] peer 10.1.1.1 as-number 65008
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
# Configure DeviceC.
[~DeviceC] bgp 65009
[*DeviceC-bgp] peer 10.1.2.1 as-number 65008
[*DeviceC-bgp] commit
[~DeviceC-bgp] quit
# Check the status of BGP connections.
[~DeviceA] display bgp peer
Status codes: * - Dynamic BGP local router ID : 10.1.1.1 Local AS number : 65008 Total number of peers : 4 Peers in established state : 4 Total number of dynamic peers : 4 Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv *10.1.1.2 4 65009 8 7 0 00:04:16 Established 0 *10.1.2.2 4 65009 5 5 0 00:02:01 Established 0 *10.2.1.2 4 65008 5 5 0 00:02:01 Established 0 *10.2.2.2 4 65008 5 5 0 00:02:01 Established 0
The command output shows that DeviceA has established BGP connections with other routers and the connection status is Established.
# Check information about BGP peer groups.
[~DeviceA] display bgp group a
BGP peer-group : a Remote AS : 65008 Authentication type configured : None Type : listen internal Configured hold timer value : 180 Keepalive timer value : 60 Connect-retry timer value : 32 Minimum route advertisement interval is 15 seconds PeerSession Members : 10.2.1.2 10.2.2.2 Peer Preferred Value: 0 No routing policy is configured Peer Members: Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv *10.2.1.2 4 65008 3 4 0 00:00:20 Established 0 *10.2.2.2 4 65008 3 4 0 00:00:21 Established 0
[~DeviceA] display bgp group b
BGP peer-group : b Remote AS : 65009 Authentication type configured : None Type : listen external Configured hold timer value : 180 Keepalive timer value : 60 Connect-retry timer value : 32 Minimum route advertisement interval is 15 seconds PeerSession Members : 10.1.1.2 10.1.2.2 Peer Preferred Value: 0 No routing policy is configured Peer Members: Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv *10.1.1.2 4 65009 3 4 0 00:00:20 Established 0 *10.1.2.2 4 65009 3 4 0 00:00:21 Established 0
The command output shows that two dynamic peer groups a and b exist on DeviceA and each dynamic peer group has two peers, indicating that the dynamic peer groups are properly established.
Configuration Files
DeviceA configuration file
#
sysname DeviceA
#
interface GigabitEthernet0/1/1
undo shutdown
ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet0/1/2
undo shutdown
ip address 10.1.2.1 255.255.255.0
#
interface GigabitEthernet0/1/3
undo shutdown
ip address 10.2.1.1 255.255.255.0
interface GigabitEthernet0/1/4
undo shutdown
ip address 10.2.2.1 255.255.255.0
#
bgp 65008
bgp dynamic-session-limit 5
group a listen internal
peer a listen-net 10.2.0.0 255.255.0.0
group b listen external
peer b listen-as 65009
peer b listen-net 10.1.0.0 255.255.0.0
#
ipv4-family unicast
peer a enable
peer b enable
#
return
DeviceB configuration file
#
sysname DeviceB
#
interface GigabitEthernet0/1/1
undo shutdown
ip address 10.1.1.2 255.255.255.0
#
bgp 65009
peer 10.1.1.1 as-number 65008
#
ipv4-family unicast
peer 10.1.1.1 enable
#
return
DeviceC configuration file
#
sysname DeviceC
#
interface GigabitEthernet0/1/1
undo shutdown
ip address 10.1.2.2 255.255.255.0
#
bgp 65009
peer 10.1.2.1 as-number 65008
#
ipv4-family unicast
peer 10.1.2.1 enable
#
return
DeviceD configuration file
#
sysname DeviceD
#
interface GigabitEthernet0/1/1
undo shutdown
ip address 10.2.1.2 255.255.255.0
#
bgp 65008
peer 10.2.1.1 as-number 65008
#
ipv4-family unicast
peer 10.2.1.1 enable
#
return
DeviceE configuration file
#
sysname DeviceE
#
interface GigabitEthernet0/1/1
undo shutdown
ip address 10.2.2.2 255.255.255.0
#
bgp 65008
peer 10.2.2.1 as-number 65008
#
ipv4-family unicast
peer 10.2.2.1 enable
#
return
Example for Configuring BGP Multi-Instance
This section provides an example for configuring BGP multi-instance to achieve instance-specific management and maintenance of routes.
Networking Requirements
On the network shown in Figure 1-1826, the public network BGP-IPv4 unicast address family is enabled in base BGP instances on DeviceA and DeviceB. An EBGP peer relationship is established in the public network BGP-IPv4 unicast address family to transmit public network routes. In addition, the VPN address family is enabled in the BGP multi-instance (an extended BGP instance) on DeviceB and in the base BGP instance on DeviceC. An EBGP-VPN peer relationship is established in the VPN address family to transmit VPN routes. In this way, routes can be managed and maintained on a per BGP instance basis.
Precautions
To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
- Enable the public network BGP-IPv4 unicast address family in base BGP instances on DeviceA and DeviceB, and establish an EBGP peer relationship in this address family.
- Enable the VPN address family in the BGP multi-instance on DeviceB and in the base BGP instance on DeviceC, and establish an EBGP-VPN peer relationship in this address family.
Data Preparation
To complete the configuration, you need the following data:
DeviceA's AS number: 100
DeviceB's AS numbers: 100 and 200
- DeviceC's AS number: 200
Procedure
- Enable the public network BGP-IPv4 unicast address family in base BGP instances on DeviceA and DeviceB, and establish an EBGP peer relationship in this address family.
# Configure DeviceA.
[~HUAWEI] sysname DeviceA
[*HUAWEI] commit
[*DeviceA] interface gigabitethernet0/1/0
[*DeviceA-GigabitEthernet0/1/0] ip address 10.1.1.1 24
[*DeviceA-GigabitEthernet0/1/0] commit
[~DeviceA-GigabitEthernet0/1/0] quit
[~DeviceA] bgp 100
[*DeviceA-bgp] peer 10.1.1.2 as-number 100
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
# Configure DeviceB.
[~HUAWEI] sysname DeviceB
[*HUAWEI] commit
[*DeviceB] interface gigabitethernet0/1/0
[*DeviceB-GigabitEthernet0/1/0] ip address 10.1.1.2 24
[*DeviceB-GigabitEthernet0/1/0] commit
[~DeviceB-GigabitEthernet0/1/0] quit
[~DeviceB] bgp 100
[*DeviceB-bgp] peer 10.1.1.1 as-number 100
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
After the configuration is complete, run the ping command to check the connectivity between DeviceA and DeviceB. Then, run the display bgp peer command to check the EBGP peer relationship. The command output shows that the public network EBGP peer relationship between DeviceA and DeviceB is Established.
The following example uses the ping result and command output on DeviceB.
<DeviceB> ping 10.1.1.1
PING 10.1.1.1: 56 data bytes, press CTRL_C to break Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=255 time=30 ms Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=255 time=16 ms Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=255 time=7 ms Reply from 10.1.1.1: bytes=56 Sequence=4 ttl=255 time=6 ms Reply from 10.1.1.1: bytes=56 Sequence=5 ttl=255 time=9 ms --- 10.1.1.1 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 6/13/30 ms
<DeviceB> display bgp peer
BGP local router ID : 10.1.1.2 Local AS number : 100 Total number of peers : 1 Peers in established state : 1 Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv 10.1.1.1 4 200 5 5 0 00:00:20 Established 0
- Enable the VPN address family in the BGP multi-instance on DeviceB and in the base BGP instance on DeviceC, and establish an EBGP-VPN peer relationship in this address family.
# Configure DeviceB.
[~DeviceB] ip vpn-instance vpn1
[*DeviceB-vpn-instance-vpn1] ipv4-family
[*DeviceB-vpn-instance-vpn1-af-ipv4] route-distinguisher 100:3
[*DeviceB-vpn-instance-vpn1-af-ipv4] vpn-target 100:1 export-extcommunity
[*DeviceB-vpn-instance-vpn1-af-ipv4] vpn-target 100:1 import-extcommunity
[*DeviceB-vpn-instance-vpn1-af-ipv4] quit
[*DeviceB-vpn-instance-vpn1] quit
[*DeviceB] bgp 200 instance aa
[~DeviceB-bgp-instance-aa] ipv4-family vpn-instance vpn1
[*DeviceB-bgp-instance-aa-vpn1] peer 10.1.2.3 as-number 200
[*DeviceB-bgp-instance-aa-vpn1] quit
[*DeviceB-bgp-instance-aa] quit
[*DeviceB] interface gigabitethernet0/2/0
[*DeviceB-GigabitEthernet0/2/0] ip binding vpn-instance vpn1
[*DeviceB-GigabitEthernet0/2/0] ip address 10.1.2.2 24
[*DeviceB-GigabitEthernet0/2/0] commit
# Configure DeviceC.
[~HUAWEI] sysname DeviceC
[*HUAWEI] commit
[~DeviceC] ip vpn-instance vpn1
[*DeviceC-vpn-instance-vpn1] ipv4-family
[*DeviceC-vpn-instance-vpn1-af-ipv4] route-distinguisher 100:3
[*DeviceC-vpn-instance-vpn1-af-ipv4] vpn-target 100:1 export-extcommunity
[*DeviceC-vpn-instance-vpn1-af-ipv4] vpn-target 100:1 import-extcommunity
[*DeviceC-vpn-instance-vpn1-af-ipv4] quit
[*DeviceC-vpn-instance-vpn1] quit
[*DeviceC] bgp 200
[*DeviceC-bgp] ipv4-family vpn-instance vpn1
[*DeviceC-bgp-vpn1] peer 10.1.2.2 as-number 200
[*DeviceC-bgp-vpn1] quit
[*DeviceC-bgp] quit
[*DeviceC] interface gigabitethernet0/2/0
[*DeviceC-GigabitEthernet0/2/0] ip binding vpn-instance vpn1
[*DeviceC-GigabitEthernet0/2/0] ip address 10.1.2.3 24
[*DeviceC-GigabitEthernet0/2/0] commit
After the configuration is complete, run the ping command to check the connectivity between DeviceB and DeviceC. Then, run the display bgp instance aa vpnv4 all peer command to check the EBGP-VPN peer relationship. The command output shows that the EBGP-VPN peer relationship between DeviceB and DeviceC is Established.
The following example uses the ping result and command output on DeviceB.
<DeviceB> ping -vpn-instance vpn1 10.1.2.3
PING 10.1.2.3: 56 data bytes, press CTRL_C to break Reply from 10.1.2.3: bytes=56 Sequence=1 ttl=255 time=35 ms Reply from 10.1.2.3: bytes=56 Sequence=2 ttl=255 time=25 ms Reply from 10.1.2.3: bytes=56 Sequence=3 ttl=255 time=12 ms Reply from 10.1.2.3: bytes=56 Sequence=4 ttl=255 time=8 ms Reply from 10.1.2.3: bytes=56 Sequence=5 ttl=255 time=9 ms --- 10.1.2.3 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 8/17/35 ms
<DeviceB> display bgp instance aa vpnv4 all peer
BGP local router ID : 10.1.1.2 Local AS number : 200 Total number of peers : 1 Peers in established state : 1 Peer of IPv4-family for vpn instance : VPN-Instance vpn1, Router ID 10.1.1.2: Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv 10.1.2.3 4 100 3 3 0 00:00:03 Established 0
- Configure a static route and import it into the BGP routing table on each of DeviceA and DeviceC.
# Configure DeviceA.
[~DeviceA] ip route-static 192.168.1.1 32 NULL 0
[*DeviceA] bgp 100
[*DeviceA-bgp] import-route static
[*DeviceA-bgp] commit
# Configure DeviceC.
[~DeviceC] ip route-static vpn-instacne vpn1 192.168.3.3 32 NULL 0
[*DeviceC] bgp 200
[*DeviceC-bgp] ipv4-family vpn-instance vpn1
[*DeviceC-bgp-vpn1] import-route static
[*DeviceC-bgp-vpn1] commit
- Verify the configuration.
After the preceding configurations are complete, only a public network IPv4 route is displayed in the BGP routing table on DeviceA.
<DeviceA> display bgp routing-table
BGP Local router ID is 10.1.1.1 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 1 Network NextHop MED LocPrf PrefVal Path/Ogn *> 192.168.1.1/32 0.0.0.0 0 0 ?
A public network IPv4 route is displayed in the base BGP instance's routing table, and an IPv4 VPN route is displayed in the BGP multi-instance routing table on DeviceB.
<DeviceB> display bgp routing-table
BGP Local router ID is 10.1.1.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total Number of Routes: 1 Network NextHop MED LocPrf PrefVal Path/Ogn *> 192.168.1.1/32 10.1.1.1 0 0 ?
<DeviceB> display bgp instance aa vpnv4 all routing-table
BGP Local router ID is 10.1.1.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total number of routes from all PE: 1 Route Distinguisher: 100:44 Network NextHop MED LocPrf PrefVal Path/Ogn *> 192.168.3.3/32 10.1.2.3 0 0 100? VPN-Instance vpn1, Router ID 10.1.1.2: Total Number of Routes: 1 Network NextHop MED LocPrf PrefVal Path/Ogn *> 192.168.3.3/32 10.1.2.3 0 0 100?
Only a VPN route is displayed in the routing table of the BGP VPN instance on DeviceC.
<DeviceC> display bgp vpnv4 all routing-table
BGP Local router ID is 0.0.0.0 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete RPKI validation codes: V - valid, I - invalid, N - not-found Total number of routes from all PE: 1 Route Distinguisher: 100:44 Network NextHop MED LocPrf PrefVal Path/Ogn *> 192.168.3.3/32 0.0.0.0 0 0 ? VPN-Instance vpn1, Router ID 10.1.2.3: Total Number of Routes: 1 Network NextHop MED LocPrf PrefVal Path/Ogn *> 192.168.3.3/32 0.0.0.0 0 0 ?
Configuration Files
DeviceA configuration file
# sysname DeviceA # interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.1.1 255.255.255.0 # bgp 100 peer 10.1.1.2 as-number 100 ipv4-family unicast undo synchronization import-route static peer 10.1.1.2 enable # ip route-static 192.168.1.1 255.255.255.255 NULL0 # return
DeviceB configuration file
# sysname DeviceB # ip vpn-instance vpn1 ipv4-family route-distinguisher 100:3 apply-label per-instance vpn-target 100:1 export-extcommunity vpn-target 100:1 import-extcommunity # interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.1.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip binding vpn-instance vpn1 ip address 10.1.2.2 255.255.255.0 # bgp 100 peer 10.1.1.1 as-number 100 ipv4-family unicast undo synchronization peer 10.1.1.1 enable # bgp 200 instance vpn1 ipv4-family vpn-instance vpn1 peer 10.1.2.3 as-number 200 # return
DeviceC configuration file
# sysname DeviceC # ip vpn-instance vpn1 ipv4-family route-distinguisher 100:3 apply-label per-instance vpn-target 100:1 export-extcommunity vpn-target 100:1 import-extcommunity # interface GigabitEthernet0/2/0 undo shutdown ip binding vpn-instance vpn1 ip address 10.1.2.3 255.255.255.0 # bgp 200 ipv4-family unicast undo synchronization ipv4-family vpn-instance vpn1 import-route static peer 10.1.2.2 as-number 200 # ip route-static vpn-instance vpn1 192.168.3.3 255.255.255.255 NULL0 # return
Example for Configuring a BGP SR LSP
Deploying a complete BGP SR LSP on devices in the same AS helps implement end-to-end service interworking.
Networking Requirements
On the network shown in Figure 1-1827, OSPF runs between DeviceA and DeviceB, between DeviceB and DeviceC, and between DeviceD and DeviceE. IS-IS runs between DeviceC and DeviceD. Basic MPLS functions and MPLS LDP are configured on DeviceA through DeviceE so that LDP LSPs are established between loopback interfaces of devices in each IGP area. In this case, traffic between loopback interfaces of devices in each IGP area is encapsulated using MPLS. However, traffic cannot be transmitted across IGP areas because devices cannot ping each other across IGP areas. For example, DeviceA cannot ping DeviceE. To solve this problem, you need to configure an inner MPLS tunnel (BGP SR LSP) from 1.1.1.1 to 5.5.5.5 so that the traffic from 1.1.1.1 to 5.5.5.5 is forwarded through MPLS.
In this example, interface1 and interface2 represent GE0/1/0 and GE0/2/0, respectively.
Precautions
To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Configure IP addresses for interfaces.
Configure IGP areas.
Configure basic MPLS functions and MPLS LDP.
Configure a BGP SR LSP.
Data Preparation
To complete the configuration, you need the following data:
- MPLS LSR IDs of DeviceA through DeviceE
- SRGBs of DeviceA through DeviceE
Procedure
- Configure interface IP addresses.
Take DeviceA as an example.
<DeviceA> system-view [~DeviceA] interface gigabitethernet 0/1/0 [~DeviceA-GigabitEthernet0/1/0] ip address 10.1.1.1 24 [*DeviceA-GigabitEthernet0/1/0] quit [*DeviceA] interface loopBack 1 [*DeviceA-LoopBack1] ip address 1.1.1.1 32 [*DeviceA-LoopBack1] commit [~DeviceA-LoopBack1] quit
The interfaces that directly connect the devices can ping each other, but the devices cannot ping each other's loopback interface.
- Deploy DeviceA through DeviceC in the same IGP area, and configure OSPF on them to implement interworking in the IGP area.
Take DeviceA as an example.
[~DeviceA] ospf 1 router-id 1.1.1.1 [~DeviceA-ospf-1] area 0 [*DeviceA-ospf-1-area-0.0.0.0] network 1.1.1.1 0.0.0.0 [*DeviceA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255 [*DeviceA-ospf-1-area-0.0.0.0] commit [~DeviceA-ospf-1-area-0.0.0.0] quit [~DeviceA-ospf-1] quit
After the preceding configuration is complete, an OSPF neighbor relationship is established between DeviceA and DeviceB and between DeviceB and DeviceC. If the display ospf peer command is run, you can find that the neighbor status is Full. DeviceA and DeviceC can learn each other's Loopback 1 IP address and ping each other successfully.
Deploy DeviceD and DeviceE in another IGP area and configure OSPF on them. Their configurations are similar to the configuration of DeviceA and are not mentioned here.
- Deploy DeviceC and DeviceD in the same IGP area, and configure IS-IS on them to implement interworking in the IGP area.
Take DeviceC as an example.
[~DeviceC] isis 1 [~DeviceC-isis-1] network-entity 10.0000.0000.0000.0010.00 [*DeviceC-isis-1] quit [*DeviceC] interface gigabitethernet 0/1/0 [*DeviceC-GigabitEthernet0/1/0] isis enable [*DeviceC-GigabitEthernet0/1/00] quit [*DeviceC] interface loopBack 1 [*DeviceC--LoopBack1] isis enable [*DeviceC--LoopBack1] commit [~DeviceC--LoopBack1] quit
After the preceding configuration is complete, DeviceC and DeviceD can learn each other's Loopback 1 IP address and ping each other successfully. However, Loopback 1 interfaces on DeviceA and DeviceD cannot ping each other. This means that OSPF and IS-IS run independently on DeviceC.
- Configure basic MPLS functions and MPLS LDP to set up LDP LSPs.# Configure basic MPLS functions on DeviceA and enable LDP on the interface connected to DeviceB.
[~DeviceA] mpls lsr-id 1.1.1.1 [*DeviceA] mpls [*DeviceA-mpls] label advertise non-null [*DeviceA-mpls] quit [*DeviceA] mpls ldp [*DeviceA-mpls-ldp] quit [*DeviceA] interface gigabitethernet 0/1/0 [*DeviceA-GigabitEthernet0/1/0] mpls [*DeviceA-GigabitEthernet0/1/0] mpls ldp [*DeviceA-GigabitEthernet0/1/0] commit [~DeviceA-GigabitEthernet0/1/0] quit
Configure MPLS on DeviceB through DeviceE. Their configurations are similar to that on DeviceA and are not mentioned here. After the configuration is complete, MPLS forwarding can be implemented between devices in each IGP area.
Check the MPLS label forwarding information base on DeviceA. The command output shows that label 48122 is pushed to the data packet with destination IP address 3.3.3.3/32 and In-Label NULL and that the packet is forwarded through GigabiteEthernet0/1/0. Here, DeviceA functions as the ingress.
<DeviceA> display mpls lsp include 3.3.3.3 32 verbose
------------------------------------------------------------------------------- LSP Information: LDP LSP ------------------------------------------------------------------------------- No : 1 VrfIndex : Fec : 3.3.3.3/32 Nexthop : 10.1.1.2 In-Label : NULL Out-Label : 48122 In-Interface : ---------- Out-Interface : GigabiteEthernet0/1/0 LspIndex : 5000003 Type : Primary OutSegmentIndex : 5000002 LsrType : Ingress Outgoing TunnelType : ------ Outgoing TunnelID : 0x0 Label Operation : PUSH Mpls-Mtu : 1500 LspAge : 257 sec Ingress-ELC : Disable No : 2 VrfIndex : Fec : 3.3.3.3/32 Nexthop : 10.1.1.2 In-Label : 48124 Out-Label : 48122 In-Interface : ---------- Out-Interface : GigabiteEthernet0/2/0 LspIndex : 5000003 Type : Primary OutSegmentIndex : 5000002 LsrType : Transit Outgoing TunnelType : ------ Outgoing TunnelID : 0x0 Label Operation : SWAP Mpls-Mtu : 1500 LspAge : 257 sec Ingress-ELC : ------
Check the MPLS label forwarding information base on DeviceB. After DeviceB receives the packet with In-Label 48122 from DeviceA, DeviceB searches its label forwarding information base, swaps label 48122 with label 48120, and forwards the packet through GigabiteEthernet0/1/0. Here, DeviceB functions as a transit node.
<DeviceB> display mpls lsp include 3.3.3.3 32 verbose
------------------------------------------------------------------------------- LSP Information: LDP LSP ------------------------------------------------------------------------------- No : 1 VrfIndex : Fec : 3.3.3.3/32 Nexthop : 10.1.2.1 In-Label : NULL Out-Label : 48120 In-Interface : ---------- Out-Interface : GigabiteEthernet3/0/1 LspIndex : 5000003 Type : Primary OutSegmentIndex : 5000002 LsrType : Ingress Outgoing TunnelType : ------ Outgoing TunnelID : 0x0 Label Operation : PUSH Mpls-Mtu : 1500 LspAge : 693 sec Ingress-ELC : Disable No : 2 VrfIndex : Fec : 3.3.3.3/32 Nexthop : 10.1.2.1 In-Label : 48122 Out-Label : 48120 In-Interface : ---------- Out-Interface : GigabiteEthernet0/1/0 LspIndex : 5000003 Type : Primary OutSegmentIndex : 5000002 LsrType : Transit Outgoing TunnelType : ------ Outgoing TunnelID : 0x0 Label Operation : SWAP Mpls-Mtu : 1500 LspAge : 693 sec Ingress-ELC : ------
Check the MPLS label forwarding information base on DeviceC. After DeviceC receives the packet carrying In-Label 48120 from DeviceB, DeviceC searches its label forwarding information base, and pops out the label. Then the packet reaches its destination. Here, DeviceC functions as the egress.
<DeviceC> display mpls lsp include 3.3.3.3 32 verbose
------------------------------------------------------------------------------- LSP Information: LDP LSP ------------------------------------------------------------------------------- No : 1 VrfIndex : Fec : 3.3.3.3/32 Nexthop : 127.0.0.1 In-Label : 48120 Out-Label : NULL In-Interface : ---------- Out-Interface : ---------- LspIndex : 5000001 Type : Primary OutSegmentIndex : 4294967295 LsrType : Egress Outgoing TunnelType : ------ Outgoing TunnelID : 0x0 Label Operation : POP Mpls-Mtu : ------ LspAge : 1212 sec Ingress-ELC : ------
After the preceding configuration is complete, an LDP LSP is established in the IGP area, and data packets can be forwarded using MPLS labels only in the IGP area. When a packet reaches the IGP area border, its label is popped out, and the label-based forwarding process is complete, indicating that the packet cannot be further forwarded. Therefore, an inner MPLS tunnel (inner BGP SR LSP) needs to be established from 1.1.1.1 to 5.5.5.5 so that each MPLS packet carries two MPLS labels. When a packet reaches the IGP area border, the outer label is popped out, and there is still an inner MPLS label in the packet, according to which devices can forward the packet across IGP areas, ensuring whole-process MPLS forwarding and achieving end-to-end service interworking.
- Configure a BGP SR LSP.
a. Configure SRGBs.
# Configure DeviceA.
[~DeviceA] bgp 100 [*DeviceA-bgp] segment-routing global-block 16000 17000 [*DeviceA-bgp] quit [*DeviceA] commit
# Configure DeviceC.
[~DeviceC] bgp 100 [*DeviceC-bgp] segment-routing global-block 18000 19000 [*DeviceC-bgp] quit [*DeviceC] commit
Configure the SRGB ranges [20000-21000] and [22000-23000] for DeviceD and DeviceE, respectively. The configurations on DeviceD and DeviceE are similar to the configuration on DeviceC and are not mentioned here.
b. Configure BGP peer relationships.
# Configure DeviceA.
[~DeviceA] bgp 100 [*DeviceA-bgp] peer 3.3.3.3 as-number 100 [*DeviceA-bgp] peer 3.3.3.3 connect-interface LoopBack1 [*DeviceA-bgp] quit [*DeviceA] commit
# Configure DeviceC.
[~DeviceC] bgp 100 [*DeviceC-bgp] peer 1.1.1.1 as-number 100 [*DeviceC-bgp] peer 1.1.1.1 connect-interface LoopBack1 [*DeviceC-bgp] peer 4.4.4.4 as-number 100 [*DeviceC-bgp] peer 4.4.4.4 connect-interface LoopBack1 [*DeviceC-bgp] quit [*DeviceC] commit
The configurations on DeviceD and DeviceE are similar to the configuration on DeviceC and are not mentioned here.
c. Configure DeviceC and DeviceD as route reflectors (RRs) so that DeviceA and DeviceE can learn BGP routes from each other.
# Configure DeviceC.
[~DeviceC] bgp 100 [*DeviceC-bgp] peer 1.1.1.1 reflect-client [*DeviceC-bgp] peer 1.1.1.1 next-hop-local [*DeviceC-bgp] peer 4.4.4.4 reflect-client [*DeviceC-bgp] peer 4.4.4.4 next-hop-local [*DeviceC-bgp] quit [*DeviceC] commit
# Configure DeviceD.
[~DeviceD] bgp 100 [*DeviceD-bgp] peer 3.3.3.3 reflect-client [*DeviceD-bgp] peer 3.3.3.3 next-hop-local [*DeviceD-bgp] peer 5.5.5.5 reflect-client [*DeviceD-bgp] peer 5.5.5.5 next-hop-local [*DeviceD-bgp] quit [*DeviceD] commit
d. Configure BGP SR LSP ingresses.
# Configure DeviceA.
[~DeviceA] route-policy policy1 permit node 1 [*DeviceA-route-policy] apply mpls-label [*DeviceA-route-policy] quit [*DeviceA] bgp 100 [*DeviceA-bgp] network 1.1.1.1 32 label-index 10 [*DeviceA-bgp] peer 3.3.3.3 route-policy policy1 export [*DeviceA-bgp] peer 3.3.3.3 label-route-capability [*DeviceA-bgp] ipv4-family unicast [*DeviceA-bgp-af-ipv4] peer 3.3.3.3 prefix-sid [*DeviceA-bgp-af-ipv4] quit [*DeviceA-bgp] quit [*DeviceA] commit
# Configure DeviceE.
[~DeviceE] route-policy policy1 permit node 1 [*DeviceE-route-policy] apply mpls-label [*DeviceE-route-policy] quit [*DeviceE] bgp 100 [*DeviceE-bgp] network 5.5.5.5 32 label-index 50 [*DeviceE-bgp] peer 4.4.4.4 route-policy policy1 export [*DeviceE-bgp] peer 4.4.4.4 label-route-capability [*DeviceE-bgp] ipv4-family unicast [*DeviceE-bgp-af-ipv4] peer 4.4.4.4 prefix-sid [*DeviceE-bgp-af-ipv4] quit [*DeviceE-bgp] quit [*DeviceE] commit
e. Configure transit nodes for the BGP SR LSP.
# Configure DeviceC.
[~DeviceC] route-policy policy1 permit node 1 [*DeviceC-route-policy] if-match mpls-label [*DeviceC-route-policy] apply mpls-label [*DeviceC-route-policy] quit [*DeviceC] bgp 100 [*DeviceC-bgp] peer 1.1.1.1 label-route-capability [*DeviceC-bgp] peer 4.4.4.4 label-route-capability [*DeviceC-bgp] peer 1.1.1.1 route-policy policy1 export [*DeviceC-bgp] peer 4.4.4.4 route-policy policy1 export [*DeviceC-bgp] ipv4-family unicast [*DeviceC-bgp-af-ipv4] peer 1.1.1.1 prefix-sid [*DeviceC-bgp-af-ipv4] peer 4.4.4.4 prefix-sid [*DeviceC-bgp-af-ipv4] quit [*DeviceC-bgp] quit [*DeviceC] commit
# Configure DeviceD.
[~DeviceD] route-policy policy1 permit node 1 [*DeviceD-route-policy] if-match mpls-label [*DeviceD-route-policy] apply mpls-label [*DeviceD-route-policy] quit [*DeviceD] bgp 100 [*DeviceD-bgp] peer 3.3.3.3 label-route-capability [*DeviceD-bgp] peer 5.5.5.5 label-route-capability [*DeviceD-bgp] peer 3.3.3.3 route-policy policy1 export [*DeviceD-bgp] peer 5.5.5.5 route-policy policy1 export [*DeviceD-bgp] ipv4-family unicast [*DeviceD-bgp-af-ipv4] peer 3.3.3.3 prefix-sid [*DeviceD-bgp-af-ipv4] peer 5.5.5.5 prefix-sid [*DeviceD-bgp-af-ipv4] quit [*DeviceD-bgp] quit [*DeviceD] commit
After the configuration is complete, run the display mpls lsp command on DeviceE to view information about BGP LSPs. The command output shows that the In Label of the route with the destination IP address 5.5.5.5/32 is 22050. In this case, DeviceE instructs DeviceD to use 22050 as the BGP SR LSP label for the route with the destination IP address 5.5.5.5/32. DeviceE then creates the entry in its BGP LSP table.
[~DeviceE] display mpls lsp
Flag after Out IF: (I) - RLFA Iterated LSP, (I*) - Normal and RLFA Iterated LSP Flag after LDP FRR: (L) - Logic FRR LSP ------------------------------------------------------------------------------- LSP Information: LDP LSP ------------------------------------------------------------------------------- FEC In/Out Label In/Out IF Vrf Name 4.4.4.4/32 NULL/48120 -/Eth3/0/3 4.4.4.4/32 48121/48120 -/Eth3/0/3 5.5.5.5/32 48120/NULL -/- ------------------------------------------------------------------------------- LSP Information: BGP LSP ------------------------------------------------------------------------------- FEC In/Out Label In/Out IF Vrf Name 1.1.1.1/32 NULL/20010 -/- 5.5.5.5/32 22050/NULL -/-
Run the display mpls lsp command on DeviceC to view information about BGP LSPs. The command output shows that the In Label of the route with the destination IP address 5.5.5.5/32 is 18050. This label is notified to DeviceC by DeviceD, and DeviceC is instructed to use 18050 as the BGP SR LSP label for the route with the destination IP address 5.5.5.5/32. DeviceC then creates the entry in its BGP LSP table. In addition, the Out Label is 20050, which is notified by DeviceD.
[~DeviceC] display mpls lsp
Flag after Out IF: (I) - RLFA Iterated LSP, (I*) - Normal and RLFA Iterated LSP Flag after LDP FRR: (L) - Logic FRR LSP ------------------------------------------------------------------------------- LSP Information: LDP LSP ------------------------------------------------------------------------------- FEC In/Out Label In/Out IF Vrf Name 1.1.1.1/32 NULL/48121 -/Eth3/0/1 1.1.1.1/32 48121/48121 -/Eth3/0/1 2.2.2.2/32 NULL/48120 -/Eth3/0/1 2.2.2.2/32 48122/48120 -/Eth3/0/1 3.3.3.3/32 48120/NULL -/- 4.4.4.4/32 NULL/48120 -/Eth3/0/2 4.4.4.4/32 48123/48120 -/Eth3/0/2 ------------------------------------------------------------------------------- LSP Information: BGP LSP ------------------------------------------------------------------------------- FEC In/Out Label In/Out IF Vrf Name 1.1.1.1/32 18010/16010 -/- 5.5.5.5/32 18050/20050 -/- 5.5.5.5/32 NULL/20050 -/-
Now, two MPLS labels are available, one for the LDP LSP, and the other for the BGP LSP. Then, MPLS forwarding from DeviceA to DeviceE is implemented.
- Verify the configuration.
After the preceding configuration is complete, DeviceA and DeviceE can learn the routes to each other's interfaces and ping each other's Loopback1 interface.
Take the command output on DeviceA as an example.
<DeviceA> ping -a 1.1.1.1 5.5.5.5
PING 5.5.5.5: 56 data bytes, press CTRL_C to break Reply from 5.5.5.5: bytes=56 Sequence=1 ttl=252 time=30 ms Reply from 5.5.5.5: bytes=56 Sequence=2 ttl=252 time=23 ms Reply from 5.5.5.5: bytes=56 Sequence=3 ttl=252 time=26 ms Reply from 5.5.5.5: bytes=56 Sequence=4 ttl=252 time=28 ms Reply from 5.5.5.5: bytes=56 Sequence=5 ttl=252 time=22 ms --- 5.5.5.5 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 22/25/30 ms
Configuration Files
DeviceA configuration file
# sysname DeviceA # mpls lsr-id 1.1.1.1 # mpls label advertise non-null # mpls ldp # ipv4-family # interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.1.1 255.255.255.0 mpls mpls ldp # interface LoopBack1 ip address 1.1.1.1 255.255.255.255 # bgp 100 segment-routing global-block 16000 17000 peer 3.3.3.3 as-number 100 peer 3.3.3.3 connect-interface LoopBack1 # ipv4-family unicast undo synchronization network 1.1.1.1 255.255.255.255 label-index 10 peer 3.3.3.3 enable peer 3.3.3.3 route-policy policy1 export peer 3.3.3.3 label-route-capability peer 3.3.3.3 prefix-sid # ospf 1 router-id 1.1.1.1 area 0.0.0.0 network 1.1.1.1 0.0.0.0 network 10.1.1.0 0.0.0.255 # route-policy policy1 permit node 1 apply mpls-label # return
DeviceB configuration file
# sysname DeviceB # mpls lsr-id 2.2.2.2 # mpls label advertise non-null # mpls ldp # interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.2.2 255.255.255.0 mpls mpls ldp # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.1.2 255.255.255.0 mpls mpls ldp # interface LoopBack1 ip address 2.2.2.2 255.255.255.255 # ospf 1 router-id 2.2.2.2 area 0.0.0.0 network 2.2.2.2 0.0.0.0 network 10.1.1.0 0.0.0.255 network 10.1.2.0 0.0.0.255 # return
DeviceC configuration file
# sysname DeviceC # mpls lsr-id 3.3.3.3 # mpls label advertise non-null # mpls ldp # isis 1 network-entity 10.0000.0000.0000.0010.00 # interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.3.1 255.255.255.0 isis enable 1 mpls mpls ldp # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.2.1 255.255.255.0 mpls mpls ldp # interface LoopBack1 ip address 3.3.3.3 255.255.255.255 isis enable 1 # bgp 100 segment-routing global-block 18000 19000 peer 1.1.1.1 as-number 100 peer 1.1.1.1 connect-interface LoopBack1 peer 4.4.4.4 as-number 100 peer 4.4.4.4 connect-interface LoopBack1 # ipv4-family unicast undo synchronization peer 1.1.1.1 enable peer 1.1.1.1 route-policy policy1 export peer 1.1.1.1 reflect-client peer 1.1.1.1 next-hop-local peer 1.1.1.1 label-route-capability peer 1.1.1.1 prefix-sid peer 4.4.4.4 enable peer 4.4.4.4 route-policy policy1 export peer 4.4.4.4 reflect-client peer 4.4.4.4 next-hop-local peer 4.4.4.4 label-route-capability peer 4.4.4.4 prefix-sid # ospf 1 router-id 3.3.3.3 area 0.0.0.0 network 3.3.3.3 0.0.0.0 network 10.1.2.0 0.0.0.255 # route-policy policy1 permit node 1 if-match mpls-label apply mpls-label # return
DeviceD configuration file
# sysname DeviceD # mpls lsr-id 4.4.4.4 # mpls label advertise non-null # mpls ldp # isis 1 network-entity 10.0000.0000.0000.0020.00 # interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.4.1 255.255.255.0 mpls mpls ldp # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.3.2 255.255.255.0 isis enable 1 mpls mpls ldp # interface LoopBack1 ip address 4.4.4.4 255.255.255.255 isis enable 1 # bgp 100 segment-routing global-block 20000 21000 peer 3.3.3.3 as-number 100 peer 3.3.3.3 connect-interface LoopBack1 peer 5.5.5.5 as-number 100 peer 5.5.5.5 connect-interface LoopBack1 # ipv4-family unicast undo synchronization peer 3.3.3.3 enable peer 3.3.3.3 route-policy policy1 export peer 3.3.3.3 reflect-client peer 3.3.3.3 next-hop-local peer 3.3.3.3 label-route-capability peer 3.3.3.3 prefix-sid peer 5.5.5.5 enable peer 5.5.5.5 route-policy policy1 export peer 5.5.5.5 reflect-client peer 5.5.5.5 next-hop-local peer 5.5.5.5 label-route-capability peer 5.5.5.5 prefix-sid # ospf 2 router-id 4.4.4.4 area 0.0.0.0 network 4.4.4.4 0.0.0.0 network 10.1.4.0 0.0.0.255 # route-policy policy1 permit node 1 if-match mpls-label apply mpls-label # return
DeviceE configuration file
# sysname DeviceE # mpls lsr-id 5.5.5.5 # mpls label advertise non-null # mpls ldp # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.4.2 255.255.255.0 mpls mpls ldp # interface LoopBack1 ip address 5.5.5.5 255.255.255.255 # bgp 100 segment-routing global-block 22000 23000 peer 4.4.4.4 as-number 100 peer 4.4.4.4 connect-interface LoopBack1 # ipv4-family unicast undo synchronization network 5.5.5.5 255.255.255.255 label-index 50 peer 4.4.4.4 enable peer 4.4.4.4 route-policy policy1 export peer 4.4.4.4 label-route-capability peer 4.4.4.4 prefix-sid # ospf 2 router-id 5.5.5.5 area 0.0.0.0 network 5.5.5.5 0.0.0.0 network 10.1.4.0 0.0.0.255 # route-policy policy1 permit node 1 apply mpls-label # return
Example for Configuring a BGP Virtual Link
An SRv6 EPE virtual link can be created for a BGP multi-hop peer relationship to implement communication across a third-party network.
Networking Requirements
In Figure 1-1828, a third-party network is deployed between DeviceC and DeviceD. The two devices run IS-IS for basic routing and establish an IBGP peer relationship. IPv6 EBGP peer relationships are established between directly connected interfaces of DeviceB and DeviceC, and between directly connected interfaces of DeviceD and DeviceE. To establish an SRv6 TE Policy across the third-party network, you can configure a BGP peer relationship-based virtual link between DeviceB and DeviceE. In addition, attribute information required for SRv6 TE Policy path computation is provided, such as the link latency, metric, affinity, and SRLG. This prevents the mismatch of the address information in the link information reported by DeviceB and DeviceE through BGP-LS, which would otherwise cause a link combination failure on the controller.
Interface1 and interface2 in this example represent GE0/1/0 and GE0/2/0, respectively.
Precautions
To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Assign an IPv6 address to each interface on DeviceA through DeviceE.
Enable IS-IS, configure an IS-IS level, and specify a network entity title (NET) for DeviceC and DeviceD.
Configure a VPN instance on DeviceC and DeviceD.
- Establish an IBGP peer relationship between DeviceC and DeviceD.
- Establish an EBGP peer relationship between DeviceB and DeviceC and another one between DeviceD and DeviceE.
- Configure SRv6 SIDs and IS-IS SRv6 and configure VPN routes to carry the SID attribute on DeviceC and DeviceD.
- Configure an SRv6 TE Policy on DeviceC and DeviceD.
- Configure a tunnel policy on DeviceC and DeviceD to import VPN traffic.
- Establish an EBGP peer relationship between DeviceB and DeviceE.
- Configure a VPN instance on DeviceA and DeviceE.
- Establish an EBGP peer relationship between DeviceA and DeviceE.
- Configure SRv6 SIDs and enable IS-IS SRv6 on DeviceA, DeviceB, and DeviceE. Configure VPN routes to carry the SID attribute on DeviceA and DeviceE.
- Configure the BGP EPE and virtual link functions on DeviceB and DeviceE.
- Configure an SRv6 TE Policy on DeviceA and DeviceE.
- Configure a tunnel policy on DeviceA and DeviceE to import VPN traffic.
Data Preparation
To complete the configuration, you need the following data:
- IPv6 addresses of interfaces on DeviceA through DeviceE
- IS-IS process IDs and levels on DeviceA through DeviceD
- VPN instance names, RDs, and RTs on DeviceA, DeviceE, DeviceC, and DeviceD
Procedure
- Configure IPv6 addresses and enable IPv6 forwarding for interfaces.
# Configure DeviceA.
<DeviceA> system-view [~DeviceA] interface gigabitethernet 0/1/0 [~DeviceA-GigabitEthernet0/1/0] ipv6 enable [*DeviceA-GigabitEthernet0/1/0] ipv6 address 2001:db8:44::1 96 [*DeviceA-GigabitEthernet0/1/0] quit [*DeviceA] interface loopBack 1 [*DeviceA-LoopBack1] ipv6 enable [*DeviceA-LoopBack1] ipv6 address 2001:db8:1::1 128 [*DeviceA-LoopBack1] commit [~DeviceA-LoopBack1] quit
# Configure DeviceB.
<DeviceB> system-view [~DeviceB] interface gigabitethernet 0/1/0 [~DeviceB-GigabitEthernet0/1/0] ipv6 enable [*DeviceB-GigabitEthernet0/1/0] ipv6 address 2001:db8:11::1 96 [*DeviceB-GigabitEthernet0/1/0] quit [~DeviceB] interface gigabitethernet 0/2/0 [~DeviceB-GigabitEthernet0/2/0] ipv6 enable [*DeviceB-GigabitEthernet0/2/0] ipv6 address 2001:db8:44::2 96 [*DeviceB-GigabitEthernet0/2/0] quit [*DeviceB] interface loopBack 1 [*DeviceB-LoopBack1] ipv6 enable [*DeviceB-LoopBack1] ipv6 address 2001:db8:2::2 128 [*DeviceB-LoopBack1] commit [~DeviceB-LoopBack1] quit
# Configure DeviceC.
<DeviceC> system-view [~DeviceC] interface gigabitethernet 0/1/0 [~DeviceC-GigabitEthernet0/1/0] ipv6 enable [*DeviceC-GigabitEthernet0/1/0] ipv6 address 2001:db8:22::1 96 [*DeviceC-GigabitEthernet0/1/0] quit [*DeviceC] interface gigabitethernet 0/2/0 [*DeviceC-GigabitEthernet0/2/0] ipv6 enable [*DeviceC-GigabitEthernet0/2/0] ipv6 address 2001:db8:11::2 96 [*DeviceC-GigabitEthernet0/2/0] quit [*DeviceC] interface loopBack 1 [*DeviceC-LoopBack1] ipv6 enable [*DeviceC-LoopBack1] ipv6 address 2001:db8:3::3 128 [*DeviceC-LoopBack1] commit [~DeviceC-LoopBack1] quit
# Configure DeviceD.
<DeviceD> system-view [~DeviceD] interface gigabitethernet 0/1/0 [~DeviceD-GigabitEthernet0/1/0] ipv6 enable [*DeviceD-GigabitEthernet0/1/0] ipv6 address 2001:db8:33::1 96 [*DeviceD-GigabitEthernet0/1/0] quit [*DeviceD] interface gigabitethernet 0/2/0 [*DeviceD-GigabitEthernet0/2/0] ipv6 enable [*DeviceD-GigabitEthernet0/2/0] ipv6 address 2001:db8:22::2 96 [*DeviceD-GigabitEthernet0/2/0] quit [*DeviceD] interface loopBack 1 [*DeviceD-LoopBack1] ipv6 enable [*DeviceD-LoopBack1] ipv6 address 2001:db8:4::4 128 [*DeviceD-LoopBack1] commit [~DeviceD-LoopBack1] quit
# Configure DeviceE.
<DeviceE> system-view [~DeviceE] interface gigabitethernet 0/2/0 [~DeviceE-GigabitEthernet0/2/0] ipv6 enable [*DeviceE-GigabitEthernet0/2/0] ipv6 address 2001:db8:33::2 96 [*DeviceE-GigabitEthernet0/2/0] quit [*DeviceE] interface loopBack 1 [*DeviceE-LoopBack1] ipv6 enable [*DeviceE-LoopBack1] ipv6 address 2001:db8:5::5 128 [*DeviceE-LoopBack1] commit [~DeviceE-LoopBack1] quit
The interfaces that directly connect the devices can ping each other, but the devices cannot ping each other's loopback interface.
- Configure IS-IS.
# Configure DeviceA.
[~DeviceA] isis 1 [*DeviceA-isis-1] is-level level-1 [*DeviceA-isis-1] cost-style wide [*DeviceA-isis-1] network-entity 10.0000.0000.0001.00 [*DeviceA-isis-1] ipv6 enable topology ipv6 [*DeviceA-isis-1] quit [*DeviceA] interface gigabitethernet 0/1/0 [*DeviceA-GigabitEthernet0/1/0] isis ipv6 enable 1 [*DeviceA-GigabitEthernet0/1/0] quit [*DeviceA] interface loopBack 1 [*DeviceA-LoopBack1] isis ipv6 enable 1 [*DeviceA-LoopBack1] quit [*DeviceA] commit
# Configure DeviceB.
[~DeviceB] isis 1 [*DeviceB-isis-1] is-level level-1 [*DeviceB-isis-1] cost-style wide [*DeviceB-isis-1] network-entity 10.0000.0000.0002.00 [*DeviceB-isis-1] ipv6 enable topology ipv6 [*DeviceB-isis-1] ipv6 import-route bgp level-1 [*DeviceB-isis-1] quit [*DeviceB] interface gigabitethernet 0/2/0 [*DeviceB-GigabitEthernet0/2/0] isis ipv6 enable 1 [*DeviceB-GigabitEthernet0/2/0] quit [*DeviceB] interface loopBack 1 [*DeviceB-LoopBack1] isis ipv6 enable 1 [*DeviceB-LoopBack1] quit [*DeviceB] commit
# Configure DeviceC.
[~DeviceC] isis 100 [*DeviceC-isis-100] is-level level-2 [*DeviceC-isis-100] cost-style wide [*DeviceC-isis-100] network-entity 20.0000.0000.0001.00 [*DeviceC-isis-100] ipv6 enable topology ipv6 [*DeviceC-isis-100] quit [*DeviceC] interface gigabitethernet 0/1/0 [*DeviceC-GigabitEthernet0/1/0] isis ipv6 enable 100 [*DeviceC-GigabitEthernet0/1/0] quit [*DeviceC] interface loopBack 1 [*DeviceC-LoopBack1] isis ipv6 enable 100 [*DeviceC-LoopBack1] quit [*DeviceC] commit
# Configure DeviceD.
[~DeviceD] isis 100 [*DeviceD-isis-1] is-level level-2 [*DeviceD-isis-1] cost-style wide [*DeviceD-isis-1] network-entity 20.0000.0000.0002.00 [*DeviceD-isis-1] ipv6 enable topology ipv6 [*DeviceD-isis-1] quit [*DeviceD] interface gigabitethernet 0/2/0 [*DeviceD-GigabitEthernet0/2/0] isis ipv6 enable 100 [*DeviceD-GigabitEthernet0/2/0] quit [*DeviceD] interface loopBack 1 [*DeviceD-LoopBack1] isis ipv6 enable 100 [*DeviceD-LoopBack1] quit [*DeviceD] commit
After the configuration is complete, perform the following operations to check whether IS-IS is successfully configured.
# Display IS-IS neighbor information. DeviceC is used as an example.
[~DeviceC] display isis peer Peer information for ISIS(100) System Id Interface Circuit Id State HoldTime Type PRI -------------------------------------------------------------------------------- 0000.0000.0002* GE0/1/0 0000.0000.0002.02 Up 28s L2 64 Total Peer(s): 1
# Display IS-IS routing table information. DeviceC is used as an example.
[~DeviceC] display isis route ISIS(100) Level-2 Forwarding Table -------------------------------- IPV6 Dest. ExitInterface NextHop Cost Flags -------------------------------------------------------------------------------- 2001:DB8:3::3/1 Loop1 Direct 0 D/-/L/- 28 2001:DB8:4::4/1 GE0/1/0 FE80::865B:12FF:FE75:E73D 10 A/-/-/- 28 2001:DB8:11::/9 GE0/2/0 Direct 10 D/-/L/- 6 2001:DB8:22::/9 GE0/1/0 Direct 10 D/-/L/- 6 Flags: D-Direct, A-Added to URT, L-Advertised in LSPs, S-IGP Shortcut, U-Up/Down Bit Set, LP-Local Prefix-Sid Protect Type: L-Link Protect, N-Node Protect
- Create a VPN instance and configure the IPv6 address family capability for it on DeviceC and DeviceD, and implement access of DeviceB to DeviceC and access of DeviceE to DeviceD.
# Configure DeviceC.
[~DeviceC] ip vpn-instance vrftest [*DeviceC-vpn-instance-vrftest] ipv6-family [*DeviceC-vpn-instance-vrftest-af-ipv6] route-distinguisher 1:1 [*DeviceC-vpn-instance-vrftest-af-ipv6] vpn-target 100:1 export-extcommunity [*DeviceC-vpn-instance-vrftest-af-ipv6] vpn-target 100:1 import-extcommunity [*DeviceC-vpn-instance-vrftest-af-ipv6] quit [*DeviceC-vpn-instance-vrftest] quit [*DeviceC] interface gigabitethernet 0/2/0 [*DeviceC-GigabitEthernet0/2/0] ip binding vpn-instance vrftest [*DeviceC-GigabitEthernet0/2/0] quit [*DeviceC] commit
# Configure DeviceD.
[~DeviceD] ip vpn-instance vrftest [*DeviceD-vpn-instance-vrftest] ipv6-family [*DeviceD-vpn-instance-vrftest-af-ipv6] route-distinguisher 1:1 [*DeviceD-vpn-instance-vrftest-af-ipv6] vpn-target 100:1 export-extcommunity [*DeviceD-vpn-instance-vrftest-af-ipv6] vpn-target 100:1 import-extcommunity [*DeviceD-vpn-instance-vrftest-af-ipv6] quit [*DeviceD-vpn-instance-vrftest] quit [*DeviceD] interface gigabitethernet 0/1/0 [*DeviceD-GigabitEthernet0/1/0] ip binding vpn-instance vrftest [*DeviceD-GigabitEthernet0/1/0] quit [*DeviceD] commit
- Establish an IBGP peer relationship between DeviceC and DeviceD.
# Configure DeviceC.
[~DeviceC] bgp 100 [*DeviceC-bgp] router-id 2.22.2.2 [*DeviceC-bgp] peer 2001:db8:4::4 as-number 100 [*DeviceC-bgp] peer 2001:db8:4::4 connect-interface LoopBack1 [*DeviceC-bgp] ipv6-family vpnv6 [*DeviceC-bgp-af-vpnv6] peer 2001:db8:4::4 enable [*DeviceC-bgp-af-vpnv6] quit [*DeviceC-bgp] quit [*DeviceC] commit
# Configure DeviceD.
[~DeviceD] bgp 100 [*DeviceD-bgp] router-id 3.33.3.3 [*DeviceD-bgp] peer 2001:db8:3::3 as-number 100 [*DeviceD-bgp] peer 2001:db8:3::3 connect-interface LoopBack1 [*DeviceD-bgp] ipv6-family vpnv6 [*DeviceD-bgp-af-vpnv6] peer 2001:db8:3::3 enable [*DeviceD-bgp-af-vpnv6] quit [*DeviceD-bgp] quit [*DeviceD] commit
After the configuration is complete, run the display bgp vpnv6 all peer command on DeviceC. The command output shows that the IBGP peer relationship between DeviceC and DeviceD is in Established state.
[~DeviceC] display bgp vpnv6 all peer BGP local router ID : 2.22.2.2 Local AS number : 100 Total number of peers : 1 Peers in established state : 1 Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv 2001:db8:4::4 4 100 37 40 0 00:29:43 Established 0
- Establish an EBGP peer relationship between DeviceB and DeviceC and another one between DeviceD and DeviceE.
# Configure DeviceB.
[~DeviceB] bgp 200 [*DeviceB-bgp] router-id 1.11.1.1 [*DeviceB-bgp] peer 2001:db8:11::2 as-number 100 [*DeviceB-bgp] ipv6-family unicast [*DeviceB-bgp-af-ipv6] peer 2001:db8:11::2 enable [*DeviceB-bgp-af-ipv6] network 2001:db8:2::2 128 [*DeviceB-bgp-af-ipv6] quit [*DeviceB-bgp] quit [*DeviceB] commit
# Configure DeviceC.
[~DeviceC] bgp 100 [*DeviceC-bgp] ipv6-family vpn-instance vrftest [*DeviceC-bgp-6-vrftest] peer 2001:db8:11::1 as-number 200 [*DeviceC-bgp-6-vrftest] quit [*DeviceC-bgp] quit [*DeviceC] commit
# Configure DeviceD.
[~DeviceD] bgp 100 [*DeviceD-bgp] ipv6-family vpn-instance vrftest [*DeviceD-bgp-6-vrftest] peer 2001:db8:33::2 as-number 300 [*DeviceD-bgp-6-vrftest] quit [*DeviceD-bgp] quit [*DeviceD] commit
# Configure DeviceE.
[~DeviceE] bgp 300 [*DeviceE-bgp] router-id 4.44.4.4 [*DeviceE-bgp] peer 2001:db8:33::1 as-number 100 [*DeviceE-bgp] ipv6-family unicast [*DeviceE-bgp-af-ipv6] peer 2001:db8:33::1 enable [*DeviceE-bgp-af-ipv6] network 2001:DB8:5::5 128 [*DeviceE-bgp-af-ipv6] quit [*DeviceE-bgp] quit [*DeviceE] commit
After the configuration is complete, run the display bgp vpnv6 vpn-instance peer command to check whether a BGP peer relationship has been established between DeviceB and DeviceC, and between DeviceD and DeviceE. If the Established state is displayed in the command output, the BGP peer relationship has been established successfully.
DeviceC is used as an example.
[~DeviceC] display bgp vpnv6 vpn-instance vrftest peer BGP local router ID : 2.22.2.2 Local AS number : 100 Total number of peers : 1 Peers in established state : 1 VPN-Instance vrftest, Router ID 2.22.2.2: Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv 2001:DB8:11::1 4 200 7 5 0 00:02:29 Established 1
- Configure SRv6 SIDs and configure VPN routes to carry the SID attribute on DeviceC and DeviceD.
# Configure DeviceC.
[~DeviceC] segment-routing ipv6 [*DeviceC-segment-routing-ipv6] encapsulation source-address 2001:DB8:3::3 [*DeviceC-segment-routing-ipv6] locator locator1 ipv6-prefix 2001:DB8:333:: 64 static 32 [*DeviceC-segment-routing-ipv6-locator] opcode 2001:DB8:333::333 end psp [*DeviceC-segment-routing-ipv6-locator] quit [*DeviceC-segment-routing-ipv6] quit [*DeviceC] bgp 100 [*DeviceC-bgp] ipv6-family vpnv6 [*DeviceC-bgp-af-vpnv6] peer 2001:db8:4::4 prefix-sid [*DeviceC-bgp-af-vpnv6] quit [*DeviceC-bgp] ipv6-family vpn-instance vrftest [*DeviceC-bgp-6-vrftest] segment-routing ipv6 traffic-engineer best-effort [*DeviceC-bgp-6-vrftest] segment-routing ipv6 locator locator1 [*DeviceC-bgp-6-vrftest] quit [*DeviceC-bgp] quit [*DeviceC] isis 100 [*DeviceC-isis-100] segment-routing ipv6 locator locator1 auto-sid-disable [*DeviceC-isis-100] quit [*DeviceC] commit
# Configure DeviceD.
[~DeviceD] segment-routing ipv6 [*DeviceD-segment-routing-ipv6] encapsulation source-address 2001:DB8:4::4 [*DeviceD-segment-routing-ipv6] locator locator1 ipv6-prefix 2001:DB8:444:: 64 static 32 [*DeviceD-segment-routing-ipv6-locator] opcode 2001:DB8:444::444 end psp [*DeviceD-segment-routing-ipv6-locator] quit [*DeviceD-segment-routing-ipv6] quit [*DeviceD] bgp 100 [*DeviceD-bgp] ipv6-family vpnv6 [*DeviceD-bgp-af-vpnv6] peer 2001:DB8:3::3 prefix-sid [*DeviceD-bgp-af-vpnv6] quit [*DeviceD-bgp] ipv6-family vpn-instance vrftest [*DeviceD-bgp-6-vrftest] segment-routing ipv6 traffic-engineer best-effort [*DeviceD-bgp-6-vrftest] segment-routing ipv6 locator locator1 [*DeviceD-bgp-6-vrftest] quit [*DeviceD-bgp] quit [*DeviceD] isis 100 [*DeviceD-isis-100] segment-routing ipv6 locator locator1 auto-sid-disable [*DeviceD-isis-100] quit [*DeviceD] commit
Run the display segment-routing ipv6 local-sid end forwarding command to check information about the SRv6 local SID table.
[~DeviceC] display segment-routing ipv6 local-sid end forwarding My Local-SID End Forwarding Table --------------------------------- SID : 2001:DB8:333::333/128 FuncType : End Flavor : PSP LocatorName : locator1 LocatorID : 2 ProtocolType: STATIC ProcessID : -- UpdateTime : 2022-02-11 17:06:25.197 Total SID(s): 1
[~DeviceD] display segment-routing ipv6 local-sid end forwarding My Local-SID End Forwarding Table --------------------------------- SID : 2001:DB8:444::444/128 FuncType : End Flavor : PSP LocatorName : locator1 LocatorID : 1 ProtocolType: STATIC ProcessID : -- UpdateTime : 2022-02-11 17:08:23.955 Total SID(s): 1
- Configure an SRv6 TE Policy.
# Configure DeviceC.
[~DeviceC] segment-routing ipv6 [*DeviceC-segment-routing-ipv6] segment-list s1 [*DeviceC-segment-routing-ipv6-segment-list-s1] index 5 sid ipv6 2001:DB8:444::444 [*DeviceC-segment-routing-ipv6-segment-list-s1] quit [*DeviceC-segment-routing-ipv6] srv6-te-policy locator locator1 [*DeviceC-segment-routing-ipv6] srv6-te policy policy1 endpoint 2001:DB8:4::4 color 200 [*DeviceC-segment-routing-ipv6-policy-policy1] candidate-path preference 100 [*DeviceC-segment-routing-ipv6-policy-policy1-path] segment-list s1 [*DeviceC-segment-routing-ipv6-policy-policy1-path] quit [*DeviceC-segment-routing-ipv6-policy-policy1] quit [*DeviceC-segment-routing-ipv6] quit [*DeviceC] commit
# Configure DeviceD.
[~DeviceD] segment-routing ipv6 [*DeviceD-segment-routing-ipv6] segment-list s1 [*DeviceD-segment-routing-ipv6-segment-list-s1] index 5 sid ipv6 2001:DB8:333::333 [*DeviceD-segment-routing-ipv6-segment-list-s1] quit [*DeviceD-segment-routing-ipv6] srv6-te-policy locator locator1 [*DeviceD-segment-routing-ipv6] srv6-te policy policy1 endpoint 2001:DB8:3::3 color 200 [*DeviceD-segment-routing-ipv6-policy-policy1] candidate-path preference 100 [*DeviceD-segment-routing-ipv6-policy-policy1-path] segment-list s1 [*DeviceD-segment-routing-ipv6-policy-policy1-path] quit [*DeviceD-segment-routing-ipv6-policy-policy1] quit [*DeviceD-segment-routing-ipv6] quit [*DeviceD] commit
After the configuration is complete, run the display srv6-te policy command to check SRv6 TE Policy information.
DeviceC is used as an example.
[~DeviceC] display srv6-te policy PolicyName : policy1 Color : 200 Endpoint : 2001:DB8:4::4 TunnelId : 21 Binding SID : - TunnelType : SRv6-TE Policy DelayTimerRemain : - Policy State : Up State Change Time : 2022-02-11 17:09:59 Admin State : Up Traffic Statistics : Disable Backup Hot-Standby : Disable BFD : Disable Interface Index : - Interface Name : - Interface State : - Encapsulation Mode : Insert Candidate-path Count : 1 Candidate-path Preference : 100 Path State : Active Path Type : Primary Protocol-Origin : Configuration(30) Originator : 0, 0.0.0.0 Discriminator : 100 Binding SID : - GroupId : 21 Policy Name : policy1 Template ID : 0 Path Verification : Disable DelayTimerRemain : - Network Slice ID : - Segment-List Count : 1 Segment-List : s1 Segment-List ID : 21 XcIndex : 21 List State : Up DelayTimerRemain : - Verification State : - SuppressTimeRemain : - PMTU : 9600 Active PMTU : 9600 Weight : 1 BFD State : - Network Slice ID : - Binding SID : - Reverse Binding SID : - SID : 2001:DB8:444::444
- Configure a tunnel policy to import VPN traffic.
# Configure DeviceC.
[~DeviceC] route-policy RP1 permit node 1 [*DeviceC-route-policy] apply extcommunity color 0:200 [*DeviceC-route-policy] quit [*DeviceC] bgp 100 [*DeviceC-bgp] ipv6-family vpnv6 [*DeviceC-bgp-af-vpnv6] peer 2001:DB8:4::4 route-policy RP1 import [*DeviceC-bgp-af-vpnv6] quit [*DeviceC-bgp] quit [*DeviceC] tunnel-policy tnl_policy [*DeviceC-tunnel-policy-tnl_policy] tunnel select-seq ipv6 srv6-te-policy load-balance-number 1 [*DeviceC-tunnel-policy-tnl_policy] quit [*DeviceC] ip vpn-instance vrftest [*DeviceC-vpn-instance-vrftest] ipv6-family [*DeviceC-vpn-instance-vrftest-af-ipv6] tnl-policy tnl_policy [*DeviceC-vpn-instance-vrftest-af-ipv6] commit [~DeviceC-vpn-instance-vrftest-af-ipv6] quit [~DeviceC-vpn-instance-vrftest] quit
# Configure DeviceD.
[~DeviceD] route-policy RP1 permit node 1 [*DeviceD-route-policy] apply extcommunity color 0:200 [*DeviceD-route-policy] quit [*DeviceD] bgp 100 [*DeviceD-bgp] ipv6-family vpnv6 [*DeviceD-bgp-af-vpnv6] peer 2001:DB8:3::3 route-policy RP1 import [*DeviceD-bgp-af-vpnv6] quit [*DeviceD-bgp] quit [*DeviceD] tunnel-policy tnl_policy [*DeviceD-tunnel-policy-tnl_policy] tunnel select-seq ipv6 srv6-te-policy load-balance-number 1 [*DeviceD-tunnel-policy-tnl_policy] quit [*DeviceD] ip vpn-instance vrftest [*DeviceD-vpn-instance-vrftest] ipv6-family [*DeviceD-vpn-instance-vrftest-af-ipv6] tnl-policy tnl_policy [*DeviceD-vpn-instance-vrftest-af-ipv6] commit [~DeviceD-vpn-instance-vrftest-af-ipv6] quit [~DeviceD-vpn-instance-vrftest] quit
Check whether the loopback interfaces on DeviceB and DeviceE can ping each other.
DeviceB is used as an example.
<DeviceB>ping ipv6 -a 2001:DB8:2::2 2001:DB8:5::5 PING 2001:DB8:5::5 : 56 data bytes, press CTRL_C to break Reply from 2001:DB8:5::5 bytes=56 Sequence=1 hop limit=62 time=12 ms Reply from 2001:DB8:5::5 bytes=56 Sequence=2 hop limit=62 time=2 ms Reply from 2001:DB8:5::5 bytes=56 Sequence=3 hop limit=62 time=2 ms Reply from 2001:DB8:5::5 bytes=56 Sequence=4 hop limit=62 time=2 ms Reply from 2001:DB8:5::5 bytes=56 Sequence=5 hop limit=62 time=2 ms --- 2001:DB8:5::5 ping statistics--- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max=2/4/12 ms
After the configuration is complete, run the display ipv6 routing-table vpn-instance vrftest command to check the routing table of the VPN instance. The command output shows that VPN routes have successfully recursed to the SRv6 TE Policy.
DeviceC is used as an example.
[~DeviceC] display ipv6 routing-table vpn-instance vrftest Routing Table : vrftest Destinations : 5 Routes : 5 Destination : 2001:DB8:2::2 PrefixLength : 128 NextHop : 2001:DB8:11::1 Preference : 255 Cost : 0 Protocol : EBGP RelayNextHop : 2001:DB8:11::1 TunnelID : 0x0 Interface : GigabitEthernet0/1/0 Flags : RD Destination : 2001:DB8:5::5 PrefixLength : 128 NextHop : 2001:DB8:4::4 Preference : 255 Cost : 0 Protocol : IBGP RelayNextHop : :: TunnelID : 0x000000003400000015 Interface : policy1 Flags : RD Destination : 2001:DB8:11:: PrefixLength : 96 NextHop : 2001:DB8:11::2 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : GigabitEthernet0/1/0 Flags : D Destination : 2001:DB8:11::2 PrefixLength : 128 NextHop : ::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : GigabitEthernet0/1/0 Flags : D Destination : FE80:: PrefixLength : 10 NextHop : :: Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : NULL0 Flags : DB
[~DeviceC] display ipv6 routing-table vpn-instance vrftest 2001:DB8:5::5 verbose Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : vrftest Summary Count : 1 Destination : 2001:DB8:5::5 PrefixLength : 128 NextHop : 2001:DB8:4::4 Preference : 255 Neighbour : 2001:DB8:4::4 ProcessID : 0 Label : 3 Protocol : IBGP State : Active Adv Relied Cost : 0 Entry ID : 0 EntryFlags : 0x00000000 Reference Cnt: 0 Tag : 0 Priority : low Age : 224sec IndirectID : 0x2000306 Instance : RelayNextHop : :: TunnelID : 0x000000003400000015 Interface : policy1 Flags : RD RouteColor : 0 QoSInfo : 0x0
- Establish an EBGP peer relationship between DeviceB and DeviceE.
# Configure DeviceB.
[~DeviceB] bgp 200 [*DeviceB-bgp] peer 2001:db8:5::5 as-number 300 [*DeviceB-bgp] peer 2001:db8:5::5 ebgp-max-hop 255 [*DeviceB-bgp] peer 2001:db8:5::5 connect-interface LoopBack1 [*DeviceB-bgp] ipv6-family unicast [*DeviceB-bgp-af-ipv6] peer 2001:db8:5::5 enable [*DeviceB-bgp-af-ipv6] network 2001:db8:1::1 128 [*DeviceB-bgp-af-ipv6] quit [*DeviceB-bgp] quit [*DeviceB] commit
# Configure DeviceE.
[~DeviceE] bgp 300 [*DeviceE-bgp] peer 2001:db8:2::2 as-number 200 [*DeviceE-bgp] peer 2001:db8:2::2 ebgp-max-hop 255 [*DeviceE-bgp] peer 2001:db8:2::2 connect-interface LoopBack1 [*DeviceE-bgp] ipv6-family unicast [*DeviceE-bgp-af-ipv6] peer 2001:db8:2::2 enable [*DeviceE-bgp-af-ipv6] quit [*DeviceE-bgp] quit [*DeviceE] commit
After the configuration is complete, run the display bgp ipv6 peer command on DeviceB to check whether the EBGP peer relationship between DeviceB and DeviceE has been established. If the Established state is displayed in the command output, the EBGP peer relationship has been established successfully.
DeviceB is used as an example.
[~DeviceB] display bgp ipv6 peer BGP local router ID : 1.11.1.1 Local AS number : 200 Total number of peers : 2 Peers in established state : 2 Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv 2001:DB8:5::5 4 300 5 6 0 00:00:24 Established 1 2001:DB8:11::2 4 100 106 107 0 01:28:52 Established 1
- Create a VPN instance and configure the IPv6 address family capability for it on DeviceA and DeviceE.
# Configure DeviceA.
[~DeviceA] ip vpn-instance vrf [*DeviceA-vpn-instance-vrf] ipv6-family [*DeviceA-vpn-instance-vrf-af-ipv6] route-distinguisher 1:21 [*DeviceA-vpn-instance-vrf-af-ipv6] vpn-target 1:4 export-extcommunity [*DeviceA-vpn-instance-vrf-af-ipv6] vpn-target 1:4 import-extcommunity [*DeviceA-vpn-instance-vrf-af-ipv6] quit [*DeviceA-vpn-instance-vrf] quit [*DeviceA] interface loopBack 100 [*DeviceA-LoopBack100] ip binding vpn-instance vrf [*DeviceA-LoopBack100] ipv6 enable [*DeviceA-LoopBack100] ipv6 address 2001:db8:16::1 128 [*DeviceA-LoopBack100] quit [*DeviceA] commit
# Configure DeviceE.
[~DeviceE] ip vpn-instance vrf [*DeviceE-vpn-instance-vrf] ipv6-family [*DeviceE-vpn-instance-vrf-af-ipv6] route-distinguisher 1:21 [*DeviceE-vpn-instance-vrf-af-ipv6] vpn-target 1:4 export-extcommunity [*DeviceE-vpn-instance-vrf-af-ipv6] vpn-target 1:4 import-extcommunity [*DeviceE-vpn-instance-vrf-af-ipv6] quit [*DeviceE-vpn-instance-vrf] quit [*DeviceE] interface loopBack 100 [*DeviceE-LoopBack100] ip binding vpn-instance vrf [*DeviceE-LoopBack100] ipv6 enable [*DeviceE-LoopBack100] ipv6 address 2001:db8:15::1 128 [*DeviceE-LoopBack100] quit [*DeviceE] commit
- Establish an EBGP peer relationship between DeviceA and DeviceE.
# Configure DeviceA.
[~DeviceA] bgp 200 [*DeviceA-bgp] router-id 5.55.5.5 [*DeviceA-bgp] peer 2001:db8:5::5 as-number 300 [*DeviceA-bgp] peer 2001:db8:5::5 ebgp-max-hop 255 [*DeviceA-bgp] peer 2001:db8:5::5 connect-interface LoopBack1 [*DeviceA-bgp] ipv6-family vpnv6 [*DeviceA-bgp-af-vpnv6] peer 2001:db8:5::5 enable [*DeviceA-bgp-af-vpnv6] quit [*DeviceA-bgp] quit [*DeviceA] commit
# Configure DeviceE.
[~DeviceE] bgp 300 [*DeviceE-bgp] peer 2001:db8:1::1 as-number 200 [*DeviceE-bgp] peer 2001:db8:1::1 ebgp-max-hop 255 [*DeviceE-bgp] peer 2001:db8:1::1 connect-interface LoopBack1 [*DeviceE-bgp] ipv6-family vpnv6 [*DeviceE-bgp-af-vpnv6] peer 2001:db8:1::1 enable [*DeviceE-bgp-af-vpnv6] quit [*DeviceE-bgp] quit [*DeviceE] commit
After the configuration is complete, run the display bgp vpnv6 all peer command on DeviceA to check whether the EBGP peer relationship between DeviceA and DeviceE has been established. If the Established state is displayed in the command output, the EBGP peer relationship has been established successfully.
DeviceA is used as an example.
[~DeviceA] display bgp vpnv6 all peer BGP local router ID : 5.55.5.5 Local AS number : 200 Total number of peers : 1 Peers in established state : 1 Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv 2001:DB8:5::5 4 300 4 4 0 00:00:36 Established 1
- Configure SRv6 SIDs and configure VPN routes to carry the SID attribute on DeviceA and DeviceE.
# Configure DeviceA.
[~DeviceA] segment-routing ipv6 [*DeviceA-segment-routing-ipv6] encapsulation source-address 2001:DB8:1::1 [*DeviceA-segment-routing-ipv6] locator locator1 ipv6-prefix 2001:DB8:100:: 64 static 32 [*DeviceA-segment-routing-ipv6-locator] opcode 2001:DB8:100::111 end psp [*DeviceA-segment-routing-ipv6-locator] opcode 2001:DB8:100:600 end-op [*DeviceA-segment-routing-ipv6-locator] quit [*DeviceA-segment-routing-ipv6] quit [*DeviceA] bgp 200 [*DeviceA-bgp] ipv6-family vpnv6 [*DeviceA-bgp-af-vpnv6] peer 2001:DB8:5::5 prefix-sid [*DeviceA-bgp-af-vpnv6] quit [*DeviceA-bgp] ipv6-family vpn-instance vrf [*DeviceA-bgp-6-vrf] import-route direct [*DeviceA-bgp-6-vrf] segment-routing ipv6 traffic-engineer best-effort [*DeviceA-bgp-6-vrf] segment-routing ipv6 locator locator1 [*DeviceA-bgp-6-vrf] quit [*DeviceA-bgp] quit [*DeviceA] isis 1 [*DeviceA-isis-1] segment-routing ipv6 locator locator1 auto-sid-disable [*DeviceA-isis-1] quit [*DeviceA] commit
# Configure DeviceB.
[~DeviceB] segment-routing ipv6 [*DeviceB-segment-routing-ipv6] encapsulation source-address 2001:DB8:2::2 [*DeviceB-segment-routing-ipv6] locator locator1 ipv6-prefix 2001:DB8:200:: 64 static 32 [*DeviceB-segment-routing-ipv6-locator] opcode 2001:DB8:200::222 end psp [*DeviceB-segment-routing-ipv6-locator] quit [*DeviceB-segment-routing-ipv6] quit [*DeviceB] isis 1 [*DeviceB-isis-1] segment-routing ipv6 locator locator1 auto-sid-disable [*DeviceB-isis-1] quit [*DeviceB] bgp 200 [*DeviceB-bgp] ipv6-family unicast [*DeviceB-bgp-af-ipv6] network 2001:DB8:100:: 64 [*DeviceB-bgp-af-ipv6] network 2001:DB8:200:: 64 [*DeviceB-bgp-af-ipv6] quit [*DeviceB-bgp] quit [*DeviceB] commit
# Configure DeviceE.
[~DeviceE] segment-routing ipv6 [*DeviceE-segment-routing-ipv6] encapsulation source-address 2001:DB8:5::5 [*DeviceE-segment-routing-ipv6] locator as1 ipv6-prefix 2001:DB8:555:: 64 static 32 [*DeviceE-segment-routing-ipv6-locator] opcode 2001:DB8:555::555 end psp [*DeviceE-segment-routing-ipv6-locator] opcode 2001:DB8:555::500 end-op [*DeviceE-segment-routing-ipv6-locator] quit [*DeviceE-segment-routing-ipv6] quit [*DeviceE] bgp 300 [*DeviceE-bgp] ipv6-family unicast [*DeviceE-bgp-af-ipv6] network 2001:DB8:555:: 64 [*DeviceE-bgp-af-ipv6] ipv6-family vpnv6 [*DeviceE-bgp-af-vpnv6] peer 2001:DB8:1::1 prefix-sid [*DeviceE-bgp-af-vpnv6] quit [*DeviceE-bgp] ipv6-family vpn-instance vrf [*DeviceE-bgp-6-vpna] import-route direct [*DeviceE-bgp-6-vpna] segment-routing ipv6 traffic-engineer best-effort [*DeviceE-bgp-6-vpna] segment-routing ipv6 locator as1 [*DeviceE-bgp-6-vpna] quit [*DeviceE-bgp] quit [*DeviceE] isis 2 [*DeviceE-isis-2] segment-routing ipv6 locator as1 auto-sid-disable [*DeviceE-isis-2] quit [*DeviceE] commit
Run the display segment-routing ipv6 local-sid end forwarding command to check information about the SRv6 local SID table.
[~DeviceB] display segment-routing ipv6 local-sid end forwarding My Local-SID End Forwarding Table --------------------------------- SID : 2001:DB8:200::222/128 FuncType : End Flavor : PSP LocatorName : locator1 LocatorID : 2 ProtocolType: STATIC ProcessID : -- UpdateTime : 2022-02-11 18:03:00.703 Total SID(s): 1
- Configure the BGP EPE and virtual link functions on DeviceB and DeviceE.
When configuring BGP EPE, you need to enable the BGP-LS address family. Otherwise, BGP EPE cannot take effect. Route advertisement is not recommended for the virtual link between DeviceB and DeviceE.
# Configure DeviceB.
[~DeviceB] route-policy rp deny node 10 [*DeviceB-route-policy] quit [*DeviceB] commit [~DeviceB] bgp 200 [*DeviceB-bgp] peer 2001:db8:5::5 egress-engineering srv6 locator locator1 [*DeviceB-bgp] peer 2001:db8:5::5 virtual-link [*DeviceB-bgp] peer 2001:db8:5::5 virtual-link te metric 16777215 [*DeviceB-bgp] peer 2001:db8:5::5 virtual-link te link administrative group ff [*DeviceB-bgp] peer 2001:db8:5::5 virtual-link te srlg 4294967295 [*DeviceB-bgp] link-state-family unicast [*DeviceB-bgp-af-ls] quit [*DeviceB-bgp] ipv6-family unicast [*DeviceB-bgp-af-ipv6] peer 2001:db8:5::5 route-policy rp export [*DeviceB-bgp-af-ipv6] quit [*DeviceB-bgp] quit [*DeviceB] commit
# Configure DeviceE.
[~DeviceE] route-policy rp deny node 10 [*DeviceE-route-policy] quit [*DeviceE] commit [~DeviceE] bgp 300 [*DeviceE-bgp] peer 2001:db8:2::2 egress-engineering srv6 locator as1 [*DeviceE-bgp] peer 2001:db8:2::2 virtual-link [*DeviceE-bgp] peer 2001:db8:2::2 virtual-link te metric 16777215 [*DeviceE-bgp] peer 2001:db8:2::2 virtual-link te link administrative group ff [*DeviceE-bgp] peer 2001:db8:2::2 virtual-link te srlg 4294967295 [*DeviceE-bgp] link-state-family unicast [*DeviceE-bgp-af-ls] quit [*DeviceE-bgp] ipv6-family unicast [*DeviceE-bgp-af-ipv6] peer 2001:db8:2::2 route-policy rp export [*DeviceE-bgp-af-ipv6] quit [*DeviceE-bgp] quit [*DeviceE] commit
After the configuration is complete, run the display bgp egress-engineering command to check BGP EPE information. The command output shows SRv6 SID information.
[~DeviceB] display bgp egress-engineering Peer Node : 2001:DB8:5::5 Peer Adj Num : 1 Local ASN : 200 Remote ASN : 300 Local Router Id : 1.11.1.1 Remote Router Id : 4.44.4.4 Local Interface Address : 2001:DB8:2::2 Remote Interface Address : 2001:DB8:5::5 SRv6 SID : 2001:DB8:200::1:0:0 SRv6 SID (PSP) : 2001:DB8:200::1:0:1 SRv6 SID (PSP,USP,USD) : 2001:DB8:200::1:0:2 SRv6 SID (PSP,USP,USD,COC) : -(ONLY SUPPORT COMPRESS TYPE) Nexthop : 2001:DB8:11::2 Out Interface : GigabitEthernet0/1/0 Peer Adj : 2001:DB8:11::2 Local ASN : 200 Remote ASN : 300 Local Router Id : 1.11.1.1 Remote Router Id : 4.44.4.4 Interface Identifier : 24 Local Interface Address : 2001:DB8:11::1 Remote Interface Address : 2001:DB8:11::2 SRv6 SID : 2001:DB8:200::1:0:3 SRv6 SID (PSP) : 2001:DB8:200::1:0:4 SRv6 SID (PSP,USP,USD) : 2001:DB8:200::1:0:5 SRv6 SID (PSP,USP,USD,COC) : -(ONLY SUPPORT COMPRESS TYPE) Nexthop : 2001:DB8:11::2 Out Interface : GigabitEthernet0/1/0
[~DeviceE]display bgp egress-engineering Peer Node : 2001:DB8:2::2 Peer Adj Num : 1 Local ASN : 300 Remote ASN : 200 Local Router Id : 4.44.4.4 Remote Router Id : 1.11.1.1 Local Interface Address : 2001:DB8:5::5 Remote Interface Address : 2001:DB8:2::2 SRv6 SID : 2001:DB8:555::1:0:1 SRv6 SID (PSP) : 2001:DB8:555::1:0:2 SRv6 SID (PSP,USP,USD) : 2001:DB8:555::1:0:3 SRv6 SID (PSP,USP,USD,COC) : -(ONLY SUPPORT COMPRESS TYPE) Nexthop : 2001:DB8:33::1 Out Interface : GigabitEthernet0/2/2 Peer Adj : 2001:DB8:33::1 Local ASN : 300 Remote ASN : 200 Local Router Id : 4.44.4.4 Remote Router Id : 1.11.1.1 Interface Identifier : 17 Local Interface Address : 2001:DB8:33::2 Remote Interface Address : 2001:DB8:33::1 SRv6 SID : 2001:DB8:555::1:0:4 SRv6 SID (PSP) : 2001:DB8:555::1:0:5 SRv6 SID (PSP,USP,USD) : 2001:DB8:555::1:0:6 SRv6 SID (PSP,USP,USD,COC) : -(ONLY SUPPORT COMPRESS TYPE) Nexthop : 2001:DB8:33::1 Out Interface : GigabitEthernet0/2/2
- Configure an SRv6 TE Policy.
# Configure DeviceA.
[~DeviceA] segment-routing ipv6 [*DeviceA-segment-routing-ipv6] segment-list list1 [*DeviceA-segment-routing-ipv6-segment-list-list1] index 5 sid ipv6 2001:DB8:100::111 [*DeviceA-segment-routing-ipv6-segment-list-list1] index 10 sid ipv6 2001:DB8:200::222 [*DeviceA-segment-routing-ipv6-segment-list-list1] index 15 sid ipv6 2001:DB8:200::1:0:0 [*DeviceA-segment-routing-ipv6-segment-list-list1] quit [*DeviceA-segment-routing-ipv6] srv6-te-policy locator locator1 [*DeviceA-segment-routing-ipv6] srv6-te policy policy1 endpoint 2001:DB8:5::5 color 100 [*DeviceA-segment-routing-ipv6-policy-policy1] candidate-path preference 100 [*DeviceA-segment-routing-ipv6-policy-policy1-path] segment-list list1 [*DeviceA-segment-routing-ipv6-policy-policy1-path] quit [*DeviceA-segment-routing-ipv6-policy-policy1] quit [*DeviceA-segment-routing-ipv6] quit [*DeviceA] commit
# Configure DeviceB.
[~DeviceB] segment-routing ipv6 [*DeviceB-segment-routing-ipv6] srv6-te-policy locator locator1 [*DeviceB-segment-routing-ipv6] quit [*DeviceB] commit
# Configure DeviceE.
[~DeviceE] segment-routing ipv6 [*DeviceE-segment-routing-ipv6] segment-list list1 [*DeviceE-segment-routing-ipv6-segment-list-list1] index 10 sid ipv6 2001:DB8:555::1:0:1 [*DeviceE-segment-routing-ipv6-segment-list-list1] index 15 sid ipv6 2001:DB8:200::222 [*DeviceE-segment-routing-ipv6-segment-list-list1] index 20 sid ipv6 2001:DB8:100::111 [*DeviceE-segment-routing-ipv6-segment-list-list1] quit [*DeviceE-segment-routing-ipv6] srv6-te-policy locator as1 [*DeviceE-segment-routing-ipv6] srv6-te policy policy1 endpoint 2001:DB8:1::1 color 100 [*DeviceE-segment-routing-ipv6-policy-policy1] candidate-path preference 100 [*DeviceE-segment-routing-ipv6-policy-policy1-path] segment-list list1 [*DeviceE-segment-routing-ipv6-policy-policy1-path] quit [*DeviceE-segment-routing-ipv6-policy-policy1] quit [*DeviceE-segment-routing-ipv6] quit [*DeviceE] commit
After the configuration is complete, run the ping srv6-te policy command to check the connectivity of the SRv6 TE Policy.
<DeviceA>ping srv6-te policy policy-name policy1 end-op 2001:DB8:555::500 PING srv6-te policy : 100 data bytes, press CTRL_C to break srv6-te policy's segment list: Preference: 100; Path Type: primary; Protocol-Origin: local; Originator: 0, 0.0.0.0; Discriminator: 100; Segment-List ID: 129; Xcindex: 129; end-op: 2001:DB8:555::500 Reply from 2001:DB8:555::500 bytes=100 Sequence=1 time=1 ms Reply from 2001:DB8:555::500 bytes=100 Sequence=2 time=1 ms Reply from 2001:DB8:555::500 bytes=100 Sequence=3 time=1 ms Reply from 2001:DB8:555::500 bytes=100 Sequence=4 time=1 ms Reply from 2001:DB8:555::500 bytes=100 Sequence=5 time=1 ms --- srv6-te policy ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 1/1/1 ms
After the configuration is complete, run the display srv6-te policy command to check SRv6 TE Policy information.
DeviceA is used as an example.
[~DeviceA] display srv6-te policy PolicyName : policy1 Color : 100 Endpoint : 2001:DB8:5::5 TunnelId : 65 Binding SID : - TunnelType : SRv6-TE Policy DelayTimerRemain : - Policy State : Up State Change Time : 2022-02-11 18:15:17 Admin State : Up Traffic Statistics : Disable Backup Hot-Standby : Disable BFD : Disable Interface Index : - Interface Name : - Interface State : - Encapsulation Mode : Insert Candidate-path Count : 1 Candidate-path Preference : 100 Path State : Active Path Type : Primary Protocol-Origin : Configuration(30) Originator : 0, 0.0.0.0 Discriminator : 100 Binding SID : - GroupId : 65 Policy Name : policy1 Template ID : 0 Path Verification : Disable DelayTimerRemain : - Network Slice ID : - Segment-List Count : 1 Segment-List : list1 Segment-List ID : 129 XcIndex : 129 List State : Up DelayTimerRemain : - Verification State : - SuppressTimeRemain : - PMTU : 9600 Active PMTU : 9600 Weight : 1 BFD State : - Network Slice ID : - Binding SID : - Reverse Binding SID : - SID : 2001:DB8:100::111 2001:DB8:200::222 2001:DB8:200::1:0:0
- Configure a tunnel policy to import VPN traffic.
# Configure DeviceA.
[~DeviceA] route-policy RP1 permit node 1 [*DeviceA-route-policy] apply extcommunity color 0:100 [*DeviceA-route-policy] quit [*DeviceA] bgp 200 [*DeviceA-bgp] ipv6-family vpnv6 [*DeviceA-bgp-af-vpnv6] peer 2001:DB8:5::5 route-policy RP1 import [*DeviceA-bgp-af-vpnv6] quit [*DeviceA-bgp] quit [*DeviceA] tunnel-policy tnl_policy [*DeviceA-tunnel-policy-tnl_policy] tunnel select-seq ipv6 srv6-te-policy load-balance-number 1 [*DeviceA-tunnel-policy-tnl_policy] quit [*DeviceA] ip vpn-instance vrf [*DeviceA-vpn-instance-vrf] ipv6-family [*DeviceA-vpn-instance-vrf-af-ipv6] tnl-policy tnl_policy [*DeviceA-vpn-instance-vrf-af-ipv6] commit [~DeviceA-vpn-instance-vrf-af-ipv6] quit [~DeviceA-vpn-instance-vrf] quit
# Configure DeviceE.
[~DeviceE] route-policy RP1 permit node 1 [*DeviceE-route-policy] apply extcommunity color 0:100 [*DeviceE-route-policy] quit [*DeviceE] bgp 300 [*DeviceE-bgp] ipv6-family vpnv6 [*DeviceE-bgp-af-vpnv6] peer 2001:DB8:1::1 route-policy RP1 import [*DeviceE-bgp-af-vpnv6] quit [*DeviceE-bgp] quit [*DeviceE] tunnel-policy tnl_policy [*DeviceE-tunnel-policy-tnl_policy] tunnel select-seq ipv6 srv6-te-policy load-balance-number 1 [*DeviceE-tunnel-policy-tnl_policy] quit [*DeviceE] ip vpn-instance vrf [*DeviceE-vpn-instance-vrf] ipv6-family [*DeviceE-vpn-instance-vrf-af-ipv6] tnl-policy tnl_policy [*DeviceE-vpn-instance-vrf-af-ipv6] commit [~DeviceE-vpn-instance-vrf-af-ipv6] quit [~DeviceE-vpn-instance-vrf] quit
After the configuration is complete, run the display ipv6 routing-table vpn-instance vrf command to check the routing table of the VPN instance. The command output shows that VPN routes have successfully recursed to the SRv6 TE Policy.
DeviceA is used as an example.
[~DeviceA] display ipv6 routing-table vpn-instance vrf Routing Table : vrf Destinations : 3 Routes : 3 Destination : 2001:DB8:15::1 PrefixLength : 128 NextHop : 2001:DB8:5::5 Preference : 255 Cost : 0 Protocol : EBGP RelayNextHop : :: TunnelID : 0x000000003400000041 Interface : policy1 Flags : RD Destination : 2001:DB8:16::1 PrefixLength : 128 NextHop : 2001:db8:11::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : LoopBack100 Flags : D Destination : FE80:: PrefixLength : 10 NextHop : :: Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : NULL0 Flags : DB
[~DeviceA] display ipv6 routing-table vpn-instance vrf 2001:db8:15::1 verbose Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : vrf Summary Count : 1 Destination : 2001:DB8:15::1 PrefixLength : 128 NextHop : 2001:DB8:5::5 Preference : 255 Neighbour : 2001:DB8:5::5 ProcessID : 0 Label : 3 Protocol : EBGP State : Active Adv Relied Cost : 0 Entry ID : 0 EntryFlags : 0x00000000 Reference Cnt: 0 Tag : 0 Priority : low Age : 117sec IndirectID : 0x100049D Instance : RelayNextHop : :: TunnelID : 0x000000003400000041 Interface : policy1 Flags : RD RouteColor : 0 QoSInfo : 0x0
Configuration Files
- DeviceA configuration file
# sysname DeviceA # ip vpn-instance vrf ipv6-family route-distinguisher 1:21 tnl-policy tnl_policy apply-label per-instance vpn-target 1:4 export-extcommunity vpn-target 1:4 import-extcommunity # segment-routing ipv6 encapsulation source-address 2001:DB8:1::1 locator locator1 ipv6-prefix 2001:DB8:100:: 64 static 32 opcode 2001:DB8:100::111 end psp opcode 2001:DB8:100:600 end-op srv6-te-policy locator locator1 segment-list list1 index 5 sid ipv6 2001:DB8:100::111 index 10 sid ipv6 2001:DB8:200::222 index 15 sid ipv6 2001:DB8:200::1:0:0 srv6-te policy policy1 endpoint 2001:DB8:5::5 color 100 candidate-path preference 100 segment-list list1 # isis 1 is-level level-1 cost-style wide network-entity 10.0000.0000.0001.00 # ipv6 enable topology ipv6 segment-routing ipv6 locator locator1 auto-sid-disable # # interface GigabitEthernet0/3/0 undo shutdown ipv6 enable ipv6 address 2001:DB8:44::1/96 isis ipv6 enable 1 undo dcn # interface LoopBack 1 ipv6 enable ipv6 address 2001:DB8:1::1/128 isis ipv6 enable 1 # interface LoopBack100 ip binding vpn-instance vrf ipv6 enable ipv6 address 2001:DB8:16::1/128 # bgp 200 router-id 5.55.5.5 private-4-byte-as enable peer 2001:DB8:5::5 as-number 300 peer 2001:DB8:5::5 ebgp-max-hop 255 peer 2001:DB8:5::5 connect-interface LoopBack1 # ipv4-family unicast undo synchronization # ipv6-family vpnv6 policy vpn-target peer 2001:DB8:5::5 enable peer 2001:DB8:5::5 route-policy RP1 import peer 2001:DB8:5::5 prefix-sid # ipv6-family vpn-instance vrf import-route direct segment-routing ipv6 locator locator1 segment-routing ipv6 traffic-engineer best-effort # route-policy RP1 permit node 1 apply extcommunity color 0:100 # tunnel-policy tnl_policy tunnel select-seq ipv6 srv6-te-policy load-balance-number 1 # return
DeviceB configuration file
# sysname DeviceB # segment-routing ipv6 encapsulation source-address 2001:DB8:2::2 locator locator1 ipv6-prefix 2001:DB8:200:: 64 static 32 opcode 2001:DB8:200::222 end psp srv6-te-policy locator locator1 # isis 1 is-level level-1 cost-style wide network-entity 10.0000.0000.0002.00 # ipv6 enable topology ipv6 segment-routing ipv6 locator locator1 ipv6 import-route bgp level-1 # # interface GigabitEthernet0/1/0 undo shutdown ipv6 enable ipv6 address 2001:DB8:11::1/96 # interface GigabitEthernet0/2/0 undo shutdown ipv6 enable ipv6 address 2001:DB8:44::2/96 isis ipv6 enable 1 # interface LoopBack1 ipv6 enable ipv6 address 2001:DB8:2::2/128 # bgp 200 router-id 1.11.1.1 private-4-byte-as enable peer 2001:DB8:5::5 as-number 300 peer 2001:DB8:5::5 ebgp-max-hop 255 peer 2001:DB8:5::5 connect-interface LoopBack1 peer 2001:DB8:5::5 egress-engineering srv6 locator locator1 peer 2001:DB8:5::5 virtual-link peer 2001:DB8:5::5 virtual-link te metric 16777215 peer 2001:DB8:5::5 virtual-link te link administrative group ff peer 2001:DB8:5::5 virtual-link te srlg 4294967295 peer 2001:DB8:11::2 as-number 100 # ipv4-family unicast undo synchronization # link-state-family unicast # ipv6-family unicast undo synchronization network 2001:DB8:1::1 128 network 2001:DB8:2::2 128 network 2001:DB8:100:: 64 network 2001:DB8:200:: 64 peer 2001:DB8:5::5 enable peer 2001:DB8:5::5 route-policy rp export peer 2001:DB8:11::2 enable # route-policy rp deny node 10 # return
DeviceC configuration file
# sysname DeviceC # ip vpn-instance vrftest ipv6-family route-distinguisher 1:1 tnl-policy tnl_policy apply-label per-instance vpn-target 100:1 export-extcommunity vpn-target 100:1 import-extcommunity # segment-routing ipv6 encapsulation source-address 2001:DB8:3::3 locator locator1 ipv6-prefix 2001:DB8:333:: 64 static 32 opcode 2001:DB8:333::333 end psp srv6-te-policy locator locator1 segment-list s1 index 5 sid ipv6 2001:DB8:444::444 srv6-te policy policy1 endpoint 2001:DB8:4::4 color 200 candidate-path preference 100 segment-list s1 # isis 100 is-level level-2 cost-style wide network-entity 20.0000.0000.0001.00 # ipv6 enable topology ipv6 segment-routing ipv6 locator locator1 auto-sid-disable # # interface GigabitEthernet0/1/0 undo shutdown ipv6 enable ipv6 address 2001:DB8:22::1/96 isis ipv6 enable 100 # interface GigabitEthernet0/2/0 undo shutdown ip binding vpn-instance vrftest ipv6 enable ipv6 address 2001:DB8:11::2/96 # interface LoopBack1 ipv6 enable ipv6 address 2001:DB8:3::3/128 isis ipv6 enable 100 # bgp 100 router-id 2.22.2.2 private-4-byte-as enable peer 2001:DB8:4::4 as-number 100 peer 2001:DB8:4::4 connect-interface LoopBack1 # ipv4-family unicast undo synchronization # ipv6-family unicast undo synchronization # ipv6-family vpnv6 policy vpn-target peer 2001:DB8:4::4 enable peer 2001:DB8:4::4 route-policy RP1 import peer 2001:DB8:4::4 prefix-sid # ipv6-family vpn-instance vrftest segment-routing ipv6 locator locator1 segment-routing ipv6 traffic-engineer best-effort peer 2001:DB8:11::1 as-number 200 # route-policy RP1 permit node 1 apply extcommunity color 0:200 # tunnel-policy tnl_policy tunnel select-seq ipv6 srv6-te-policy load-balance-number 1 # return
DeviceD configuration file
# sysname DeviceD # ip vpn-instance vrftest ipv6-family route-distinguisher 1:1 tnl-policy tnl_policy apply-label per-instance vpn-target 100:1 export-extcommunity vpn-target 100:1 import-extcommunity # segment-routing ipv6 encapsulation source-address 2001:DB8:4::4 locator locator1 ipv6-prefix 2001:DB8:444:: 64 static 32 opcode 2001:DB8:444::444 end psp srv6-te-policy locator locator1 segment-list s1 index 5 sid ipv6 2001:DB8:333::333 srv6-te policy policy1 endpoint 2001:DB8:3::3 color 200 candidate-path preference 100 segment-list s1 # isis 100 is-level level-2 cost-style wide network-entity 20.0000.0000.0002.00 # ipv6 enable topology ipv6 segment-routing ipv6 locator locator1 auto-sid-disable # # interface GigabitEthernet0/1/0 undo shutdown ip binding vpn-instance vrftest ipv6 enable ipv6 address 2001:DB8:33::1/96 # interface GigabitEthernet0/2/0 undo shutdown ipv6 enable ipv6 address 2001:DB8:22::2/96 isis ipv6 enable 1 # interface LoopBack1 ipv6 enable ipv6 address 2001:DB8:4::4/128 isis ipv6 enable 1 # bgp 100 router-id 3.33.3.3 private-4-byte-as enable peer 2001:DB8:3::3 as-number 100 peer 2001:DB8:3::3 connect-interface LoopBack1 # ipv4-family unicast undo synchronization # ipv6-family unicast undo synchronization # ipv6-family vpnv6 policy vpn-target peer 2001:DB8:3::3 enable peer 2001:DB8:3::3 route-policy RP1 import peer 2001:DB8:3::3 prefix-sid # ipv6-family vpn-instance vrftest segment-routing ipv6 locator locator1 segment-routing ipv6 traffic-engineer best-effort peer 2001:DB8:33::2 as-number 300 # route-policy RP1 permit node 1 apply extcommunity color 0:200 # tunnel-policy tnl_policy tunnel select-seq ipv6 srv6-te-policy load-balance-number 1 # return
DeviceE configuration file
# sysname DeviceE # ip vpn-instance vrf ipv6-family route-distinguisher 1:21 tnl-policy tnl_policy apply-label per-instance vpn-target 1:4 export-extcommunity vpn-target 1:4 import-extcommunity # segment-routing ipv6 encapsulation source-address 2001:DB8:5::5 locator as1 ipv6-prefix 2001:DB8:555:: 64 static 32 opcode 2001:DB8:555::555 end psp opcode 2001:DB8:555::500 end-op srv6-te-policy locator as1 segment-list list1 index 10 sid ipv6 2001:DB8:555::1:0:1 index 15 sid ipv6 2001:DB8:200::222 index 20 sid ipv6 2001:DB8:100::111 srv6-te policy policy1 endpoint 2001:DB8:1::1 color 100 candidate-path preference 100 segment-list list1 # isis 2 # segment-routing ipv6 locator as1 auto-sid-disable # # interface GigabitEthernet0/2/0 undo shutdown ipv6 enable ipv6 address 2001:DB8:33::2/96 # interface LoopBack1 ipv6 enable ipv6 address 2001:DB8:5::5/128 # interface LoopBack100 ip binding vpn-instance vrf ipv6 enable ipv6 address 2001:DB8:15::1/128 # bgp 300 router-id 4.44.4.4 private-4-byte-as enable peer 2001:DB8:1::1 as-number 200 peer 2001:DB8:1::1 ebgp-max-hop 255 peer 2001:DB8:1::1 connect-interface LoopBack1 peer 2001:DB8:2::2 as-number 100 peer 2001:DB8:2::2 ebgp-max-hop 255 peer 2001:DB8:2::2 connect-interface LoopBack1 peer 2001:DB8:2::2 egress-engineering srv6 locator as1 peer 2001:DB8:2::2 virtual-link peer 2001:DB8:2::2 virtual-link te metric 16777215 peer 2001:DB8:2::2 virtual-link te link administrative group ff peer 2001:DB8:2::2 virtual-link te srlg 4294967295 peer 2001:DB8:33::1 as-number 100 # ipv4-family unicast undo synchronization # link-state-family unicast # ipv6-family unicast undo synchronization network 2001:DB8:5::5 128 network 2001:DB8:555:: 64 peer 2001:DB8:2::2 enable peer 2001:DB8:2::2 route-policy rp export peer 2001:DB8:33::1 enable # ipv6-family vpnv6 policy vpn-target peer 2001:DB8:1::1 enable peer 2001:DB8:1::1 route-policy RP1 import peer 2001:DB8:1::1 prefix-sid # ipv6-family vpn-instance vrf import-route direct segment-routing ipv6 locator as1 segment-routing ipv6 traffic-engineer best-effort # route-policy RP1 permit node 1 apply extcommunity color 0:100 # route-policy rp deny node 10 # tunnel-policy tnl_policy tunnel select-seq ipv6 srv6-te-policy load-balance-number 1 # return
Example for Configuring BGP Routing Loop Detection
This section describes how to configure BGP routing loop detection to detect potential routing loops on a network.
Networking Requirements
On the network shown in Figure 1-1829, DeviceA, DeviceB, and DeviceC belong to AS 100. An IBGP peer relationship is established between DeviceA and the RR, between the RR and DeviceB, and between the RR and DeviceC. OSPF runs on DeviceB and DeviceC. DeviceB is configured to import BGP routes to OSPF, and DeviceC is configured to import OSPF routes to BGP. An export policy is configured on DeviceA to add AS numbers to the AS_Path attribute for the routes to be advertised to the RR. After receiving a BGP route from DeviceA, the RR advertises this route to DeviceB. DeviceB then imports the BGP route to convert it to an OSPF route and advertises the OSPF route to DeviceC. DeviceC then imports the OSPF route to convert it to a BGP route and advertises the BGP route to the RR. When comparing the route advertised by DeviceA and the route advertised by DeviceC, the RR prefers the one advertised by DeviceC because the AS_Path of the route advertised by DeviceA is longer than that of the route advertised by DeviceC. As a result, a stable routing loop occurs.
To address this problem, enable BGP routing loop detection on DeviceC. After BGP routing loop detection is enabled, DeviceC adds Loop-detection attribute 1 to the BGP route imported from OSPF and advertises the BGP route to the RR. After receiving this BGP route, the RR advertises it (carrying Loop-detection attribute 1) to DeviceB. As OSPF routing loop detection is enabled by default, when the BGP route is imported to become an OSPF route on DeviceB, the OSPF route inherits the routing loop attribute of the BGP route and has an OSPF routing loop attribute added as well before the OSPF route is advertised to DeviceC. Upon receipt of the OSPF route, DeviceC imports it to convert it to a BGP route. Because BGP routing loop detection is enabled, the BGP route inherits the routing loop attributes of the OSPF route. Upon receipt of the route, DeviceC finds that the received route carries its own routing loop attribute and therefore determines that a routing loop has occurred. In this case, DeviceC generates an alarm, and reduces the local preference and increases the MED value of the route before advertising the route to the RR. After receiving the route, the RR compares this route with the route advertised by DeviceA. Because the route advertised by DeviceC has a lower local preference and a larger MED value, the RR preferentially selects the route advertised by DeviceA. The routing loop is then resolved.
When the OSPF route is transmitted to DeviceC again, DeviceC imports it to convert it to a BGP route, and the route carries only the OSPF routing loop attribute added by DeviceB. However, DeviceC still considers the route as a looped route because the route has a routing loop record. In this case, the RR does not preferentially select the route after receiving it from DeviceC. Then routes converge normally.
Interface1, interface2, and interface3 in this example represent GE0/1/1, GE0/1/2, and GE0/1/3, respectively.
Precautions
To improve security, you are advised to deploy BGP security measures. For details, see "Configuring BGP Security." Keychain authentication is used as an example. For details, see "Example for Configuring BGP Keychain."
Configuration Roadmap
The configuration roadmap is as follows:
Configure IP addresses for interfaces.
Configure an IGP area and IBGP peers.
Configure route import on DeviceB and DeviceC.
- Configure an export policy on DeviceA to add AS numbers to the AS_Path attribute for the routes to be advertised to the RR. This configuration helps simulate a routing loop scenario.
Configure BGP routing loop detection on DeviceC.
Data Preparation
To complete the configuration, you need the following data:
- IP addresses of devices A through C
- AS number of devices A through C
Procedure
- Configure IP addresses for interfaces.
DeviceA is used as an example.
<DeviceA> system-view [~DeviceA] interface gigabitethernet 0/1/1 [~DeviceA-GigabitEthernet0/1/1] ip address 10.1.1.1 24 [*DeviceA-GigabitEthernet0/1/1] quit [*DeviceA] commit
For other devices, see the configuration files.
- Configure OSPF on DeviceB and DeviceC to implement interworking in the IGP area.
# Configure DeviceB.
[~DeviceB] ospf 1 [*DeviceB-ospf-1] area 0 [*DeviceB-ospf-1-area-0.0.0.0] network 10.1.3.0 0.0.0.255 [*DeviceB-ospf-1-area-0.0.0.0] commit [~DeviceB-ospf-1-area-0.0.0.0] quit [~DeviceB-ospf-1] quit
# Configure DeviceC.[~DeviceC] ospf 1 [*DeviceC-ospf-1] area 0 [*DeviceC-ospf-1-area-0.0.0.0] network 10.1.3.0 0.0.0.255 [*DeviceC-ospf-1-area-0.0.0.0] commit [~DeviceC-ospf-1-area-0.0.0.0] quit [~DeviceC-ospf-1] quit
- Establish an IBGP peer relationship between DeviceA and the RR, between the RR and DeviceB, and between the RR and DeviceC.
# Configure DeviceA.
[~DeviceA] bgp 100 [*DeviceA-bgp] router-id 1.1.1.1 [*DeviceA-bgp] peer 10.1.1.2 as-number 100 [*DeviceA-bgp] quit [*DeviceA] commit
# Configure the RR.
[~RR] bgp 100 [*RR-bgp] router-id 2.2.2.2 [*RR-bgp] peer 10.1.1.2 as-number 100 [*RR-bgp] peer 10.1.2.2 as-number 100 [*RR-bgp] peer 10.1.4.1 as-number 100 [*RR-bgp] ipv4-family unicast [*RR-bgp-af-ipv4] peer 10.1.2.2 reflect-client [*RR-bgp-af-ipv4] quit [*RR-bgp] quit [*RR] commit
# Configure DeviceB.
[~DeviceB] bgp 100 [*DeviceB-bgp] router-id 3.3.3.3 [*DeviceB-bgp] peer 10.1.2.1 as-number 100 [*DeviceB-bgp] quit [*DeviceB] commit
# Configure DeviceC.
[~DeviceC] bgp 100 [*DeviceB-bgp] router-id 4.4.4.4 [*DeviceC-bgp] peer 10.1.4.2 as-number 100 [*DeviceC-bgp] quit [*DeviceC] commit
- Configure BGP to import static routes and direct routes.
# Configure DeviceA to import static routes.
[~DeviceA] bgp 100 [*DeviceA-bgp] ipv4-family unicast [*DeviceA-bgp-af-ipv4] import-route static [*DeviceA-bgp-af-ipv4] quit [*DeviceA-bgp] quit [*DeviceA] commit
# Configure the RR to import direct routes.
[~RR] bgp 100 [*RR-bgp] ipv4-family unicast [*RR-bgp-af-ipv4] import-route direct [*RR-bgp-af-ipv4] quit [*RR-bgp] quit [*RR] commit
- Configure DeviceB to import BGP routes into OSPF.
[~DeviceB] ospf 1 [*DeviceB-ospf-1] import-route bgp permit-ibgp [*DeviceB-ospf-1] commit [~DeviceB-ospf-1] quit
- Configure DeviceC to import OSPF routes into BGP.
# Configure DeviceC.
[~DeviceC] bgp 100 [*DeviceC-bgp] import-route ospf 1 [*DeviceC-bgp] quit [*DeviceC] commit
- Configure a route-policy.
# Configure DeviceA to add AS numbers to the AS_Path attribute for the routes to be advertised.
[~DeviceA] route-policy ex1 permit node 10 [*DeviceA-route-policy] apply as-path 700 8000 additive [*DeviceA-route-policy] quit [*DeviceA] commit [~DeviceA] bgp 100 [*DeviceA-bgp] ipv4-family unicast [*DeviceA-bgp-af-ipv4] peer 10.1.1.2 route-policy ex1 export [*DeviceA-bgp-af-ipv4] quit [*DeviceA-bgp] quit [*DeviceA] commit
- Configure a static route.
# Configure DeviceA to simulate a looped route.
[~DeviceA] ip route-static 10.7.7.7 255.255.255.255 NULL0 [*DeviceA] commit
- Verify the configuration.
After the configuration is complete, check the BGP routing table on the RR. The command output shows that the RR has preferentially selected the route received from DeviceC and that a stable routing loop is formed. The route learned from DeviceA is not selected as the optimal route because the AS_Path of the route learned from DeviceA is longer than that of the route learned from DeviceC.
<RR> display bgp routing-table 10.7.7.7 BGP local router ID : 2.2.2.2 Local AS number : 100 Paths: 2 available, 1 best, 1 select, 0 best-external, 0 add-path BGP routing table entry information of 10.7.7.7/32: From: 10.1.4.1 (4.4.4.4) Route Duration: 0d00h00m10s Relay IP Nexthop: 10.1.4.1 Relay IP Out-Interface: GigabitEthernet0/1/3 Original nexthop: 10.1.4.1 Qos information : 0x0 AS-path Nil, origin incomplete, MED 1, localpref 100, pref-val 0, valid, internal, best, select, pre 255 Advertised to such 1 peers: 10.1.2.2 BGP routing table entry information of 10.7.7.7/32: From: 10.1.1.1 (1.1.1.1) Route Duration: 0d01h19m49s Relay IP Nexthop: 10.1.1.1 Relay IP Out-Interface: GigabitEthernet0/1/2 Original nexthop: 10.1.1.1 Qos information : 0x0 AS-path 700 8000, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal, pre 255, not preferred for AS-Path Not advertised to any peer yet
- Configure BGP routing loop detection.
# Configure DeviceC.
[~DeviceC] route loop-detect bgp enable [*DeviceC] commit
- Verify the configuration.
After BGP routing loop detection is configured, DeviceC determines that the received route 10.7.7.7 is a looped route. Therefore, DeviceC reduces the local preference and increases the MED value of the route before advertising the route to the RR. After receiving the route, the RR compares this route with the route advertised by DeviceA. Because the route advertised by DeviceC has a lower local preference and a larger MED value, the RR preferentially selects the route advertised by DeviceA. This resolves the routing loop.
<RR> display bgp routing-table 10.7.7.7 BGP local router ID : 2.2.2.2 Local AS number : 100 Paths: 2 available, 1 best, 1 select, 0 best-external, 0 add-path BGP routing table entry information of 10.7.7.7/32: From: 10.1.1.1 (1.1.1.1) Route Duration: 0d01h21m03s Relay IP Nexthop: 10.1.1.1 Relay IP Out-Interface: GigabitEthernet0/1/2 Original nexthop: 10.1.1.1 Qos information : 0x0 AS-path 700 8000, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal, best, select, pre 255 Advertised to such 1 peers: 10.1.2.2 BGP routing table entry information of 10.7.7.7/32: From: 10.1.4.1 (4.4.4.4) Route Duration: 0d00h00m09s Relay IP Nexthop: 10.1.4.1 Relay IP Out-Interface: GigabitEthernet0/1/3 Original nexthop: 10.1.4.1 Qos information : 0x0 AS-path Nil, origin incomplete, MED 4294967295, localpref 0, pref-val 0, valid, internal, pre 255, not preferred for Local_Pref Not advertised to any peer yet
Configuration Files
DeviceA configuration file
# sysname DeviceA # interface GigabitEthernet0/1/1 undo shutdown ip address 10.1.1.1 255.255.255.0 # bgp 100 router-id 1.1.1.1 private-4-byte-as enable peer 10.1.1.2 as-number 100 # ipv4-family unicast undo synchronization import-route static peer 10.1.1.2 enable peer 10.1.1.2 route-policy ex1 export # route-policy ex1 permit node 10 apply as-path 700 8000 additive # ip route-static 10.7.7.7 255.255.255.255 NULL0 # return
RR configuration file
# sysname RR # interface GigabitEthernet0/1/1 undo shutdown ip address 10.1.2.1 255.255.255.0 # interface GigabitEthernet0/1/2 undo shutdown ip address 10.1.1.2 255.255.255.0 # interface GigabitEthernet0/1/3 undo shutdown ip address 10.1.4.2 255.255.255.0 # bgp 100 router-id 2.2.2.2 private-4-byte-as enable peer 10.1.1.1 as-number 100 peer 10.1.2.2 as-number 100 peer 10.1.4.1 as-number 100 # ipv4-family unicast undo synchronization import-route direct peer 10.1.1.1 enable peer 10.1.2.2 enable peer 10.1.2.2 reflect-client peer 10.1.4.1 enable # return
DeviceB configuration file
# sysname DeviceB # interface GigabitEthernet0/1/1 undo shutdown ip address 10.1.3.1 255.255.255.0 ospf enable 1 area 0.0.0.0 # interface GigabitEthernet0/1/2 undo shutdown ip address 10.1.2.2 255.255.255.0 # bgp 100 router-id 3.3.3.3 private-4-byte-as enable peer 10.1.2.1 as-number 100 # ipv4-family unicast undo synchronization peer 10.1.2.1 enable # ospf 1 import-route bgp permit-ibgp opaque-capability enable area 0.0.0.0 network 10.1.3.0 0.0.0.255 # return
DeviceC configuration file
# sysname DeviceC # interface GigabitEthernet0/1/1 undo shutdown ip address 10.1.4.1 255.255.255.0 # interface GigabitEthernet0/1/2 undo shutdown ip address 10.1.3.2 255.255.255.0 ospf enable 1 area 0.0.0.0 # bgp 100 router-id 4.4.4.4 private-4-byte-as enable peer 10.1.4.2 as-number 100 # ipv4-family unicast undo synchronization import-route ospf 1 peer 10.1.4.2 enable # route loop-detect bgp enable # ospf 1 opaque-capability enable area 0.0.0.0 network 10.1.3.0 0.0.0.255 # return
- BGP Description
- Overview of BGP
- Understanding BGP
- BGP Fundamentals
- BGP Message Format
- BGP Route Processing
- Community Attribute
- Large-Community Attribute
- AIGP
- Entropy Label
- BGP Routing Loop Detection
- BGP Peer Group and Dynamic Peer Group
- BGP Confederation
- Route Reflector
- Route Server
- BGP VPN Route Leaking
- MP-BGP
- BGP Security
- BGP GR
- BFD for BGP
- BGP Peer Tracking
- BGP 6PE
- BGP ORF
- VPN ORF
- BGP Auto FRR
- BGP NSR
- BGP Dynamic Update Peer-Group
- 4-Byte AS Number
- Fake AS Number
- BMP
- BGP Best External
- BGP Add-Path
- Route Dampening
- Suppression on BGP Peer Flapping
- BGP Recursion Suppression in Case of Next Hop Flapping
- BGP-LS
- BGP RPD
- BGP Multi-instance
- BGP SR LSP
- BGP Configuration
- BGP Overview
- Configuration Precautions for BGP
- Configuring Basic BGP Functions
- Configuring the Format of BGP 4-Byte AS Numbers
- Configuring BGP Route Attributes
- Setting the BGP Preference
- Setting a PrefVal for BGP Routes
- Setting the Default Local_Pref Attribute for the Local Device
- Configuring MED Attributes for BGP Routes
- Configuring the Next_Hop Attribute
- Setting the AS_Path Attribute
- Configuring AIGP Attributes for Routes
- Configuring Attr_Set Attribute Encapsulation or Parsing
- Verifying the BGP Route Attribute Configuration
- Configuring BGP Routing Policies
- Configuring BGP XPL
- Configuring BGP Route Summarization
- Configuring BGP to Generate a Summary Default Route
- Configuring a BGP Peer Group
- Configuring a BGP Route Reflector
- Configuring a Route Reflector and Specifying Clients
- (Optional) Disabling Route Reflection Between Clients Through the RR
- (Optional) Setting the Cluster ID of a Route Reflector
- (Optional) Preventing a Device from Adding BGP Routes to the IP Routing Table
- (Optional) Enabling an RR to Modify Route Attributes Using an Export Policy
- Verifying the BGP Route Reflector Configuration
- Configuring a BGP Confederation
- Configuring BGP Community Attributes
- Configuring the BGP Large-Community Attribute
- Configuring Prefix-based BGP ORF
- Adjusting the BGP Network Convergence Speed
- Configuring a Dynamic BGP Peer Group
- Configuring a BGP Device to Send a Default Route to Its Peer
- Configuring a Device to Advertise BGP Supernet Unicast Routes to BGP Peers
- Configuring BGP Load Balancing
- Configuring BGP LSP Load Balancing
- Configuring a BGP SR LSP
- Configuring Path MTU Auto Discovery
- Configuring BGP Route Recursion to the Default Route
- Configuring BGP Next Hop Recursion Based on a Route-Policy
- Configuring AIGP value on a Route-Policy
- Configuring the POPGO Function
- Configuring the Device to Perform the Label Pop-go Action for Packets Carrying the Label Added to Each Received Non-labeled Unicast Route
- Configuring conversion from BGP IPv4 Unicast Routes to Labeled Routes
- Configuring BFD for BGP
- Configuring BGP Peer Tracking
- Configuring BGP Auto FRR
- Configuring Delayed Response to BGP Next Hop Recursion Changes
- Setting a Specified Peer or Each Peer in a Peer Group as an Independent Update Peer-Group
- Configuring a Delay in Releasing Obtained Labels in a BGP LSP FRR Switchover Scenario
- Configuring the Route Server Function
- Configuring the BGP GR Helper
- Enabling GR for BGP Peers
- Configuring BGP Best-external
- Configuring BGP Add-Path
- Configuring BMP
- Configuring BGP Route Dampening
- Configuring Suppression on BGP Peer Flapping
- Configuring Flapping Suppression Involved in BGP Next Hop Recursion
- Configuring BGP-LS
- Configuring the Entropy Label Capability for a BGP LSP
- Configuring BGP RPD
- Configuring IBGP Peers to Establish MPLS Local IFNET Tunnels
- Configuring the YANG Management Mode of BGP
- Improving BGP Security
- Configuring BGP Extensions
- Configuring BGP Multi-Instance
- Maintaining BGP
- Resetting BGP Connections
- Clearing BGP Statistics
- Configuring BGP to Record Peer Status Changes and Event Information
- Disabling the PAF Restriction for the Feature Indicating Whether the Number of Received BGP Routes Exceeds the Upper Limit
- Configuring a Mode in Which BGP Path Attributes Are Processed
- Setting a Priority That Determines the Disconnection Order of a BGP Peer Relationship If Memory Overload Occurs
- Enabling BGP to Discard New Routes If a Memory Exception Occurs
- Configuring Whitelist Session-CAR for BGP
- Configuring Whitelist Session-CAR for BMP
- Configuring Whitelist Session-CAR for RPKI
- Configuring Micro-Segment CAR for BGP
- BGP Route Selection Rules
- Route Processing on the BGP router
- Route Selection Rules
- BGP Routing Table
- Route Attributes
- (Optional) Configuring BGP to Ignore the Reachability of the Next Hops of Received BGP VPNv4 Routes
- Configuring BGP to Preferentially Select the Routes with Next Hops Recursing to SRv6 TE Policies
- Configuring BGP to Preferentially Select the Prefix Routes That Are Learned from VPNv4, VPNv6, or EVPN Peers and Are Leaked to a VPN Instance
- Configuration Examples for BGP
- Example for Configuring Basic BGP Functions
- Example for Configuring BGP to Interact with an IGP
- Example for Configuring the MED Attribute to Control Route Selection
- Example for Configuring an AS_Path Filter
- Example for Configuring BGP RRs
- Example for Configuring a BGP Confederation
- Example for Configuring the BGP Community Attribute
- Example for Configuring Prefix-based BGP ORF
- Example for Configuring BGP Route Dampening
- Example for Configuring BGP Default Route Advertisement
- Example for Configuring BGP Load Balancing
- Example for Configuring BGP Next Hop Recursion Based on a Routing Policy
- Example for Configuring Routing Policies to Control BGP Route Advertisement and Acceptance
- Example for Configuring BFD for BGP
- Example for Configuring BGP Auto FRR
- Example for Configuring BGP ADD-PATH
- Example for Configuring BGP Keychain Authentication
- Example for Configuring BGP-LS
- Example for Configuring BGP RPD
- Example for Configuring Dynamic BGP Peer Groups
- Example for Configuring BGP Multi-Instance
- Example for Configuring a BGP SR LSP
- Example for Configuring a BGP Virtual Link
- Example for Configuring BGP Routing Loop Detection