Showing results for 
Search instead for 
Did you mean: 

ASR9000/XR Flexible VLAN matching, EVC, VLAN-Tag rewriting, IRB/BVI and defining L2 services



In this article we'll be discussing the EVC (Ethernet Virtual Circuit) infrastructure that the ASR9000 and IOS-XR use to define L2 services.

You'll find in this article how packets coming in on an interface are being matched against an EFP (Ethernet Flow Point), how to manipulate the vlan tags and use them in XCONNECT (VPWS) or Bridging (eg VPLS) scenarios with the optional L3 endpoint to provide IRB (Integrated Route Bridging)

Core Issue

The way that IOS-XR handles EVC's is a bit different then the way that IOS handles it when for instance using the 7600.

When starting with IOS-XR and the ASR9000 there are a few things that you will want to be aware of when defining L2 services.

A couple of the key differences are:

- XR does have the concept of a trunk interface

- therefore XR cannot do vlan pruning

- XR does not strip vlan tags by default.

- XR does not have the concept of an "interface VLAN" a.k.a. SVI's (Switch Virtual Interface), instead it uses a BVI (Bridge Virtual Interface) that can be inserted into the bridge-domain.

Flexible VLAN matching

     How the ASR9000 matches traffic to an EFP

TAG rewriting

     how to modify the vlan headers and how that works

Defining L2 services

     and a comparison with IOS

Providing L3 services in L2VPN

     using IRB/BVI interfaces


In order to define an L2 service, we need to match traffic to a particular interface. In IOS-XR and the ASR9000 we use the Ethernet Flow Point (EFP) to match this traffic. An EFP is effectively a subinterface of a physical interface with the keyword "l2transport" attached to it. This l2transport defines that we are going to use this (sub) interface for L2 Services. We can match L2 and L3 interfaces on a single physical port:


Flexible VLAN matching

When traffic is coming in on a port, we use the TCAM to find out which particular subinterface this traffic matches on. With that in mind there are a couple of rules as to how traffic is matched.

An EFP is defined as follows:

RP/0/RSP0/CPU0:asr(config)#int gig 0/0/0/4.100 l2transport

RP/0/RSP0/CPU0:asr(config-subif)#encapsulation ?

  default  Packets unmatched by other service instances

If a particular packet is not matching any other specific EFP on this physical port, this "Default" will capture all unmatched traffic.

  dot1ad    IEEE 802.1ad VLAN-tagged packets

  dot1q     IEEE 802.1Q VLAN-tagged packets

  untagged Packets with no explicit VLAN tag

If there is no vlan tag on the packet, the "untagged" EFP will capture this traffic, this is effectively plain ethernet and useful for instance to capture

BPDU's for instance.

When we are going to match on say dot1q encapsulated traffic we have a variaty of how we can match vlan tagged traffic (see also foot note below in the "Related Information" section on the ethertypes used).

RP/0/RSP1/CPU0:A9K-BOTTOM(config-subif)#encapsulation dot1q ?
  <1-4094>         Start of VLAN range
  <1-4094>         Single VLAN id
  any              Match any VLAN id
  priority-tagged  IEEE 802.1ad priority-tagged packets

At the first level of dot1q classification we can select a vlan, vlan-range or any. These are obvious. The option "Priority tagged" allows us to capture vlan encapped traffic that is with a vlan id of 0.

RP/0/RSP1/CPU0:A9K-BOTTOM(config-subif)#encapsulation dot1q 100 ?
  comma         comma
  exact         Do not allow further inner tags
  ingress       Perform MAC-based matching
  second-dot1q IEEE 802.1Q VLAN-tagged packets

Here is an important concept that is to be highlighted. You see the "word" exact" here. What that means is, in the absence of the keyword exact, if the outter vlan header is "100" in this example, this EFP is matched. so that means that also qinq frames that are of the 100 outter and 200 inner kind (if there is no specific EFP for the qiq combo 100/200 available) will match this EFP.

Just a few examples:

encapsulation dot1q 100: will match any number of vlan headers as long as the outter vlan id is 100

encapsulation dot1q 100 second any: will match any qiq frame where the outter vlan is 100

encapsulation dot1q 100 second 200: will match vlan tagged packets whereby the outter is 100, the inner is 200 and also a potential vlan combo of 100/200/300

encapsulation dot1q 100 second 200 exact: will match vlan tagged packets whereby the outter is 100, the inner is 200 and no other vlan tags are on the packet then these 2 specified.

Normally "longest match" will win, or better put, the most specific match will win.

