# BGP Multihoming for VPLS Overview

BGP multihoming enables you to connect a customer site to two or more PE routers to provide redundant connectivity while preventing the formation of layer 2 loops in the service provider’s network. The redundant connectivity maintains the VPLS service and traffic forwarding to and from the multihomed site in the event of a PE router-to-CE device link failure, the failure of a PE router, or an MPLS reachability failure between the local PE router and a remote PE router. A redundant PE router can begin providing service to the customer site as soon as the failure is detected. BGP multihoming is very similar for both VPLS and VPWS, with only minor differences in behavior between the two L2VPN types.

When a CE device connects to multiple PE routers, each of these routers advertises reachability for the multihomed site—routes that have the same site ID in the layer2 NLRI. The other PE routers in the network use a BGP path selection process to select only one of the advertising routers to which they send traffic destined for the CE device. This path selection process eliminates layer 2 loops in the VPLS network.

| Best Practice: To prevent the creation of layer 2 loops due to a misconfiguration or temporary loops during a topology change and subsequent convergence, we recommend that you employ the Spanning Tree Protocol (STP) on your CE devices.

You specify on each PE router connected to the CE device in the VPLS that the site is multihomed and you configure a priority. The priority serves as a site preference and is propagated by BGP in the local-preference attribute.

You configure the same site ID (sometimes referred to as a VE ID) on these connected PE routers. Each of these routers then advertises reachability for the multihomed site; the VPLS NLRI contains the site ID. The site ID shared by the connected PE routers should be different than the site IDs configured on the remote PE routers in the VPLS network; if the site ID is not different, then the pseudowire will be in a site collision state. The remote routers then use the site ID to identify where to forward traffic destined for the customer site.

Although the site ID is the same for all connected PE routers, the block offset, label range, and route distinguisher can be different for each PE router. The BGP path selection process uses the block offset and label range only to determine whether a layer 2 advertisement is relevant to the multihomed customer site. A route distinguisher is helpful to uniquely identify a particular PE router when you are troubleshooting a network.

The PE routers run the BGP path selection process on the locally originated and received layer 2 route advertisements to establish that the routes are suitable for advertisements to other peers, such as route reflectors. For this selection process, the routes advertise different prefixes, distinguished by the site ID, block offset, and route distinguisher.

The remote PE routers then run a modified selection process on these selected routes for L2VPN multihoming. Because all the prefixes advertised by multihomed local PE routers share the same site ID, the set of routes advertised for a multihomed site effectively consists of multiple routes to a single prefix, distinguished by the site ID alone. Therefore the result of the second selection process is the single best path to the multihomed site.

The PE router that originates this advertisement then becomes the designated VE device for the multihomed customer site. When the designated VE device is determined for both the local and remote customer sites for the VPLS, then a VPLS pseudowire is created between the designated VE devices.

The BGP best path selection process is run only in the core VPN address family. This first selection process does not consider the down bit for VPLS (or the status vector bit for VPWS).

The layer 2 multihoming decision process is run only in the non-core VPLS (or VPWS) layer 2 unicast address families. This second decision process treats prefixes with the same site ID but different RDs as a single prefix.

When the PE router receives a layer 2 BGP advertisement that has the down bit set, inbound policy sets the local preference attribute to zero. The selection process can then choose an existing route from an alternate PE router, if available.

When a PE router in a VPLS domain is also a BGP route reflector (RR), the path selection process to determine the VE device for the multihomed site has no effect on the path selection process performed by this PE router for the purpose of reflecting layer 2 routes.

Layer 2 prefixes that have different route distinguishers are considered to have different NLRI for route reflection. This result of the standard BGP path selection process enables the RR to reflect all routes that have different route distinguishers to all other RR clients even though only one of these routes is used to trigger the VPLS pseudowire to the multihomed site.

- Designated VE Device Selection for a Multihomed Site
- Multihoming Reaction to Failures in the Network

## Designated VE Device Selection for a Multihomed Site

BGP on each PE router in the VPLS network determines the best path to the multihomed site by comparing path attributes. The PE routers receiving the advertised routes first run the standard BGP selection process. The routes from the connected multihomed PE routers all share the same site ID, but can have different route distinguishers and block offsets; the routers are advertising different prefixes. The following sequence is applied to all routes on a per-prefix basis:

1. Select a path with a reachable next hop.
2. Select the path with the highest weight.
3. If path weights are the same, select the path with the highest local preference value.
4. Prefer locally originated routes (network routes, redistributed routes, or aggregated routes) over received routes.
5. Select the route with the shortest AS-path length.
6. If all paths have the same AS-path length, select the path based on origin: IGP is preferred over EGP; EGP is preferred over Incomplete.
7. If the origins are the same, select the path with lowest MED value.
8. If the paths have the same MED values, select the path learned by means of EBGP over one learned by means of IBGP.
9. Select the path with the lowest IGP cost to the next hop.
10. Select the path with the shortest route reflection cluster list. Routes without a cluster list are treated as having a cluster list of length 0.
11. Select the path received from the peer with the lowest BGP router ID.
12. Select the path that was learned from the neighbor with the lowest peer remote address.

