Configuring L2MPLS

INFO

1.set mac actions should not be added before push_l2mpls


PUSH L2 MPLS

Pushing an L2 MPLS with one label:

root@PicOS-OVS$ovs-ofctl add-flow br0 "in_port=17,ip,dl_vlan=11,actions=push_l2mpls:0x8847,set_field:22:11:11:11:11:10->dl_dst,set_field:22:00:00:00:00:01->dl_src,set_field:16->mpls_label,output:18"

Pushing an L2MPLS with two labels:

root@PicOS-OVS$ovs-ofctl add-flow br0 "in_port=17,ip,dl_vlan=11,actions=push_l2mpls:0x8847,set_field:22:11:11:11:11:10->dl_dst,set_field:22:00:00:00:00:01->dl_src,set_field:20->mpls_label,push_mpls:0x8847,set_field:16->mpls_label,output:18"
root@PicOS-OVS$ovs-ofctl add-flow br0 "in_port=17,dl_type=0x8847,dl_vlan=11,actions=push_mpls:0x8847,set_field:22:00:00:00:00:01->dl_dst,set_field:22:11:11:11:11:10->dl_src,set_field:20->mpls_label,output:18"

SWAP L2 MPLS Label

In the following configuration example, specify a flow which has two labels, and in this situation user wants to swap the outer label. The output flow is L2MPLS packet with outer label 30 and inner label 20.

root@PicOS-OVS$ovs-ofctl add-flow br0 "in_port=18,dl_type=0x8847,dl_dst=22:00:00:00:00:01,dl_vlan=11,mpls_label=16,mpls_label2=20,actions=set_field:30->mpls_label,output:17"


POP L2MPLS Label

Popping an MPLS Label of the flow:

root@PicOS-OVS$ovs-ofctl add-flow br0 "in_port=17,dl_vlan=11,dl_dst=22:00:00:00:00:01,mpls,mpls_label=16,actions=pop_l2mpls,output:18"

Popping one MPLS label for flows with two MPLS labels:

Two labels then pop one outer label.

root@PicOS-OVS$ovs-ofctl add-flow br0 "in_port=17,dl_vlan=11,dl_dst=22:00:00:00:00:01,mpls,mpls_label=16,mpls_label2=20,actions=pop_mpls:0x8847,output:18"

Popping two MPLS labels for flows with two MPLS lables

In the following configuration, specify a flow which has two labels to pop. The output flow is IP packet. Configure two pop entries to pop the flow.

root@PicOS-OVS#ovs-ofctl add-flow br0 "in_port=17,dl_vlan=11,dl_dst=22:00:00:00:00:01,mpls,mpls_label=16,mpls_label2=30,actions=pop_l2mpls,output:18"

PUSH L2MPLS Label and VLAN

Pushing one L2MPLS label and one VLAN:

In the following configuration, specify flows  to push one L2MPLS label and one VLAN.

root@PicOS-OVS#ovs-ofctl add-flow br0 "in_port=17,ip,actions=push_l2mpls:0x8847,set_field:22:22:22:22:22:22->dl_dst,set_field:22:00:00:00:00:00->dl_src,set_field:16->mpls_label,push_vlan:0x8100,set_field:11->vlan_vid,output:18"
root@PicOS-OVS#ovs-ofctl add-flow br0 in_port=2,dl_type=0x8847,dl_vlan=2999,dl_dst=22:22:22:22:22:22,mpls_label=66,actions=push_mpls:0x8847,set_field:333-\>mpls_label,push_vlan:0x8100,set_field:1999-\>vlan_vid,output:4

Pushing two L2MPLS Labels and one VLAN:

In the following configuration, specify flows to push  two MPLS labels and one VLAN.

root@PicOS-OVS#ovs-ofctl add-flow br0 "in_port=17,ip,actions=push_l2mpls:0x8847,set_field:22:11:11:11:11:10->dl_dst,set_field:22:00:00:00:00:01->dl_src,set_field:20->mpls_label,push_mpls:0x8847,set_field:16->mpls_label,push_vlan:0x8100,set_field:11->vlan_vid,output:18"

Pushing One MPLS Label and Pop One VLAN

