LDP track-igp-metric
1. Intro
In this post we will demonstrate the impact of LDP track-igp-metric.
The setup is the one from the diagram below, where R1 receives the 3.3.3.0/24 prefix via BGP from R9 and R6. Depending on whether track-igp-metric command is configured or not, R1 will prefer either R9 or R6 to reach 3.3.3.0/24.

2. Initial config
The initial config is the basic one, with LDP activated on the 2 interfaces and the loopback:
root@R1# show protocols ldp | display set
set protocols ldp transport-address router-id
set protocols ldp interface ge-0/0/2.0
set protocols ldp interface ge-0/0/3.0
set protocols ldp interface lo0.0
We can see the remote loopbacks in the inet.3 table. By default, the LDP routes have a metric of 1 – because there is no metric in LDP FEC.
### Notice the metric is 1 for all remote loopbacks, irrespective of how many hop away
root@R1# run show route 17.0.0/24
inet.0: 32 destinations, 33 routes (32 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
17.0.0.1/32 *[Direct/0] 04:10:39
> via lo0.0
17.0.0.4/32 *[OSPF/10] 01:47:55, metric 1000
> to 17.8.2.2 via ge-0/0/3.0
17.0.0.5/32 *[OSPF/10] 01:45:58, metric 2000
> to 17.8.2.2 via ge-0/0/3.0
17.0.0.6/32 *[OSPF/10] 00:26:14, metric 2000
> to 17.8.1.2 via ge-0/0/2.0
17.0.0.9/32 *[OSPF/10] 00:26:14, metric 1000
> to 17.8.1.2 via ge-0/0/2.0
inet.3: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
17.0.0.4/32 *[LDP/9] 00:27:38, metric 1
> to 17.8.2.2 via ge-0/0/3.0
17.0.0.5/32 *[LDP/9] 00:27:38, metric 1
> to 17.8.2.2 via ge-0/0/3.0, Push 299856
17.0.0.6/32 *[LDP/9] 00:26:13, metric 1
> to 17.8.1.2 via ge-0/0/2.0, Push 299904
17.0.0.9/32 *[LDP/9] 00:26:13, metric 1
> to 17.8.1.2 via ge-0/0/2.0
3. No track-igp-metric configured
The LDP default metric 1 will have an impact on the 3.3.3.0/24 prefix.
We want to use the 17.0.0.9 router for routing to 3.3.3.0/24, because it is closer to R1, but this is not happening at the moment:
### We are receiving the 3.3.3.0/24 prefix from both 17.0.0.9 and 17.0.0.6
### But because the IGP metric is the same, the 17.0.0.6 will be used, because lowest Router ID
root@R1# run show route 3.3.3/24 extensive
inet.0: 32 destinations, 33 routes (32 active, 0 holddown, 0 hidden)
3.3.3.0/24 (2 entries, 1 announced)
TSI:
KRT in-kernel 3.3.3.0/24 -> {indirect(1048575)}
*BGP Preference: 170/-101
Next hop type: Indirect, Next hop index: 0
Address: 0x7bbf144
Next-hop reference count: 2, key opaque handle: 0x0, non-key opaque handle: 0x0
Kernel Table Id: 0
Source: 17.0.0.6
Next hop type: Router, Next hop index: 662
Next hop: 17.8.1.2 via ge-0/0/2.0, selected
Label operation: Push 299904
Label TTL action: prop-ttl
Load balance label: Label 299904: None;
Label element ptr: 0x9f5ec30
Label parent element ptr: 0x0
Label element references: 1
Label element child references: 0
Label element lsp id: 0
Session Id: 140
Protocol next hop: 17.0.0.6
Indirect next hop: 0x791dd50 1048575 INH Session ID: 323
State: <Active Int Ext>
Local AS: 64512 Peer AS: 64512
Age: 37:02 Metric2: 1
Validation State: unverified
Task: BGP_64512.17.0.0.6
Announcement bits (2): 0-KRT 6-Resolve tree 3
AS path: I
Accepted
Localpref: 100
Router ID: 17.0.0.6
Thread: junos-main
Indirect next hops: 1
Protocol next hop: 17.0.0.6 Metric: 1 ResolvState: Resolved
Indirect next hop: 0x791dd50 1048575 INH Session ID: 323
Indirect path forwarding next hops: 1
Next hop type: Router
Next hop: 17.8.1.2 via ge-0/0/2.0
Session Id: 140
17.0.0.6/32 Originating RIB: inet.3
Metric: 1 Node path count: 1
Forwarding nexthops: 1
Next hop type: Router
Next hop: 17.8.1.2 via ge-0/0/2.0
Session Id: 140
BGP Preference: 170/-101
Next hop type: Indirect, Next hop index: 0
Address: 0x7bbeff4
Next-hop reference count: 1, key opaque handle: 0x0, non-key opaque handle: 0x0
Kernel Table Id: 0
Source: 17.0.0.9
Next hop type: Router, Next hop index: 0
Next hop: 17.8.1.2 via ge-0/0/2.0, selected
Label element ptr: 0x9f5e4d8
Label parent element ptr: 0x0
Label element references: 1
Label element child references: 0
Label element lsp id: 0
Session Id: 0
Protocol next hop: 17.0.0.9
Indirect next hop: 0x791dbb8 - INH Session ID: 0
State: <NotBest Int Ext Changed>
Inactive reason: Not Best in its group - Router ID
Local AS: 64512 Peer AS: 64512
Age: 34:09 Metric2: 1
Validation State: unverified
Task: BGP_64512.17.0.0.9
AS path: I
Accepted
Localpref: 100
Router ID: 17.0.0.9
Thread: junos-main
Indirect next hops: 1
Protocol next hop: 17.0.0.9 Metric: 1 ResolvState: Resolved
Indirect next hop: 0x791dbb8 - INH Session ID: 0
Indirect path forwarding next hops: 1
Next hop type: Router
Next hop: 17.8.1.2 via ge-0/0/2.0
Session Id: 0
17.0.0.9/32 Originating RIB: inet.3
Metric: 1 Node path count: 1
Forwarding nexthops: 1
Next hop type: Router
Next hop: 17.8.1.2 via ge-0/0/2.0
Session Id: 0
4. Configure track-igp-metric
With the track-igp-metric knob configured, R1 will use the IGP metric also in LDP.
BGP will see that LDP metric, will compare, so it will use the 17.0.0.9 for routing to 3.3.3.0/24.
### Let's configure the track-igp-metric knob:
root@R1# set protocols ldp track-igp-metric
[edit]
root@R1# show | compare
[edit protocols ldp]
+ track-igp-metric;
[edit]
root@R1# commit
commit complete
root@R1# run show ldp overview
Instance: master
Reference count: 4
Router ID: 17.0.0.1
LDP inet: enabled
Transport preference: IPv4
Message id: 19
Configuration sequence: 8
Deaggregate: disabled
Explicit null: disabled
IPv6 tunneling: disabled
Strict targeted hellos: disabled
Loopback if added: yes
Route preference: 9
Unicast transit LSP chaining: disabled
P2MP transit LSP chaining: disabled
Transit LSP statistics based on route statistics: disabled
LDP route acknowledgement: enabled
BGP export: enabled
No TTL propagate: disabled
LDP mtu discovery: disabled
LDP SR Mapping Client: disabled
Capabilities enabled: none
Egress FEC capabilities enabled: entropy-label-capability
Downstream unsolicited Sessions:
Operational: 2
Retention: liberal
Control: ordered
Auto targeted sessions:
Auto targeted: disabled
Dynamic tunnel session count: 0
P2MP:
Recursive route: disabled
No rsvp tunneling: disabled
Timers:
Keepalive interval: 10, Keepalive timeout: 30
Link hello interval: 5, Link hello hold time: 15
Targeted hello interval: 15, Targeted hello hold time: 45
Label withdraw delay: 60, Make before break timeout: 30
Make before break switchover delay: 3
Link protection timeout: 120
Graceful restart:
Restart: disabled, Helper: enabled, Restart in process: false
Reconnect time: 60000, Max neighbor reconnect time: 120000
Recovery time: 160000, Max neighbor recovery time: 240000
Traffic Engineering:
Bgp igp: disabled
Both ribs: disabled
Mpls forwarding: disabled
IGP:
Tracking igp metric: enabled
Sync session up delay: 10
Session protection:
Session protection: disabled
Session protection timeout: 0
Interface addresses advertising:
17.0.0.1
17.8.1.1
17.8.2.1
128.49.237.153
LDP Job:
Read job time quantum: 1000, Write job time quantum: 1000
Read job loop quantum: 100, Write job loop quantum: 100
Backup inbound read job time quantum: 1000, Backup outbound read job time quantum: 1000
Backup inbound read job loop quantum: 100, Backup outbound read job loop quantum: 100
Label allocation:
Current number of LDP labels allocated: 4
Total number of LDP labels allocated: 7
Total number of LDP labels freed: 3
Total number of LDP label allocation failure: 0
Current number of labels allocated by all protocols: 4
### We can see that LDP is now using the IGP metri:
root@R1# run show route 17.0.0/24
inet.0: 32 destinations, 33 routes (32 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
17.0.0.1/32 *[Direct/0] 05:05:54
> via lo0.0
17.0.0.4/32 *[OSPF/10] 02:43:10, metric 1000
> to 17.8.2.2 via ge-0/0/3.0
17.0.0.5/32 *[OSPF/10] 02:41:13, metric 2000
> to 17.8.2.2 via ge-0/0/3.0
17.0.0.6/32 *[OSPF/10] 01:21:29, metric 2000
> to 17.8.1.2 via ge-0/0/2.0
17.0.0.9/32 *[OSPF/10] 01:21:29, metric 1000
> to 17.8.1.2 via ge-0/0/2.0
inet.3: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
17.0.0.4/32 *[LDP/9] 00:00:18, metric 1000
> to 17.8.2.2 via ge-0/0/3.0
17.0.0.5/32 *[LDP/9] 00:00:18, metric 2000
> to 17.8.2.2 via ge-0/0/3.0, Push 299856
17.0.0.6/32 *[LDP/9] 00:00:18, metric 2000
> to 17.8.1.2 via ge-0/0/2.0, Push 299904
17.0.0.9/32 *[LDP/9] 00:00:18, metric 1000
> to 17.8.1.2 via ge-0/0/2.0
### BGP is also now using that LDP metric for comparison and 17.0.0.9 is now preferred:
root@R1# run show route 3.3.3/24 extensive
inet.0: 32 destinations, 33 routes (32 active, 0 holddown, 0 hidden)
3.3.3.0/24 (2 entries, 1 announced)
TSI:
KRT in-kernel 3.3.3.0/24 -> {indirect(1048574)}
*BGP Preference: 170/-101
Next hop type: Indirect, Next hop index: 0
Address: 0x7bbeff4
Next-hop reference count: 2, key opaque handle: 0x0, non-key opaque handle: 0x0
Kernel Table Id: 0
Source: 17.0.0.9
Next hop type: Router, Next hop index: 647
Next hop: 17.8.1.2 via ge-0/0/2.0, selected
Label element ptr: 0x9f5e4d8
Label parent element ptr: 0x0
Label element references: 1
Label element child references: 0
Label element lsp id: 0
Session Id: 140
Protocol next hop: 17.0.0.9
Indirect next hop: 0x791dbb8 1048574 INH Session ID: 324
State: <Active Int Ext>
Local AS: 64512 Peer AS: 64512
Age: 36 Metric2: 1000
Validation State: unverified
Task: BGP_64512.17.0.0.9
Announcement bits (2): 0-KRT 6-Resolve tree 3
AS path: I
Accepted
Localpref: 100
Router ID: 17.0.0.9
Thread: junos-main
Indirect next hops: 1
Protocol next hop: 17.0.0.9 Metric: 1000 ResolvState: Resolved
Indirect next hop: 0x791dbb8 1048574 INH Session ID: 324
Indirect path forwarding next hops: 1
Next hop type: Router
Next hop: 17.8.1.2 via ge-0/0/2.0
Session Id: 140
17.0.0.9/32 Originating RIB: inet.3
Metric: 1000 Node path count: 1
Forwarding nexthops: 1
Next hop type: Router
Next hop: 17.8.1.2 via ge-0/0/2.0
Session Id: 140
BGP Preference: 170/-101
Next hop type: Indirect, Next hop index: 0
Address: 0x7bbf144
Next-hop reference count: 1, key opaque handle: 0x0, non-key opaque handle: 0x0
Kernel Table Id: 0
Source: 17.0.0.6
Next hop type: Router, Next hop index: 662
Next hop: 17.8.1.2 via ge-0/0/2.0, selected
Label operation: Push 299904
Label TTL action: prop-ttl
Load balance label: Label 299904: None;
Label element ptr: 0x9f5ec30
Label parent element ptr: 0x0
Label element references: 1
Label element child references: 0
Label element lsp id: 0
Session Id: 140
Protocol next hop: 17.0.0.6
Indirect next hop: 0x791dd50 1048575 INH Session ID: 323
State: <NotBest Int Ext>
Inactive reason: Not Best in its group - IGP metric
Local AS: 64512 Peer AS: 64512
Age: 36 Metric2: 2000
Validation State: unverified
Task: BGP_64512.17.0.0.6
AS path: I
Accepted
Localpref: 100
Router ID: 17.0.0.6
Thread: junos-main
Indirect next hops: 1
Protocol next hop: 17.0.0.6 Metric: 2000 ResolvState: Resolved
Indirect next hop: 0x791dd50 1048575 INH Session ID: 323
Indirect path forwarding next hops: 1
Next hop type: Router
Next hop: 17.8.1.2 via ge-0/0/2.0
Session Id: 140
17.0.0.6/32 Originating RIB: inet.3
Metric: 2000 Node path count: 1
Forwarding nexthops: 1
Next hop type: Router
Next hop: 17.8.1.2 via ge-0/0/2.0
Session Id: 140
Note: The track-igp-metric command has only local significance. It will not impact the metric on any other router.
External Resources: