In a previous posts, we discussed LDP Protocol Label Distribution Modes, and how are they propagated throughout the network,and also in Junos, how the PE Router assigns label per interface and how to change this behavior. In this post, we’ll get a little bit specific on HOW are these labels created even before they’re propagated to the network and also how we can manipulate the label creation process to better suite our needs.
In Cisco’s IOS by default, the label allocation is per-prefix meaning that every single prefix by default gets it’s own label, but this behavior can be changed since we have two other modes to allocate labels. Here’s a list of all supported modes on IOS
• per-prefix (Default)
• per-vrf
• vrf-conn-aggr
Now let’s see how the three of them work by examining the below topology
The default setup is pretty normal, we have two CEs that are connected through a Service provider with L3VPN. OSPF is running as a PE-CE Routing protocol between the Service Provider and the customer branches.
Let’s check the MP-BGP label allocations on PE6 for CE3 and CE4
R6#show ip bgp vpnv4 all labels
Network Next Hop In label/Out label
Route Distinguisher: 100:1 (a)
1.1.1.1/32 13.13.13.13 nolabel/19
3.3.3.3/32 10.3.6.3 24/nolabel
4.4.4.4/32 10.4.6.4 27/nolabel
10.1.13.0/24 13.13.13.13 nolabel/20
10.3.4.0/24 10.3.6.3 28/nolabel
10.3.6.0/24 0.0.0.0 29/nolabel(a)
10.4.6.0/24 0.0.0.0 30/nolabel(a)
44.44.44.44/32 10.4.6.4 31/nolabel
66.66.66.66/32 0.0.0.0 32/nolabel(a)
130.130.130.130/32
13.13.13.13 nolabel/21
R6#show mpls forwarding-table vrf a
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
24 No Label 3.3.3.3/32[V] 0 Fa1/0 10.3.6.3
27 No Label 4.4.4.4/32[V] 0 Fa1/1 10.4.6.4
28 No Label 10.3.4.0/24[V] 0 Fa1/0 10.3.6.3
29 No Label 10.3.6.0/24[V] 0 aggregate/a
30 No Label 10.4.6.0/24[V] 0 aggregate/a
31 No Label 44.44.44.44/32[V] \
0 Fa1/1 10.4.6.4
32 Pop Label 66.66.66.66/32[V] \
0 aggregate/a
Now this seems to be pretty straight forward. Four labels are being generated and the Four of them are different.
• Labels 29,30,32: Are labels for the directly connected interfaces to PE6 in VRF a. Notice the (a) at the end if each line
• Labels 24,27,28,31: Are the OSPF routes received by PE6 and redistributed to the MP-BGP
You can imagen if you’re a large service provider having thousands of customers and each customer has thousands of routes, that can pretty much put a burden on your network control plane resources (“ not really the case in higher end routers”).
Now let’s see what we can do about this. First, let’s tell PE6 to allocate one label for all prefixes in VRF a
R6(config)#mpls label mode all-vrfs protocol bgp-vpnv4 per-vrf
This is a global command, which affects all the VRFs on the PE router, if you want to selectively assign for a specific VRF, you can type it like this instead
R6(config)#mpls label mode vrf a protocol bgp-vpnv4 per-vrf
Now let’s check and see how are the labels allocated this time
R6#show ip bgp vpnv4 all labels
Network Next Hop In label/Out label
Route Distinguisher: 100:1 (a)
1.1.1.1/32 13.13.13.13 nolabel/19
3.3.3.3/32 10.3.6.3 IPv4 VRF Aggr:16/nolabel
4.4.4.4/32 10.4.6.4 IPv4 VRF Aggr:16/nolabel
10.1.13.0/24 13.13.13.13 nolabel/20
10.3.4.0/24 10.3.6.3 IPv4 VRF Aggr:16/nolabel
10.3.6.0/24 0.0.0.0 IPv4 VRF Aggr:16/nolabel(a)
10.4.6.0/24 0.0.0.0 IPv4 VRF Aggr:16/nolabel(a)
44.44.44.44/32 10.4.6.4 IPv4 VRF Aggr:16/nolabel
66.66.66.66/32 0.0.0.0 IPv4 VRF Aggr:16/nolabel(a)
130.130.130.130/32
13.13.13.13 nolabel/21
R6#show mpls forwarding-table vrf a
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
16 Pop Label IPv4 VRF[V] 0 aggregate/a
You can see that all the prefix inside vrf a now has the label 16. Now any other PE in the network will only need to allocate label 16 to reach all the networks in PE6 vrf a
One interesting application for that would be putting the entire Internet 500,000 prefix (BGP) routing table in a VRF.
now let’s see the effect of the final option on our hands , the connected and aggregate label assignment
R6(config)#mpls label mode all-vrfs protocol bgp-vpnv4 vrf-conn-aggr
Let’s check the label assignment now
R6#show ip bgp vpnv4 all labels
Network Next Hop In label/Out label
Route Distinguisher: 100:1 (a)
1.1.1.1/32 13.13.13.13 nolabel/19
3.3.3.3/32 10.3.6.3 22/nolabel
4.4.4.4/32 10.4.6.4 23/nolabel
10.1.13.0/24 13.13.13.13 nolabel/20
10.3.4.0/24 10.3.6.3 25/nolabel
10.3.6.0/24 0.0.0.0 IPv4 VRF Aggr:16/nolabel(a)
10.4.6.0/24 0.0.0.0 IPv4 VRF Aggr:16/nolabel(a)
44.44.44.44/32 10.4.6.4 26/nolabel
66.66.66.66/32 0.0.0.0 IPv4 VRF Aggr:16/nolabel(a)
130.130.130.130/32
13.13.13.13 nolabel/21
R6#show mpls forwarding-table vrf a
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
16 Pop Label IPv4 VRF[V] 0 aggregate/a
22 No Label 3.3.3.3/32[V] 0 Fa1/0 10.3.6.3
23 No Label 4.4.4.4/32[V] 0 Fa1/1 10.4.6.4
25 No Label 10.3.4.0/24[V] 0 Fa1/0 10.3.6.3
26 No Label 44.44.44.44/32[V] \
0 Fa1/1 10.4.6.4
We can see that label 16 is now assigned for all the connected interfaces in PE6 vrf a, whilst all prefix learned via PE-CE ospf has a label assigned independently. Note that this will also assign a single label for all BGP aggregate routes.
In Cisco’s IOS by default, the label allocation is per-prefix meaning that every single prefix by default gets it’s own label, but this behavior can be changed since we have two other modes to allocate labels. Here’s a list of all supported modes on IOS
• per-prefix (Default)
• per-vrf
• vrf-conn-aggr
Now let’s see how the three of them work by examining the below topology
The default setup is pretty normal, we have two CEs that are connected through a Service provider with L3VPN. OSPF is running as a PE-CE Routing protocol between the Service Provider and the customer branches.
Let’s check the MP-BGP label allocations on PE6 for CE3 and CE4
R6#show ip bgp vpnv4 all labels
Network Next Hop In label/Out label
Route Distinguisher: 100:1 (a)
1.1.1.1/32 13.13.13.13 nolabel/19
3.3.3.3/32 10.3.6.3 24/nolabel
4.4.4.4/32 10.4.6.4 27/nolabel
10.1.13.0/24 13.13.13.13 nolabel/20
10.3.4.0/24 10.3.6.3 28/nolabel
10.3.6.0/24 0.0.0.0 29/nolabel(a)
10.4.6.0/24 0.0.0.0 30/nolabel(a)
44.44.44.44/32 10.4.6.4 31/nolabel
66.66.66.66/32 0.0.0.0 32/nolabel(a)
130.130.130.130/32
13.13.13.13 nolabel/21
R6#show mpls forwarding-table vrf a
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
24 No Label 3.3.3.3/32[V] 0 Fa1/0 10.3.6.3
27 No Label 4.4.4.4/32[V] 0 Fa1/1 10.4.6.4
28 No Label 10.3.4.0/24[V] 0 Fa1/0 10.3.6.3
29 No Label 10.3.6.0/24[V] 0 aggregate/a
30 No Label 10.4.6.0/24[V] 0 aggregate/a
31 No Label 44.44.44.44/32[V] \
0 Fa1/1 10.4.6.4
32 Pop Label 66.66.66.66/32[V] \
0 aggregate/a
Now this seems to be pretty straight forward. Four labels are being generated and the Four of them are different.
• Labels 29,30,32: Are labels for the directly connected interfaces to PE6 in VRF a. Notice the (a) at the end if each line
• Labels 24,27,28,31: Are the OSPF routes received by PE6 and redistributed to the MP-BGP
You can imagen if you’re a large service provider having thousands of customers and each customer has thousands of routes, that can pretty much put a burden on your network control plane resources (“ not really the case in higher end routers”).
Now let’s see what we can do about this. First, let’s tell PE6 to allocate one label for all prefixes in VRF a
R6(config)#mpls label mode all-vrfs protocol bgp-vpnv4 per-vrf
This is a global command, which affects all the VRFs on the PE router, if you want to selectively assign for a specific VRF, you can type it like this instead
R6(config)#mpls label mode vrf a protocol bgp-vpnv4 per-vrf
Now let’s check and see how are the labels allocated this time
R6#show ip bgp vpnv4 all labels
Network Next Hop In label/Out label
Route Distinguisher: 100:1 (a)
1.1.1.1/32 13.13.13.13 nolabel/19
3.3.3.3/32 10.3.6.3 IPv4 VRF Aggr:16/nolabel
4.4.4.4/32 10.4.6.4 IPv4 VRF Aggr:16/nolabel
10.1.13.0/24 13.13.13.13 nolabel/20
10.3.4.0/24 10.3.6.3 IPv4 VRF Aggr:16/nolabel
10.3.6.0/24 0.0.0.0 IPv4 VRF Aggr:16/nolabel(a)
10.4.6.0/24 0.0.0.0 IPv4 VRF Aggr:16/nolabel(a)
44.44.44.44/32 10.4.6.4 IPv4 VRF Aggr:16/nolabel
66.66.66.66/32 0.0.0.0 IPv4 VRF Aggr:16/nolabel(a)
130.130.130.130/32
13.13.13.13 nolabel/21
R6#show mpls forwarding-table vrf a
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
16 Pop Label IPv4 VRF[V] 0 aggregate/a
You can see that all the prefix inside vrf a now has the label 16. Now any other PE in the network will only need to allocate label 16 to reach all the networks in PE6 vrf a
One interesting application for that would be putting the entire Internet 500,000 prefix (BGP) routing table in a VRF.
now let’s see the effect of the final option on our hands , the connected and aggregate label assignment
R6(config)#mpls label mode all-vrfs protocol bgp-vpnv4 vrf-conn-aggr
Let’s check the label assignment now
R6#show ip bgp vpnv4 all labels
Network Next Hop In label/Out label
Route Distinguisher: 100:1 (a)
1.1.1.1/32 13.13.13.13 nolabel/19
3.3.3.3/32 10.3.6.3 22/nolabel
4.4.4.4/32 10.4.6.4 23/nolabel
10.1.13.0/24 13.13.13.13 nolabel/20
10.3.4.0/24 10.3.6.3 25/nolabel
10.3.6.0/24 0.0.0.0 IPv4 VRF Aggr:16/nolabel(a)
10.4.6.0/24 0.0.0.0 IPv4 VRF Aggr:16/nolabel(a)
44.44.44.44/32 10.4.6.4 26/nolabel
66.66.66.66/32 0.0.0.0 IPv4 VRF Aggr:16/nolabel(a)
130.130.130.130/32
13.13.13.13 nolabel/21
R6#show mpls forwarding-table vrf a
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
16 Pop Label IPv4 VRF[V] 0 aggregate/a
22 No Label 3.3.3.3/32[V] 0 Fa1/0 10.3.6.3
23 No Label 4.4.4.4/32[V] 0 Fa1/1 10.4.6.4
25 No Label 10.3.4.0/24[V] 0 Fa1/0 10.3.6.3
26 No Label 44.44.44.44/32[V] \
0 Fa1/1 10.4.6.4
We can see that label 16 is now assigned for all the connected interfaces in PE6 vrf a, whilst all prefix learned via PE-CE ospf has a label assigned independently. Note that this will also assign a single label for all BGP aggregate routes.