I would like to make a correction to this post
The correct formula to calculate the inner MPLS label that will be used from a PE wanting to send L2 VPN information to a remote PE is:
L2VPN label = Site ID (local) - Label offset (remote) + Label base (remote)
Example
PEs R2 and R3 are connected over an MPLS network and their CEs (sites 2 and 3) want to communicate over a L2 VPN.
Topology
R2 --- MPLS network --- R3
| |
CE-X (SITE 2) CE-Y (SITE 3)
site ID 2 Site ID 3
As you can see I have assigned a site ID of 2 for SITE 2 and a site ID of 3 for SITE 3.
>>> Lets calculate the label that R2 will push in order for Layer 2 VPN information from SITE 2 to reach SITE 3:
root@R2> show l2vpn connections extensive | match "Label-base|800"
Label-base Offset Size Range Preference
800004 3 2 1 100
Incoming label: 800004, Outgoing label: 800001
root@R3> show l2vpn connections extensive | match "Label-base|800"
Label-base Offset Size Range Preference
800000 1 2 2 100
Incoming label: 800001, Outgoing label: 800004
L2VPN label = Site ID (local) - Label offset (remote) + Label base (remote) = 2 (local site ID) - 1 (remote label offset) + 800000 (remote label base) = 800001
>>> Similarly for R3, in order for SITE 3 to reach SITE 2:
root@R2> show l2vpn connections extensive | match "Label-base|800"
Label-base Offset Size Range Preference
800004 3 2 1 100
Incoming label: 800004, Outgoing label: 800001
root@R3> show l2vpn connections extensive | match "Label-base|800"
Label-base Offset Size Range Preference
800000 1 2 2 100
Incoming label: 800001, Outgoing label: 800004
L2VPN label = Site ID (local) - Label offset (remote) + Label base (remote) = 3 (local site ID) - 3 (remote label offset) + 800004 (label base remote) = 800004
>>> Further verifications:
root@R2> show route table mpls.0
...
800004 *[L2VPN/7] 01:33:04 <- incoming label
> via ge-0/0/2.0, Pop Offset: 4
ge-0/0/2.0 *[L2VPN/7] 01:33:04, metric2 1
> to 12.0.0.10 via ge-0/0/0.0, Push 800001, Push 299792(top) Offset: 252
|
outgoing label
-------------------------------
My configuration:
root@R2# show routing-instances
vpn2 {
instance-type l2vpn;
interface ge-0/0/2.0;
route-distinguisher 2:2;
vrf-target target:2:3;
protocols {
l2vpn {
encapsulation-type ethernet;
site CE-R5 {
site-identifier 2;
interface ge-0/0/2.0 {
remote-site-id 3;
}
}
}
}
}
root@R3# show routing-instances
vpn3 {
instance-type l2vpn;
interface ge-0/0/2.0;
route-distinguisher 3:3;
vrf-target target:2:3;
protocols {
l2vpn {
encapsulation-type ethernet;
site CE-R4 {
site-identifier 3;
interface ge-0/0/2.0 {
remote-site-id 2;
}
}
}
}
}
root@R2# show interfaces ge-0/0/2
encapsulation ethernet-ccc;
unit 0;
-------------------------------
By the way, can we set the label offset or label base values manually in a layer 2 vpn?
Kind Regards,
George Servetas