The result of this process is the best path to the multihomed customer site through each PE router connected to the site. One best path is selected for each router. The process establishes whether the route advertised by each PE router is suitable for advertising to peer routers.

Next, BGP runs the layer 2 multihoming selection process on this set of best paths to determine the one best path to the customer site. The result of this process establishes that the best path is suitable for establishing a pseudowire from the remote PE router to the PE router. That PE router is accordingly selected as the designated VE device.

The multihoming selection process is similar to the standard BGP process, but it omits two steps:

- The process does not prefer locally originated routes. Local origination is of no value in establishing the designated VE device. The PE routers connected to the customer site always have a local route and therefore all advertise a locally-originated route. These PE router also receive the advertisements from the other connected PE routers. If the multihoming selection process preferred local origination, each of these routers would select itself as the best path.
- The process does not consider IGP cost in order to prevent the remote PE routers from selecting different designated VE devices in the event of a misconfiguration, such as having the same site priority on different multihomed PE routers.

When the remote PE router establishes or refreshes a pseudowire to the local PE router, it verifies whether the prefix is in the range required for the site ID based on the block offset and label range advertised by the designated VE device. If the prefix is out of range, then the pseudowire status is set to OR (out of range).

One of the following cases applies for each PE router when it completes the BGP path selection process for a layer 2 advertisement on the VPLS.

- The PE router originated one of the multihomed advertisements and selected its own advertisement as the best path.

  This PE router hosts the designated VE device. Selection as the designated VE device triggers the creation of pseudowires to and from the other PE routers in the VPLS. When the remote customer site is also multihomed, then the designated VE device triggers the creation of pseudowires to and from only the designated VE device for the remote site.

- The PE router originated one of the multihomed advertisements but did not select its own advertisement as the best path.

  This PE router is one of the redundant PE routers for the multihomed site; it does not host the designated VE device. If its status has just transitioned from being the designated VE device, then the PE router tears down all the pseudowires that it had to and from the other PE routers in the VPLS network.

- The PE router receives the multihomed advertisements and selects a best path; it does not originate any of these advertisements because it is not connected to the multihomed customer site.

  If the selected best path—and therefore the designated VE—has not changed, then nothing happens. If the best path has changed, then this PE router brings up pseudowires to and from the new designated VE device and tears down the pseudowires to and from the previous designated VE device.

  If this PE router does not select a best path after running the process, then the local PE router does not consider the remote site to exist.

When a VE device receives an advertisement for a layer 2 NLRI that matches its own site ID but the site is not multihomed, then the pseudowire between it and the transmitting PE router transitions to a site collision (SC) state and is not considered to be up.

## Multihoming Reaction to Failures in the Network

The redundant connectivity provided by a multihoming configuration protects against several types of network failure.

- CE-Link failure between the CE device and the PE router—BGP on the PE router is notified when the circuit goes down. BGP then modifies the circuit status vector bit in the MP_REACH_NLRI to indicate that the circuit is down.

  If all VPLS local attachment circuits are down, then BGP modifies the down bit in the VPLS advertisement Layer2-Extended-Community to state that the site is down. When the bit is modified, BGP advertises the route to all remote PE routers to inform them that the circuit (and site) is down. The remote PE routers each run the best path selection process again and adjust the VPLS pseudowires as needed.

- Failure of MPLS reachability to the remote PE router—BGP on the PE router is notified that MPLS connectivity to the BGP next hop is gone. BGP then modifies the circuit status vector bit in the MP_REACH_NLRI to indicate that the LSP is down. When the bit is modified, BGP advertises the route to all remote PE routers to inform them that connectivity is down from the local site to the remote site.

  The down bit is set if no remote PE router is reachable by MPLS. This enables the remote PE routers to consider the other multihomed PE router as the designated VE device for the multihomed-site.

  The remote PE routers each run the best path selection process again and adjust the VPLS pseudowires as needed.

- PE router failure—When either the PE router or its BGP process fails, peer PE routers detect expiration of the holdtimer and bring down their peering sessions, and remove layer 2 advertisements from the PE router. Alternatively, the PE routers can detect unreachability to the BGP next hop that represents the failed PE router. In this case the peer routers mark the layer 2 routes advertised by PE router as unreachable. The peer PE routers each run the best path selection process again and adjust the VPLS pseudowires as needed.

  A similar response results when you adjust the multihoming priority of the PE routers connected to the multihomed site, effectively performing and administrative failover to another PE router. BGP sends a layer 2 update with the new local preference attribute to all peer PE routers. The peer PE routers each run the best path selection process again and adjust the VPLS pseudowires as needed.

To modify their pseudowires, the peer routers correct their MPLS forwarding tables and set up new entries in their pseudowire tables.