ASR9000 doesn't support best match for VLAN ranges, but we do support best match if the "any" keyword is used. 

So the configuration :

EFP 1 VLAN: S-VLAN=1000, C-VLAN_range=1-4095

EFP 2 VLAN= S-VLAN=1000, C-VLAN=2000

isn't allowed because the more specific C-vlan is part of the range. The parser will reject this config upon commit.

The following options A and B, achieving the same, are allowed :


EFP 1) VLAN: S-VLAN=1000, C-VLAN_range=1-1999,2001-4095

EFP 2) VLAN= S-VLAN=1000, C-VLAN=2000


EFP 1) VLAN: S-VLAN=1000, C-VLAN=any

EFP 2) VLAN= S-VLAN=1000, C-VLAN=2000,

VLAN  TAG rewriting

The ASR9000/XR is capable of doing many translations on vlan to a packet.

The behavior is always symmetric (though this keyword is to be provided as part of that config command). The symmetry means that if we pop a tag on ingress, we push it back on egress.

the following rewrites are possible:

RP/0/RSP0/CPU0:A9K(config)#int gig 0/0/0/4.100 l2transport

RP/0/RSP0/CPU0:A9K(config-subif)#rewrite ingress tag ?
  pop        Remove one or more tags
  push       Push one or more tags
  translate  Replace tags with other tags

RP/0/RSP0/CPU0:A9K(config-subif)#rewrite ingress tag pop ?
  1  Remove outer tag only
  2  Remove two outermost tags

RP/0/RSP0/CPU0:A9K(config-subif)#rewrite ingress tag push ?
  dot1ad  Push a Dot1ad tag (ethertype 88a8)
  dot1q   Push a Dot1Q tag (ethertype 8100 by default, or 9100/9200 is specied on the main interface for the outter most tag)

RP/0/RSP0/CPU0:A9K(config-subif)#rewrite ingress tag push dot1q 100 ?
  second-dot1q  Push another Dot1Q tag
  symmetric     All rewrites must be symmetric

RP/0/RSP0/CPU0:A9K(config-subif)#rewrite ingress tag translate ?
  1-to-1  Replace the outermost tag with another tag
  1-to-2  Replace the outermost tag with two tags
  2-to-1  Replace the outermost two tags with one tag
  2-to-2  Replace the outermost two tags with two other tags

If you want to make a cross connect or bridge between two EFP's where one EFP is vlan 100 and the other EFP is vlan 200,

you need to make sure you pop the tags so that the vlan 100 is removed from the packet so it, by means of symmetry, will get vlan 200 on the egress

of the other EFP.

L2VPN configuration examples and comparison to 7600

The following picture highlights how to create L2 services on the ASR9000.




To provide L3 services in a bridge-domain, you can add a routed interface to the bridge domain.

What is important here is that the BVI is not vlan tagged. So in order for the EFP's to talk to the BVI, we need to pop ALL Tags on ingress!!

This means that frames with more then 2 tags cannot be natively using the BVI, unless we do some workarounds such as loopback cables to

pop more tags.

interface BVI5
ipv4 address
mac-address 0.4343.3434

! when creating the bvi verify the show int bvi to see if the mac address is correctly programmed, these macs are coming from the backplane mac table, ! if we ran out because of so many bundle interfaces etc, you may need to provide a mac manually.

interface TenGigE0/7/0/3.100 l2transport

encapsulation dot1q 100

rewrite ingress tag pop 1 symmetric


bridge group testing
  bridge-domain testing
   interface TenGigE0/7/0/3.100
   interface GigabitEthernet0/1/0/14
   routed interface BVI5

Related Information

XR MTU calculations

Dot1q, Dot1ad and configuring "dot1q tunneling ethertype on the physical interface:

As per IEEE documentation, Ethertype 8100 is for 802.1q and Ethertype 88A8 is for 802.1ad.
IEEE also calls any kind of double tagging as QinQ, including dot1ad. That means that under IEEE's point of view, dot1ad = qinq.
Cisco, on the other hand, calls qinq a double dot1q, where both Ethertypes (inner and outer) are 8100.
Ethertype 9100 and 9200 were used as an option to differentiate the inner Ethertpe form the outer Ethertype,
but they are obsolete now and the standard became dot1ad (with Ethertype 88A8).
In order to configure ethertype 9100 and 9200 you have to explicitly issue the command dot1q tunneling ethertype 0x9100 or
dot1q tunneling ethertype 0x9200 under the physical interface you are configuring.
encapsulation dot1q second dot1q                                     -> inner and outer ethertype are 8100
encapsulation dot1ad second dot1q                                   -> inner 8100, outer 88A8
encapsulation dot1q second dot1q (with ethertype 9100)      -> inner 8100, outer 9100
encapsulation dot1q second dot1q (with ethertype 9200)      -> inner 8100, outer 9200

