- Run:
system-view
The system view is displayed.
- Run:
bgp { as-number-plain | as-number-dot }
The BGP view is displayed.
- Run:
ipv4-family vpn-instance vpn-instance-name
The BGP-VPN instance IPv4 address family view is
displayed.
- (Optional) Run:
router-id { ipv4-address | auto-select }
A router ID is set in a BGP VPN instance
IPv4 address family.
By configuring router ID for BGP VPN instance IPv4 address family, you can differentiate the configured router ID of BGP VPN instance IPv4 address family from the BGP router ID. For example, if two VPN instances named vrf1 and vrf2 are configured on a PE, and a BGP session needs to be established between the interfaces bound to the two VPN instances, you need to configure different router IDs for the two VPN instance IPv4 address families. If no router ID is configured
for the two VPN instance IPv4 address families, no BGP session can be established because the two VPN instance IPv4 address families have the same router ID, which is consistent with the BGP router ID.
- (Optional) Run:
as-number { as-number-plain | as-number-dot }
An AS number is configured for the VPN instance
IPv4 address family.
A VPN instance uses the AS number of BGP by default.
To smoothly re-assign a device to another AS or transmit different services in different instances, run the as-number command to configure a different AS number for each VPN instance IPv4 address family.
The AS number configured in the BGP-VPN instance IPv4 address family view must be different from the AS number configured in the BGP
view.
- Run:
peer ipv4-address as-number { as-number-plain | as-number-dot }
The CE is configured as a VPN peer.
- (Optional) Run:
peer { ipv4-address | group-name } ebgp-max-hop [ hop-count ]
The maximum number of hops between the PE and its EBGP peer (the CE) is specified. This step is mandatory if the PE and the CE are not directly connected.
By default, a direct physical link must be available between EBGP peers.
If such a link does not exist, run the peer ebgp-max-hop command to allow EBGP peers to establish a TCP connection over multiple hops.
If hop-count is not
specified in the peer ebgp-max-hop command, 255 is used as the maximum number of hops in EBGP connections.
- (Optional) Run the following command to enable the PE to import the direct routes destined for the local CE into the VRF table and advertise the routes to the remote PE:
Run:
import-route direct [ med med | route-policy route-policy-name ]*
The direct routes destined for the local CE are imported into the VRF table of the IPv4 VPN instance.
Run:
network ipv4-address [ mask | mask-length ] [ route-policy route-policy-name ]
The direct routes destined for the local CE are advertised to the remote PE.
The PE can automatically learn the direct routes destined for the local CE. The learned routes take
precedence over the direct routes advertised from the local CE using EBGP. If this step is not performed, the PE does not use MP-BGP to advertise the direct routes destined for the local CE to the remote PE.
- (Optional) Run:
peer { group-name | ipv4-address } soo site-of-origin
The
Site-of-Origin (SoO) attribute is configured for the CE that has been specified as a VPN peer of the PE.
Several CEs at a VPN site may establish BGP connections with different PEs. The VPN routes advertised from the CEs to the PEs may be re-advertised
to the same VPN site after the routes traverse the backbone network. This may cause route loops at the VPN site.
If the SoO attribute is configured for a specified CE, the PE adds the attribute to a route sent from the CE and advertises the route
to the remote PE. The remote PE checks the SoO attribute of the route before sending it to its attached CE. If the SoO attribute is the same as the local SoO attribute on the remote PE, the remote PE does not send the route to its attached CE.
- (Optional) Run:
peer ipv4-address allow-as-loop [ number ] [ global-as [ vpn-as ] ]
Route loops are allowed.
This step is used in Hub and Spoke networking.
The default value of number is 1. Generally, BGP uses the AS number to detect route loops. In
a Hub and Spoke network, if EBGP runs between a Hub-PE and a Hub-CE at a Hub site, the route sent from the Hub-PE to the Hub-CE carries the AS number of the Hub-PE. If the Hub-CE sends a route update message to the Hub-PE, the Hub-PE will deny it because
the route update message contains the AS number of the Hub-PE. To ensure proper route transmission in a Hub and Spoke network, configure all the BGP peers along the path (along which the Hub-CE advertises VPN routes to the Spoke-CE) to accept the routes
which have the AS number repeated once.
- (Optional) Run:
peer ipv4-address substitute-as
BGP AS number substitution is enabled.
In a scenario
where VPN sites in the same site or those that have different private AS numbers communicate through the BGP/MPLS IP VPN backbone network, if a CE and its connected PE in a VPN site establish an EBGP connection, VPN routes from other VPN sites may carry
the AS number of this VPN site. As a result, the CE discards the VPN routes, causing a failure in VPN site communication. To prevent this situation from occurring, run the peer substitute-as command on the PE to enable the AS number substitute function.
Enabling BGP AS number substitution may cause route loops in a CE multi-homing network.