I am always forgetting how to do l2circuits in Juniper, partially as there seem to be a zillion ways to configure encapsulation and VLAN handling, all of which seem to commit but seemingly very few seem to work.
This is a super quick note-to-self which describes how to locally switch (could simply be extended to LDP-signalled l2circuit over an MPLS core though) a point-to-point circuit, one end VLAN tagged and the other end untagged.
For this example, we have two interfaces - both on a single MX router called mx2.lab. Our ‘tagged’ or NNI facing interface is xe-0/0/1, and we’re using VLAN 250. Our ‘untagged’ or CPE facing interface is xe-2/2/1, not using a VLAN at all (dedicating the whole interface). This can (again) be expanded to use S/C tags, multiple encapsulations etc, but I’m not going there yet.
What we’re aiming to see is traffic coming in on a VLAN tagged interface and being locally switched to an untagged interface. To lab this, I have a VLAN-tagged interface with IP 10.10.40.1/24 and an untagged VM, sitting on 10.10.40.2/24 - when it’s configured, they should be able to ping one another.
We need 3 chunks of config to make this config work:
- The tagged interface
set interfaces xe-0/0/1 unit 250 description "Tagged interface for L2Circuit Test" set interfaces xe-0/0/1 unit 250 encapsulation vlan-ccc set interfaces xe-0/0/1 unit 250 vlan-id 250 set interfaces xe-0/0/1 unit 250 family ccc
- The untagged interface
set interfaces xe-2/2/1 description "Untagged interface for L2Circuit Test" set interfaces xe-2/2/1 mtu 9100 set interfaces xe-2/2/1 encapsulation ethernet-ccc set interfaces xe-2/2/1 unit 0 input-vlan-map push set interfaces xe-2/2/1 unit 0 input-vlan-map vlan-id 250 set interfaces xe-2/2/1 unit 0 output-vlan-map pop
- The l2circuit config
set protocols l2circuit local-switching interface xe-0/0/1.250 end-interface interface xe-2/2/1.0 set protocols l2circuit local-switching interface xe-0/0/1.250 ignore-encapsulation-mismatch set protocols l2circuit local-switching interface xe-0/0/1.250 ignore-mtu-mismatch
With that config loaded on mx2.lab, packets will fly between the untagged VM on xe-2/2/1 and xe-0/0/1.250