Xander Thuijs, CCIE #6775

Sr. Tech Lead ASR9000

Cisco Employee

Hi Babatunde,

ambigious vlans for EFP's (that is l2transport interfaces) can only be ambigious (that is a range) on the outer most tag. That means :

encapsulation dot1q 20-40

or encapsulation dot1q 20 second 40-50

when you do choose to use amb vlans, popping the tag is difficult because on egress we don't know what to apply back on to the egress direction, unless we have a helper application (such as DHCP/proxy) that keeps track of MAC, IP and the vlan combo to use.

With that, you can't pop tags for amb vlans, which means inherently BVI can't be used either in such designs.

It makes sense, as generally a vlan is the equivalent of an ip subnet and a bvi serves only 1.

You should move to an unamb design, that is fixed inner and outer in order to use tag pop manipulation and or use of BVI's.



Hi Xander,

Just wondering....Can you have one (sub)interface attached to more than one bridge-domains?

bridge group TEST1-BG

  bridge-domain TEST1-BD

   interface TenGigE0/4/0/1

   neighbor pw-id 1


bridge group TEST2-BG

  bridge-domain TEST2-BD

   interface TenGigE0/4/0/1

   neighbor pw-id 2

If yes, can you filter the AC=>PW direction based on vlans?

i.e. in the PW=>AC direction i have:

in TEST1-BD i have traffic with 100/1 vlans coming from pw 1

in TEST2-BD i have traffic with 100/2 vlans coming from pw 2

Is there a way i can filter traffic (directly on the PW) on the opposite direction (AC=>PW) based on the outer vlan, in order to avoid using a different subif per bridge-domain?

That way, traffic with 100/1 vlans coming from TenGigE0/4/0/1 will go only to pw-id 1, while traffic with 100/2 vlans coming from TenGigE0/4/0/1 will go only to pw-id 2.



Cisco Employee

Hi Tassos,

that you can't do like that, an EFP, that is an l2transport interface, can only belong to one BD at a time.

but you can split out the vlans from a main interface into different BD's.

Something like this:


int te0/4/0/1.100 l2transport

encap dot1q 100


int te0/4/0/1.200 l2transport

encap dot1q 200

effectively a BD is the equivalent of a vlan whereb you like all EFP's from the same vlan (set) to the same BD.




The problem is that i'm trying to avoid subifs, because if i have 500 bridge-domains, then i'll also need 500 subifs per interface.

I was hoping to get something equivalent to an IOS L2 trunk, without much configuration.

It's strange to move from 7600/IOS to ASR9k/IOS-XR and be forced to multiply x 500 x NoOfInterfaces my interface config.

interface TenGigabitEthernet7/1


switchport trunk encapsulation dot1q

switchport trunk allowed vlan 100,200,etc

interface Vlan100

no ip address

xconnect vfi VFI-100

interface Vlan200

no ip address

xconnect vfi VFI-200

Cisco Employee

i understand your delemma, but it is the "natural" difference between the IEEE model (that the IOS/7600 implements) vs the EVC model (that XR uses).

a BD is the equivalent of a vlan hence for every vlan that you want to transport you need to create a bD, it bloats the config a bit, but it allows for full control of the subinterfaces and services more so then what IOS allowed...

As you work with it more, you'll find (hopefully:)) that the EVC model is more straight forward.




Ok, let's hope that sometime in the future there will be a way to configure it using variables:

foreach $ID=100 to 3000 step 100


interface TenGigE0/4/0/1.$ID l2transport

encapsulation dot1q $ID

rewrite ingress tag pop 1 symmetric


bridge group TEST-BG

  bridge-domain $ID-BD

   interface TenGigE0/4/0/1.$ID


   neighbor pw-id $ID


The above should be the actual config stored in the router, not the input of a script which would generate hundrends of config lines (something that is possible now).

Many thx for your time



Hi Alex,

Is PWHE now available in ASR? or only in CRS ?


Cisco Employee

Hakan, I am not a CRS expert, but I checked some internal design documents and case notes and found this:

In 4.1.0, PW-HE  feature is only supported on  metro LC (like: MSC-B), and deployment is
expected to be done on system with only metro LC.



