MPLS · Topic 2 of 5

Labels, the Label Information Base and Routing Tables

Learn MPLS labels for the JN0-364: reserved labels 0 to 15, the label information base, mpls.0, inet.3 and how BGP next hops resolve over LSPs on Junos.

  • 6 min
In a nutshell
  • Labels 0 to 15 are reserved: 0 IPv4 explicit null, 1 router alert, 2 IPv6 explicit null, 3 implicit null.
  • The downstream router assigns labels; labels are locally significant.
  • Junos LDP uses liberal label retention, so the LIB holds bindings from all neighbors.

What it is

A label is a 20 bit number that a router assigns to a FEC and tells its upstream neighbors about. Labels are locally significant: each router picks its own incoming labels, and the same value can mean different things on different routers.

The label information base (LIB) is the set of all label bindings a router knows, the ones it assigned and the ones its neighbors advertised. Only the bindings it actually uses for forwarding are installed in mpls.0, the Junos label table. LSP routes for the egress addresses go into inet.3, which BGP uses to resolve next hops.

Neighboradvertises bindingstored inLIBall bindingsbest one usedmpls.0label tableLSP to egressinstallsinet.3egress addressused byBGPnext hop resolution

How it works

Label values

LabelMeaning
0IPv4 explicit null; the egress pops it and keeps the TC bits
1Router alert; the packet is sent to the routing engine
2IPv6 explicit null
3Implicit null; advertised by the egress to request PHP, never seen on the wire
4 to 15Reserved for other special uses
16 and upAssigned dynamically by the router for LSPs and services

The downstream router, closer to the egress, always chooses the label. It advertises "send me this label for this FEC" to the router upstream, and the upstream router uses that value as its outgoing label.

The label information base

The LIB holds every binding learned, including ones from neighbors that are not the best next hop. With LDP in Junos OS, which uses liberal label retention, a router keeps the bindings from every LDP neighbor even if that neighbor is not the IGP next hop. If the IGP later moves the next hop, the router already has the right label and does not need to ask for one.

You see the LIB for LDP with show ldp database. The input label database shows labels received from a neighbor, and the output label database shows labels this router sent to that neighbor.

user@R2> show ldp database
Input label database, 192.168.0.2:0--192.168.0.3:0
  Label     Prefix
      3     192.168.0.3/32
 299856     192.168.0.4/32

Output label database, 192.168.0.2:0--192.168.0.3:0
  Label     Prefix
 299792     192.168.0.1/32
      3     192.168.0.2/32

R3 advertised label 3 for its own loopback, so R2 pops toward R3. R2 advertised label 3 for its own loopback to R3 too.

Junos MPLS routing tables

TableHoldsUsed for
inet.0IPv4 unicast routesNormal IPv4 forwarding
inet.3Egress addresses of LSPs (RSVP, LDP, segment routing)BGP next hop resolution, by default only that
mpls.0Incoming labels and their operation (swap, pop)Forwarding of labeled packets on transit and penultimate routers
inet6.3IPv6 LSP routes, such as for 6PEIPv6 BGP next hop resolution

show route table mpls.0 lists each incoming label. When MPLS is enabled, Junos also installs entries for reserved labels such as 0, 1 and 2 with the action Receive.

user@R2> show route table mpls.0
0                  *[MPLS/0] 01:02:03, metric 1
                       Receive
1                  *[MPLS/0] 01:02:03, metric 1
                       Receive
2                  *[MPLS/0] 01:02:03, metric 1
                       Receive
299808             *[LDP/9] 00:10:12, metric 1
                    >  to 10.0.23.3 via ge-0/0/2.0, Swap 299856

show route table inet.3 shows the LSP routes at the ingress.

user@R1> show route table inet.3
192.168.0.4/32     *[RSVP/7/1] 00:10:12, metric 20
                    >  to 10.0.12.2 via ge-0/0/1.0, label-switched-path R1-TO-R4

How BGP uses inet.3

When a BGP route arrives with protocol next hop 192.168.0.4, Junos resolves that next hop using inet.3 as well as inet.0. The LSP route normally wins because RSVP (preference 7) and LDP (preference 9) beat any IGP route, such as OSPF internal at 10. The BGP route is then installed in inet.0 with the LSP as its forwarding next hop.

BGP routenext hop 192.168.0.4lookupinet.3RSVP 7 winsinstallsinet.0via LSP

Because only BGP looks in inet.3 by default, a ping from R1 to 192.168.0.4 itself still follows the IGP route in inet.0, not the LSP. This surprises many candidates.

Changing what uses LSPs

The traffic-engineering statement under [edit protocols mpls] changes which tables receive LSP routes.

OptionEffect
bgp (default)LSP routes go to inet.3 only; only BGP uses them
bgp-igpLSP routes go to inet.0 instead, so IGP and BGP traffic use them; inet.3 is left empty for those routes
bgp-igp-both-ribsLSP routes are copied into both inet.0 and inet.3
mpls-forwardingLSP routes in inet.0 are used for forwarding but not for route selection
user@R1# set protocols mpls traffic-engineering bgp-igp
Exam tip

If an exhibit shows the LSP egress address with protocol RSVP in inet.0, someone configured traffic-engineering bgp-igp or a related option. With the default, LSP routes appear only in inet.3.

Common mistakes

Thinking labels are global. Each router picks its own incoming labels. Segment routing node SIDs are the exception the exam may contrast, because they come from a shared block.

Expecting the upstream router to choose the label. The downstream router assigns the label and advertises it upstream.

Expecting all traffic to use the LSP. By default, only BGP routes whose next hop resolves in inet.3 use the LSP. Traffic to the egress loopback itself follows inet.0.

Mixing up the LIB and mpls.0. The LIB keeps every binding; mpls.0 holds only the ones in use.

Watch out

Do not confuse inet.3 with mpls.0. inet.3 is keyed by IP address (the egress); mpls.0 is keyed by incoming label.

What to remember for the exam

  • Labels 0 to 15 are reserved: 0 IPv4 explicit null, 1 router alert, 2 IPv6 explicit null, 3 implicit null.
  • The downstream router assigns labels; labels are locally significant.
  • Junos LDP uses liberal label retention, so the LIB holds bindings from all neighbors.
  • mpls.0 is the label table; inet.3 holds LSP egress routes; inet6.3 does the same for IPv6.
  • By default, only BGP next hop resolution uses inet.3.
  • RSVP preference 7 and LDP preference 9 beat IGP routes during next hop resolution.
  • traffic-engineering bgp-igp moves LSP routes into inet.0 so IGP traffic uses them.

Check yourself

  • Which Junos table does a transit router consult when a labeled packet arrives?

    mpls.0, which maps each incoming label to a swap or pop action.

  • A ping from the ingress to the LSP egress loopback does not use the LSP. Why?

    By default LSP routes are only in inet.3, which only BGP uses, so the ping follows the IGP route in inet.0.

  • Which router chooses the label value used on a link?

    The downstream router, closer to the egress, assigns it and advertises it upstream.

Topic 2 of 5 in MPLS

Test yourself on MPLS

The full Juniper JNCIS-SP JN0-364 question bank has 860 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Juniper. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.