Juniper Junos inet.3 Routing Table Deep Dive: BGP Next-Hop Resolution & MPLS TE Modes

In this deep dive, we break down what the Juniper Junos inet.3 routing table actually does, how BGP resolves protocol next-hops across inet.3 and inet.0, and how to control LSP usage in production networks without breaking MPLS L3VPN services.

Quick Start: Core Junos Routing Tables

To understand how Junos separates IP routing from MPLS label switching, start with the four core routing tables:

  • inet.0: The default IPv4 unicast routing table storing directly connected, static, OSPF, IS-IS, and standard BGP IPv4 routes.
  • inet.3: The MPLS IPv4 egress table storing Label-Switched Path (LSP) destinations, LSP names, and egress interfaces. Entries here are populated strictly by MPLS signaling protocols such as LDP and RSVP-TE.
  • inet6.0: The default IPv6 unicast routing table for local, connected, static, and dynamic IPv6 prefixes.
  • mpls.0: The MPLS label forwarding table (LFIB). When a router acts as a transit P node, incoming labeled packets are switched exclusively using mpls.0.

Think of inet.0 as the Junos equivalent of the global routing table on Cisco IOS or Huawei VRP. While BGP routes also reside in inet.0, BGP relies on a distinct recursive next-hop resolution path. Let’s walk through a lab topology to see why this matters.

Juniper Junos inet.3 and MPLS blackhole lab topology with vMX-1 (10.0.0.1), BGP-free core P router vMX-2 (10.0.0.2), vMX-3 (10.0.0.3), VRF RED L3VPN clients, and generic inet.0 BGP clients
Figure 1: Lab topology with iBGP peering between vMX-1 and vMX-3 over BGP-free core router vMX-2, serving both VRF RED L3VPN and generic IPv4 clients.

In Figure 1, vMX-1 (10.0.0.1) and vMX-3 (10.0.0.3) form an iBGP peering session sourced from lo0.0 and advertise their respective customer subnets. Because BGP sets the protocol next-hop to the peering loopback IP (10.0.0.3), vMX-1 must perform a recursive lookup to resolve the physical next-hop and outgoing interface:

root@vMX-1> show route table inet.0 192.0.1.0/24 extensive

inet.0: 12 destinations, 12 routes (12 active, 0 holddown, 0 hidden)
192.0.1.0/24 (1 entry, 1 announced)
TSI:
KRT in-kernel 192.0.1.0/24 -> {indirect(1048574)}
        *BGP    Preference: 170/-101
                Next hop type: Indirect
                Address: 0x940f9d0
                Next-hop reference count: 3
                Source: 10.0.0.3
                Next hop type: Router, Next hop index: 569
                Next hop: 172.16.0.2 via ge-0/0/0.0, selected
                Session Id: 0x1
                Protocol next hop: 10.0.0.3
             ...

root@vMX-1> show route table inet.0 192.0.1.0/24

inet.0: 12 destinations, 12 routes (12 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

192.0.1.0/24       *[BGP/170] 02:20:53, localpref 100, from 10.0.0.3
                      AS path: I, validation-state: unverified
                    > to 172.16.0.2 via ge-0/0/0.0

vMX-1 cleanly resolves protocol next-hop 10.0.0.3 to 172.16.0.2 out ge-0/0/0.0. However, notice the catch: iBGP runs only between vMX-1 and vMX-3—core router vMX-2 runs no BGP at all. Here is what happens when native IP traffic enters the core:

  1. vMX-1 matches destination 192.0.1.0/24 and sees protocol next-hop 10.0.0.3;
  2. Because 10.0.0.3 is non-local, vMX-1 recursively resolves it;
  3. vMX-1 discovers 10.0.0.3 is reachable via 172.16.0.2 on ge-0/0/0.0;
  4. vMX-1 forwards an unlabeled IPv4 packet to 172.16.0.2 (vMX-2);
  5. vMX-2 performs an IP lookup in inet.0, finds no entry for 192.0.1.0/24, and drops the packet.

This is the classic BGP routing blackhole. Standard solutions include a full iBGP mesh, GRE tunnels, VXLAN, or MPLS. MPLS is overwhelmingly favored in service provider cores for its scalability and traffic-engineering capabilities—and on Junos, enabling MPLS centers squarely on inet.3.

Deep Dive: What Is the inet.3 Routing Table?

Whenever a Junos router serves as the ingress Label Edge Router (LER) for an MPLS LSP, the egress loopback endpoint appears in inet.3. Crucially, inet.3 is populated solely by LDP and RSVP signaling—never by OSPF or IS-IS.

Alongside LDP, let’s configure an explicit RSVP-TE tunnel to-r3 on vMX-1 and inspect inet.3:

root@vMX-1# show protocols rsvp
interface ge-0/0/0.0; // Core-facing interconnect interface

[edit]
root@vMX-1# show protocols mpls
label-switched-path to-r3 { // Explicitly defined MPLS LSP path
    to 10.0.0.3;
    ldp-tunneling;
}
interface ge-0/0/0.0;

root@vMX-1> show configuration protocols ospf
traffic-engineering;
area 0.0.0.0 {
    interface ge-0/0/0.0;
    interface lo0.0;
}
root@vMX-1> show route table inet.3

inet.3: 2 destinations, 4 routes (2 active, 0 holddown, 1 hidden)
+ = Active Route, - = Last Active, * = Both

10.0.0.2/32        *[LDP/9] 14:15:00, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0
10.0.0.3/32        *[RSVP/7/1] 14:13:50, metric 2
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3
                    [LDP/9] 14:13:49, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3

Notice three important Junos behaviors in the output above:

  • Loopback-Only LDP Advertisement: By default, Junos LDP (like Huawei VRP, and unlike Cisco IOS) advertises FEC bindings only for loopback addresses, not physical transit interfaces.
  • RSVP Outranks LDP: Junos assigns RSVP a default route preference of 7 versus 9 for LDP, so traffic toward 10.0.0.3/32 selects label-switched-path to-r3.
  • Penultimate Hop Popping (PHP): Entry 10.0.0.2/32 shows no Push label because vMX-2 is directly attached to vMX-1, so PHP strips the transport label one hop early. If you rely on MPLS EXP bits for end-to-end QoS, configure explicit-null to preserve the label up to the egress PE.

Core Mechanism: How inet.3 Resolves BGP Next-Hops

In Junos, inet.3 has one primary mission: resolving BGP protocol next-hops. Unlike IGPs such as OSPF (which always stay inside inet.0), BGP checks inet.3 first. Only if no LSP exists in inet.3 will standard inet.0 BGP fall back to inet.0; MP-BGP L3VPN routes will not resolve at all without an entry in inet.3.

With MPLS, LDP, and RSVP-TE active, re-check 192.0.1.0/24 on vMX-1:

root@vMX-1> show route table inet.0 192.0.1.0/24

inet.0: 12 destinations, 12 routes (12 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

192.0.1.0/24       *[BGP/170] 18:31:51, localpref 100, from 10.0.0.3
                      AS path: I, validation-state: unverified
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3

Notice that the active forwarding entry now points to label-switched-path to-r3. Packet forwarding now works end to end without BGP on vMX-2:

  1. vMX-1 looks up 192.0.1.0/24 and extracts protocol next-hop 10.0.0.3;
  2. Because 10.0.0.3 is indirect, BGP queries inet.3 first;
  3. inet.3 resolves 10.0.0.3/32 to ge-0/0/0.0 via 172.16.0.2 over LSP to-r3, pushing an MPLS label onto the packet;
  4. vMX-1 transmits the labeled packet to vMX-2;
  5. Seeing an MPLS header, vMX-2 looks up the label in mpls.0—never touching inet.0—performs PHP to pop the label, and forwards the raw IPv4 packet to vMX-3;
  6. vMX-3 looks up the customer subnet in inet.0/ARP and delivers the packet (return traffic follows the symmetric reverse path).

This is why service provider core (P) routers are typically BGP-free: running only IGP + MPLS keeps massive internet routing tables out of the core and even lets high-throughput label switches forward transit traffic at wire speed.

Hands-On Lab: Binding External eBGP Next-Hops into inet.3

Let’s expand the topology by attaching an External router (AS 65001) to vMX-3 announcing 192.168.192.168/32 over eBGP, while intentionally leaving next-hop-self disabled on vMX-3:

Extended Junos topology adding External AS 65001 router connected to vMX-3 (100.64.1.1 to 100.64.1.2) announcing 192.168.192.168/32, solved by install 100.64.1.2/32 on vMX-1
Figure 2: Without next-hop-self, vMX-1 receives 192.168.192.168/32 with protocol next-hop 100.64.1.2/32 and hides it until installed into inet.3.

Querying 192.168.192.168 on vMX-1 returns nothing until we inspect hidden routes:

root@vMX-1> show route 192.168.192.168

root@vMX-1> show route 192.168.192.168 hidden extensive

inet.0: 13 destinations, 13 routes (12 active, 0 holddown, 1 hidden)
192.168.192.168/32 (1 entry, 0 announced)
         BGP    Preference: 170/-101
                Next hop type: Unusable
                Address: 0x9293e84
                Next-hop reference count: 3
                State: <Hidden Int Ext>
                Peer AS: 65000
                Age: 17:18:17
                Validation State: unverified
                Task: BGP_65000_65000.10.0.0.3+59929
                AS path: 65001 I
                Accepted
                Localpref: 100
                Router ID: 10.0.0.3
                Indirect next hops: 1
                        Protocol next hop: 100.64.1.2
                        Indirect next hop: 0x0 - INH Session ID: 0x0

Because eBGP preserves the external next-hop (100.64.1.2) when reflected over iBGP, vMX-1 fails resolution in four steps:

  1. vMX-1 sees protocol next-hop 100.64.1.2;
  2. It checks inet.3 for 100.64.1.2—no LSP found;
  3. It falls back to inet.0—no route found;
  4. The next-hop is marked Unusable and the prefix enters <Hidden> state.

While next-hop-self is the textbook answer, suppose we want to keep the original external next-hop intact and steer packets over our MPLS LSP (even if the external link were passive in OSPF, vMX-2 still wouldn’t carry customer routes). The fix is to install 100.64.1.2/32 directly into inet.3 bound to RSVP-TE LSP to-r3:

root@vMX-1> show configuration protocols mpls
label-switched-path to-r3 {
    to 10.0.0.3;
    ldp-tunneling;
    install 100.64.1.2/32;
}
interface ge-0/0/0.0;

Verify both routing tables and test reachability from Client-A:

root@vMX-1> show route table inet.3

inet.3: 3 destinations, 5 routes (3 active, 0 holddown, 1 hidden)
+ = Active Route, - = Last Active, * = Both

10.0.0.2/32        *[LDP/9] 20:10:48, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0
10.0.0.3/32        *[RSVP/7/1] 00:00:20, metric 2
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3
                    [LDP/9] 20:10:33, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3
100.64.1.2/32      *[RSVP/7/1] 00:00:20, metric 2
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3

root@vMX-1> show route table inet.0 192.168.192.168

inet.0: 13 destinations, 13 routes (13 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

192.168.192.168/32 *[BGP/170] 17:33:08, localpref 100, from 10.0.0.3
                      AS path: 65001 I, validation-state: unverified
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3
root@Normal-IP-Forwarding-Client-A:~# ping 192.168.192.168
PING 192.168.192.168 (192.168.192.168) 56(84) bytes of data.
64 bytes from 192.168.192.168: icmp_seq=1 ttl=61 time=10.4 ms
64 bytes from 192.168.192.168: icmp_seq=2 ttl=61 time=8.77 ms
--- 192.168.192.168 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 2ms
rtt min/avg/max/mdev = 8.773/9.585/10.397/0.812 ms
  • Pro: Granular static control over which external next-hops traverse a given LSP.
  • Con: Manual configuration scales poorly when managing thousands of external BGP peers.

You can also advertise an RSVP LSP as a virtual OSPF link in SPF calculations (note that configuring it bidirectionally allows OSPF to treat the LSP as a point-to-point adjacency):

root@vMX-1# show protocols ospf | display set | grep label
set protocols ospf area 0.0.0.0 label-switched-path to-r3 metric 1

root@vMX-1# run show route table inet.0 protocol ospf

inet.0: 12 destinations, 12 routes (12 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

10.0.0.2/32        *[OSPF/10] 00:13:38, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0
10.0.0.3/32        *[OSPF/10] 00:13:38, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3
100.64.1.0/24      *[OSPF/10] 00:04:51, metric 2
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3
172.16.1.0/24      *[OSPF/10] 00:04:51, metric 2
                    > to 172.16.0.2 via ge-0/0/0.0
                      to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3
224.0.0.5/32       *[OSPF/10] 23:09:00, metric 1
                      MultiRecv

root@vMX-1# run show ospf neighbor
Address          Interface              State     ID               Pri  Dead
172.16.0.2       ge-0/0/0.0             Full      10.0.0.2         128    37
10.0.0.3         to-r3                  Full      10.0.0.3           0     0

Advanced Lab: Forwarding All Traffic Toward vMX-3 Over LSPs (3 Modes)

Normally, only BGP queries inet.3. If you want all non-VRF traffic toward 10.0.0.3 (including non-BGP routes) to traverse the LSP, Junos provides three protocols mpls traffic-engineering options. First, let’s verify that our baseline MPLS L3VPN service (VRF RED) is healthy:

root@vMX-1> show route table red.inet.0

red.inet.0: 3 destinations, 3 routes (3 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

192.1.0.0/24       *[Direct/0] 00:05:46
                    > via ge-0/0/5.0
192.1.0.1/32       *[Local/0] 00:05:46
                      Local via ge-0/0/5.0
192.1.1.0/24       *[BGP/170] 00:04:59, localpref 100, from 10.0.0.3
                      AS path: I, validation-state: unverified
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3
root@Client-L3VPN-RED-1:~# ping 192.1.1.2
PING 192.1.1.2 (192.1.1.2) 56(84) bytes of data.
64 bytes from 192.1.1.2: icmp_seq=1 ttl=61 time=7.02 ms
64 bytes from 192.1.1.2: icmp_seq=2 ttl=61 time=6.32 ms
--- 192.1.1.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 3ms
rtt min/avg/max/mdev = 6.324/6.673/7.022/0.349 ms

Option 1: bgp-igp (Moves All inet.3 Entries to inet.0)

root@vMX-1# set protocols mpls traffic-engineering bgp-igp

root@vMX-1# run show route table inet.0

inet.0: 13 destinations, 16 routes (13 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

10.0.0.1/32        *[Direct/0] 1d 00:32:24
                    > via lo0.0
10.0.0.2/32        *[LDP/9] 00:02:03, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0
                    [OSPF/10] 01:37:06, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0
10.0.0.3/32        *[RSVP/7/1] 00:02:03, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3 (!!!caution!!!)
                    [LDP/9] 00:02:03, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3
                    [OSPF/10] 01:37:06, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3

root@vMX-1# run show route table inet.3

[edit]

Look closely: inet.3 is now completely empty! Because bgp-igp moves rather than copies LSP entries into inet.0, all MP-BGP L3VPN services (which query inet.3 exclusively) immediately break:

root@localhost:~# ping 192.1.1.2
PING 192.1.1.2 (192.1.1.2) 56(84) bytes of data.
From 192.1.0.1 icmp_seq=1 Destination Net Unreachable
From 192.1.0.1 icmp_seq=2 Destination Net Unreachable
--- 192.1.1.2 ping statistics ---
2 packets transmitted, 0 received, +2 errors, 100% packet loss, time 2ms
  • Pro: One line pushes all non-VRF traffic toward 10.0.0.3 over MPLS LSPs.
  • Con: Empties inet.3, breaking MPLS L3VPN and other MP-BGP services.

Option 2: bgp-igp-both-ribs (Copies inet.3 Entries to inet.0)

root@vMX-1# set protocols mpls traffic-engineering bgp-igp-both-ribs

[edit]

root@vMX-1# run show route table inet.0

inet.0: 13 destinations, 16 routes (13 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

10.0.0.1/32        *[Direct/0] 1d 00:41:02
                    > via lo0.0
10.0.0.2/32        *[LDP/9] 00:00:15, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0
                    [OSPF/10] 01:45:44, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0
10.0.0.3/32        *[RSVP/7/1] 00:00:15, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3
                    [LDP/9] 00:00:15, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3
                    [OSPF/10] 01:45:44, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3

root@vMX-1# run show route table inet.3

inet.3: 3 destinations, 4 routes (3 active, 0 holddown, 1 hidden)
+ = Active Route, - = Last Active, * = Both
  {snip..}

Now inet.3 remains intact and L3VPN connectivity recovers. However, because RSVP (pref 7) and LDP (pref 9) have lower preference values than OSPF (pref 10), they become the active route inside inet.0, which corrupts IGP route redistribution and routing policy evaluation.

  • Pro: Sends non-VRF traffic over LSPs while keeping MPLS L3VPN operational.
  • Con: Replaces OSPF as the active route in inet.0, breaking IGP policy and redistribution.

Option 3: mpls-forwarding (IGP Routing + LSP Data Forwarding)

root@vMX-1# set protocols mpls traffic-engineering mpls-forwarding

root@vMX-1# run show route table inet.3 10.0.0.3

inet.3: 3 destinations, 4 routes (3 active, 0 holddown, 1 hidden)
+ = Active Route, - = Last Active, * = Both

10.0.0.3/32        *[RSVP/7/1] 00:24:25, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3
                    [LDP/9] 00:01:37, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3

[edit]
root@vMX-1# run show route table inet.0 10.0.0.3

inet.0: 13 destinations, 16 routes (13 active, 1 holddown, 0 hidden)
@ = Routing Use Only, # = Forwarding Use Only
+ = Active Route, - = Last Active, * = Both

10.0.0.3/32        @[OSPF/10] 02:09:58, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3
                   #[RSVP/7/1] 00:24:29, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3
                    [LDP/9] 00:01:41, metric 1
                    > to 172.16.0.2 via ge-0/0/0.0, label-switched-path to-r3

With mpls-forwarding, Junos decouples control-plane route selection (@ = Routing Use Only via OSPF) from FIB forwarding (# = Forwarding Use Only via RSVP/LDP) while preserving inet.3. The trade-off is that it acts globally—large ISP backbones often require finer per-prefix control.

Architecture comparison of Junos BGP next-hop resolution order (inet.3 first, fallback to inet.0) and the three protocols mpls traffic-engineering modes: bgp-igp, bgp-igp-both-ribs, and mpls-forwarding
Figure 3: Junos BGP next-hop lookup priority (inet.3 → inet.0) and behavioral comparison of the three MPLS traffic-engineering modes.

Summary & References

  • Default Lookup Order: Only BGP queries inet.3 by default, pushing the highest-priority LSP label (RSVP > LDP) when matched.
  • inet.0 Fallback: If no LSP matches in inet.3, standard inet.0 BGP falls back to inet.0 and forwards native unlabeled IP packets (whereas VPNv4 fails).
  • Static Routes Over LSPs: A static route on an ingress LER targeting a remote loopback will not resolve via inet.3 unless you append the resolve option.
  • bgp-igp: Sends inet.0 traffic over LSPs, but empties inet.3 and breaks MPLS L3VPN.
  • bgp-igp-both-ribs: Preserves inet.3, but lets LDP/RSVP outrank IGP routes in inet.0 and disrupts routing policies.
  • mpls-forwarding: Cleanest global option—preserves IGP routing (@) and L3VPN while forwarding via LSPs (#), though it lacks per-prefix granularity.

References:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.