Hi Xander how are you?

I'm having a issue, I need the same vlan interconnection in 7600 and two ASR9000 Router (VLAN used as the 2nd)

In the ASR9000 is being used bridge-domine.

The ASRs are interconnected by MPLS.

The problem is that only reaches one of the ASR BVI and not both at the same time, placed in the ASR 7600 ( came to 192168.1.2,  but no maner to solve this problem?.




Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to, timeout is 2 seconds:


Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms


Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to, timeout is 2 seconds:


Success rate is 40 percent (2/5), round-trip min/avg/max = 1/2/4 ms



Step a scheme with the conf. try to clarify.

Consulta OSPF ASR.jpg

Cisco Employee

Hi Sergio,

For this design you need STP obviously, are you running full MSTP or MSTAG?

If you have STP blocking the uplink to the side, so in order to ping that address, we have to go via the side over the PW. There are a couple of things to verify there:

Can you ping from the 1.2 side?

Are you seeing arp requests on the 1.1 side coming from 1.3

Do we see the MAC being learned on in the bridge domain attached to the right circuit?

Considering you have an Access PW (SHG-0) and put the phy AC into SHG-2 there may be a communication problem in that regard, so if you're not learning the mac correctly or ARP is not making it through, it might be related to that.

Normally in designs like this you would connect the 2 9k's together via a PW with a VFI.

Also to check; is the PW up and forwarding properly?

One common mistake is that the mpls router ID is set to an interface instead o the address, could that be it?




Hello Xander, if I'm using MSTAG and sp this blocked where it says.

But I had bad diagnosis, I did not see, Is that this flapping OSPF, copy the log from ASR9, if I put the shutdown OSPF the ping  is OK on the same LAN.

No logro encontrar el error

Log ASR:

ospf[1011]: %ROUTING-OSPF-5-ADJCHG : Process 11014, Nbr on BVI2 in area 0 from LOADING to FULL, Loading Done,vrf default vrfid 0x60000000

RP/0/RSP0/CPU0:Sep 16 10:28:47.405 : ospf[1011]: %ROUTING-OSPF-5-ADJCHG : Process 11014, Nbr on BVI2 in area 0 from LOADING to FULL, Loading Done,vrf default vrfid 0x60000000

thank you very much for your help

Cisco Employee

Ok perfect, thanks for letting me know Sergio.

Just so you know IOS-XR prefers an ARP adj over a routing ADJ, what that means is that if we have an arp adj for a particular route that is used for forwarding over the routing decission.

So if at some point we learn the route via a directly connected ADJ (eg when the link unblocks) and then when the link blocks and we learn the same path via IGP we probably retain the local ADJ and try to forward on that resulting in that ping loss.

The right appraoch for this design is probably using HSRP with a virtual address between the A9K's to provide a virtual mac and gateway addr to the 7600 CE side.




Hi Alexander,

is there any example to configuring VLAN Xconnect on ASR9K ?

like :

int vlan 50

xconnect y.y.y.y 1050


int gi1/1.50

encapsulation dot1q 50


int gi2/1.50

encapsulation dot1q 50


Please help... Is it doable on ASR9K ?


Budi L

Cisco Employee

Hi Budi,

yes that is possible.

First define all the physical (sub)interfaces (aka EFP's) that you want to pull into that bridge domain, eg:

int g 0/0/0/0.50 l2trans

encap dot1q 50

rewrite ingress tag pop 1 symm

and do this for every phy interface that carries this vlan 50 that you want to pull in.

Next define a BVI (aka SVI for switch platforms) like this:

interface BVI50

ipv4 add

Finally, define the bridge domain that links all EFPs for that vlan together with the BVI for the L3 endpoint like this:


bridge-group VLAN50

bridge-domain VLAN50_BD

int g 0/0/0/0.50

routed interface BVI50

Note that I used 50 throughout for clarity, but the encap dot1q doesn't necessarily need to match the subinterface designator or the bvi number.

Also note that bridge group is merely a config hierarchy, it is the birdge-domain config that instantiates the mac learning for those interfaces connected together.




Hi Alexander,

I mean the xconnect on VLAN BVI. Because i can't found the configuration on BVI xconnect.

So we got several interface associated to BVI 50. And BVI 50 actually only layer2 xconnect service.

So how can i create vlan mode xconnect on the ASR ?

int gi0/1.50 l2 and gi0/2.50 l2 is member of vlan 50. But vlan 50 is only l2 xconnect service.

But i can't configure xconnect for bvi.


Budi L