root@PicOS-OVS#ovs-ofctl add-flow br0 "in_port=18,dl_type=0x8847,mpls_label=30,dl_dst=22:22:22:22:22:22,dl_src=44:44:44:22:22:22,dl_vlan=11,actions=push_mpls:0x8847,set_field:20->mpls_label,pop_vlan,output:17"  

 

Pushing One L2MPLS Label and Pop One VLAN

root@PicOS-OVS#ovs-ofctl add-flow br0 "in_port=18,dl_vlan=100,actions=push_L2mpls:0x8847,set_field:22:22:22:22:22:22-\>dl_dst,set_field:44:44:44:44:44:44-\>dl_src,set_field:20->mpls_label,pop_vlan,output:17"  

Pushing Two L2MPLS Headers

root@PicOS-OVS#ovs-ofctl add-flow br0 "in_port=18,dl_type=0x8847,actions=push_l2mpls:0x8847,set_field:22:00:00:00:00:01->dl_dst,set_field:22:11:11:11:11:10->dl_src,set_field:20->mpls_label,output:17"

Configuring Inner VLAN

Push L2MPLS, push one inner VLAN:

ovs-ofctl add-flow br0 "in_port=17,ip,actions=push_vlan:0x8100,set_field:8->vlan_vid,push_l2mpls:0x8847,set_field:22:22:22:22:22:22->dl_dst,set_field:22:00:00:00:00:00->dl_src,set_field:1000->mpls_label,push_vlan:0x8100,set_field:13->vlan_vid,output:18"

ovs-ofctl add-flow br0 "in_port=17,dl_vlan=2,ip,actions=push_vlan:0x8100,set_field:8->vlan_vid,push_l2mpls:0x8847,set_mpls_ttl:64,set_field:22:22:22:22:22:22->dl_dst,set_field:22:00:00:00:00:00->dl_src,set_field:1000->mpls_label,push_vlan:0x8100,set_field:11->vlan_vid,output:18"

Push L2MPLS, modify inner VLAN:

ovs-ofctl add-flow br0 "in_port=17,ip,actions=set_field:8->vlan_vid,push_l2mpls:0x8847,set_mpls_ttl:64,set_field:22:22:22:22:22:22->dl_dst,set_field:22:00:00:00:00:00->dl_src,set_field:1000->mpls_label,push_vlan:0x8100,set_field:11->vlan_vid,output:18"

ovs-ofctl add-flow br0 "in_port=17,dl_vlan=2,ip,actions=set_field:8->vlan_vid,push_l2mpls:0x8847,set_mpls_ttl:64,set_field:22:22:22:22:22:22->dl_dst,set_field:22:00:00:00:00:00->dl_src,set_field:1000->mpls_label,push_vlan:0x8100,set_field:11->vlan_vid,output:18"

Push L2MPLS, pop inner VLAN:

ovs-ofctl add-flow br0 "in_port=17,dl_vlan=2,ip,actions=pop_vlan,push_l2mpls:0x8847,set_mpls_ttl:64,set_field:22:22:22:22:22:22->dl_dst,set_field:22:00:00:00:00:00->dl_src,set_field:1000->mpls_label,push_vlan:0x8100,set_field:11->vlan_vid,output:18"

Pop inner VLAN after pop L2MPLS:

ovs-ofctl add-flow br0 "in_port=17,dl_vlan=11,dl_dst=22:22:22:22:22:22,mpls,mpls_label=1000,actions=pop_l2mpls,pop_vlan,output:1"

Modify inner VLAN after popping L2MPLS:

ovs-ofctl add-flow br0 "in_port=18,dl_vlan=11,dl_dst=22:22:22:22:22:22,mpls,mpls_label=16,mpls_label2=20,actions=pop_l2mpls,push_vlan:0x8100,set_field:100->vlan_vid,output:17"

The L2MPLS packet must encapsulate outer VLAN and not be PVID, the original packets must encapsulate the VLAN tag.

Push inner VLAN after popping L2MPLS:

ovs-ofctl add-flow br0
"in_port=17,dl_vlan=11,dl_dst=22:22:22:22:22:22,mpls,mpls_label=1000,actions=pop_l2mpls,push_vlan:0x8100,set_field:100->vlan_vid,output:18"

The L2MPLS packet must encapsulate outer VLAN and not be PVID, the original packets shouldn't encapsulate VLAN tag.



Copyright © 2024 Pica8 Inc. All Rights Reserved.