Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?


EVPN Type 2 and Type 5 Route Coexistence with EVPN-VXLAN

SUMMARY Learn how a device in an EVPN-VXLAN fabric gives preference to either an EVPN Type 2 route or an EVPN Type 5 route when the device learns and advertises both types of routes.

A device in an EVPN-VXLAN edge-routed bridging fabric imports and advertises EVPN Type 2 MAC+IP routes by default. You can also configure the device to import and to advertise EVPN Type 5 IP prefix routes. The device treats either type of route as a unique route, even when it corresponds to the same destination host. Each unique IP host route uses a dedicated next hop in the Packet Forwarding Engine (PFE). As a result, having both types of routes enabled together puts a strain on the PFE's next-hop resources. Also, traffic generally flows more efficiently if the device uses one type of route over the other in certain cases.

Starting in Junos OS Release 21.2R1, when the device has both types of routes together in a routing instance for the same destination, it uses a preference algorithm to choose the preferred route to store.


  • Supports higher scaling in edge-routed bridging fabrics because the preference algorithm reduces next-hop resource requirements in the PFE.

  • Improves bridging performance by choosing the more efficient path for locally learned (Type 2) host IP routes in an Ethernet segment.

  • Supports higher scaling with EVPN Type 5 routes while enabling ARP suppression and proxy ARP in the fabric using Type 2 routes. The Type 2 routes carry the customer edge (CE) device MAC address information required for proxy ARP to work.

EVPN Type 2 and Type 5 Coexistence Preference Algorithm

In an EVPN-VXLAN fabric, devices use Type 2 routes by default. You must explicitly enable the device to also import and advertise EVPN Type 5 routes in a virtual routing and forwarding (VRF) instance. To enable Type 5 routes and the coexistence preference algorithm, configure the ip-prefix-routes statement at the [edit routing-instances name protocols evpn] hierarchy level.

With Type 5 routes enabled, the device might learn an IP host address from a Type 2 MAC + IP route for which it also has a Type 5 route for the same prefix. In that case, the device uses the coexistence preference algorithm to choose only one of the two routes to store as the preferred route.

The preference algorithm works as follows:

  • For any destinations for which the device has no Type 5 route, the device uses Type 2 routes.

  • If the device has a Type 5 route with a matching prefix for a local ESI Type 2 route, it installs the Type 2 route.

  • Otherwise the device prefers the Type 5 route for all other destinations.

With this algorithm, EVPN-VXLAN devices generally prefer Type 5 routes for traffic in or between data centers and in or between VLANs (bridge domains). Type 5 routes are ideal for the purpose of VXLAN overlay routing. However, a device can forward packets more efficiently using Type 2 routes in some cases. One example is when the device learns Type 2 MAC+IP routes for destinations that it only needs to bridge locally. The preference algorithm accounts for that case.

The device does not use make before break (MBB) actions to adjust preferred routes due to configuration updates. When making a route preference change in this case, the device first deletes the non-preferred route, then adds the new preferred route. Examples of configuration changes that can cause preference changes include:

  • If you didn't enable Type 5 routes, and then you enable Type 5 routes.
  • When you configure an ESI locally, in which case the device prefers the MAC+IP Type 2 route.

Type 5 Route Options and Policy Options

In your EVPN-VXLAN configuration, use one of these advertising mode options with the ip-prefix-routes statement when you enable Type 5 routes:

  • advertise direct-nexthop—With this option, the device advertises all non-host routes for a VRF as Type 5 advertisements.
  • advertise gateway-address—With this option, the device only advertises prefixes for the IRB interfaces for the extended EVPN instances and bridge domains.

You can also include policy options in your EVPN-VXLAN Type 5 route configuration to refine the routes the device actually imports or advertises.

For example, you can define:

  • A policy to export all local routes and EVPN routes, such as the following:

  • A policy that only advertises routes for specific host addresses or prefixes, such as the following:

  • A policy that filters and doesn't import routes for specific host addresses or prefixes, such as the following:

Include the desired policy options in your ip-prefix-routes configuration. For example:

CLI Commands to Verify Preferred Route Type

You can use the CLI commands in this section to see the preferred route type.

show ethernet-switching mac-ip-table

The show ethernet-switching mac-ip-table CLI command displays the value RTS in the MAC IP flags column when the switch "skips" adding a learned Type 2 route. This value means the device prefers a Type 5 route with a matching prefix. The command displays the definition Dest Route Skipped for the value RTS at the top of the output.

The command displays results for all VLANs (bridge domains) by default. You can also specify a particular VLAN (bridge domain). By default, the command displays information for the default-switch instance. You can also use other command line options to display results for a specific routing instance if the device has multiple routing instances.

The following sample output shows MAC+IP table information for the default-switch instance where the device preferred Type 5 routes for some destinations:

With the extensive option, the show ethernet-switching mac-ip-table command includes the value dest_route_skipped in the MAC IP flags row. The following command shows the MAC+IP table information for MAC address c8:e7:f0:4b:d1:00:

show route forwarding-table

The show route forwarding-table CLI command shows when the device uses a local Type 5 route over a learned Type 2 route for a destination. In this case, when you include the extensive option, the output includes the keywords VxLAN Local in the Flags field. This flag means the route is a Type 5 route.

For example:

show route table

The show route table CLI command with the extensive option includes the keyword VxlanLocalRT in the State output field for a Type 5 route.

Here's an example using the syntax show route destination-prefix table table-name extensive. This command shows that the device installed a Type 5 route for the destination IP prefix in the routing table for routing instance vrf1: