- Enable BGP and enter the BGP or BGP multi-instance view.
bgp as-number [ instance instance-name ]
By default, BGP is disabled. If an RR has been deployed, each VXLAN gateway must establish a BGP EVPN peer relationship with the RR only.
- (Optional) Configure a BGP router ID.
router-id ipv4-address
By default, no BGP router ID is configured.
- Configure a peer device.
peer ipv4-address as-number as-number
By default, no BGP peer is configured, and no AS number is specified for a peer group.
- (Optional) Specify the source interface and source address used to establish a TCP connection with the BGP peer.
peer ipv4-address connect-interface interface-type interface-number [ ipv4-source-address ]
By default, the outbound interface of a BGP message serves as the source interface.
When loopback interfaces are used to establish a BGP connection, running the peer connect-interface command on both ends is recommended to ensure connectivity. If this command is run on one end only, the BGP connection may fail to be established.
- (Optional) Set the maximum number of hops allowed by an EBGP EVPN connection.
peer ipv4-address ebgp-max-hop [ hop-count ]
The default value of hop-count is 255. In most cases, a directly connected physical link must be available between EBGP EVPN peers. If you want to establish EBGP EVPN peer relationships between indirectly connected peers, you must run the peer ebgp-max-hop command to configure the maximum number of hops for a TCP connection.
When a loopback interface is used to establish an EBGP EVPN peer relationship, you must run the peer ebgp-max-hop (where the value of hop-count is not less than 2) command. Otherwise, the peer relationship fails to be established.
- Enter the BGP-EVPN address family view or BGP multi-instance EVPN address family view.
l2vpn-family evpn
By default, the BGP-EVPN address family view or BGP multi-instance EVPN address family view is disabled.
- Enable the ability to exchange EVPN routes with a specified peer or peer group.
peer { group-name | ipv4-address } enable
By default, the ability to exchange EVPN routes with a peer or peer group is enabled only in the BGP-IPv4 unicast address family.
- (Optional) Specify a route-policy for routes received from or to be advertised to a BGP EVPN peer or peer group.
peer { group-name | ipv4-address } route-policy route-policy-name { import | export }
The route-policy helps the device to import or advertise desired routes only. This not only facilitates route management, but also reduces the routing table size and system resource consumption.
- (Optional) Set the maximum number of MAC advertisement routes that can be received from a peer.
peer { group-name | ipv4-address } mac-limit number [ percentage ] [ alert-only | idle-forever | idle-timeout times ]
If a large proportion of MAC advertisement routes imported from a peer or peer group to an EVPN instance are inapplicable, you are advised to run this command to limit the maximum number of such routes that can be imported. If the number of imported MAC advertisement routes exceed the specified maximum, the device displays an alarm, prompting you to check the validity of such routes imported to the EVPN instance.
- (Optional) Set the maximum hold-off time for re-establishing BGP peer relationships.
peer ipv4-address graceful-restart static-timer restart-time
Graceful restart (GR) prevents traffic interruption caused by the re-establishment of BGP peer relationships. To set the maximum hold-off time, run either of the following commands:
To set the maximum hold-off time for re-establishing all BGP peer relationships, run the graceful-restart timer restart command in the BGP view. The maximum hold-off time supported by this command is 3600s.
To set the maximum hold-off time for re-establishing a specified BGP EVPN peer relationship, run the peer graceful-restart static-timer command in the BGP EVPN view. This command allows you to set a hold-off time greater than 3600s.
If both the graceful-restart timer restart time and peer graceful-restart static-timer commands are run, the peer graceful-restart static-timer command configuration takes precedence.
This step can be performed only after GR is enabled using the graceful-restart command in the BGP view.
- (Optional) Enable next hop recursion of EVPN routes to default routes.
nexthop recursive-lookup default-route
If a configuration error or fault occurs, the next hop of the EVPN route from the local VTEP to the remote VTEP may be unreachable, preventing the VXLAN tunnel from being established. To prevent this situation, perform this step and configure the remote VTEP to send a default route to the local VTEP. When the next hop of the EVPN route from the local VTEP to the remote VTEP is unreachable, the EVPN route can recurse its next hop to the default route, allowing the VXLAN tunnel to be successfully established.
- (Optional) Perform the following operations to enable the function to advertise the routes carrying the Large-Community attribute to BGP EVPN peers:
The Large-Community attribute can completely represent a 2-byte or 4-byte AS number, and has two 4-byte LocalData IDs. This enables the administrator to apply policies more flexibly. Before enabling the function to advertise the routes carrying the Large-Community attribute to BGP EVPN peers, configure the route-policy related to the Large-Community attribute and use the route-policy to set the Large-Community attribute.
peer { ipv4-address | group-name } route-policy route-policy-name export
peer { ipv4-address | group-name } advertise-large-community
If the routes carrying the Large-Community attribute do not need to be advertised to a BGP EVPN peer in the peer group, run the peer ipv4-address advertise-large-community disable command.
- (Optional) Configure BGP to ignore the IGP metric when selecting the optimal route.
bestroute igp-metric-ignore
By default, BGP uses the IGP metric as one of the conditions for selecting the optimal route. To exclude the IGP metric of next-hop routes as a condition for selecting the optimal BGP EVPN route on a VTEP, perform this step.
- (Optional) Set the maximum number of routes that can be received from a peer.
peer { peerIpv4Addr | group-name } route-limit limit [ percentage ] [ alert-only | idle-forever | idle-timeout times ]
By default, there is no limit on the number of routes that can be received from a peer. If a VTEP receives many routes from its peers, excessive system resources are consumed. To prevent the VTEP from receiving too many routes, perform this step.