# Designated VE Device Selection for a Multihomed Site

BGP on each PE router in the VPWS 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 the 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 improperly designated VE device selection by the remote 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).

For VPWS only, the layer 2 multihoming decision process considers the status vector bit in the layer 2 route. The status vector bit gives the combined status of the following:

- The attachment circuit between the CE device and the local PE router
- The MPLS connectivity between the local PE router and the remote PE router

When the status vector bit indicates that the connectivity between the CE device and the remote CE device is down, then the PE router runs the layer 2 multihoming decision process again, but this time excludes all advertisements that indicate this lack of connectivity between the two site IDs (CE-IDs). The status vector bit is not considered for VPLS multihoming.

This evaluation of connectivity must be supported by all PE routers in the VPWS network. Because some implementations do not support the status vector bit, The E Series routers also advertise the down bit in a VPWS network. This bit is then used by the other routers to evaluate connectivity.

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 VPWS.

- 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 VPWS. 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 VPWS 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.

  For a VPWS network, this PE router then sets the circuit status vector bit in the MP_REACH_NLRI to indicate that the remote site is unreachable. BGP advertises the route to inform remote PE routers fo this new condition.

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.