Preface; In the below topology R1 and R6 are PEs, all others are P routers, all routers are running c7200-jk9s-mz.124-13b.bin. At this point IGP is fully converged (OSPF with all interfaces in area 0 for simplicity) and MPLS is enabled on all interfaces using LDP. No BGP configuration exists at this point.
Here is the MPLS forwarding table on R1;
R1#show mpls forwarding-table Local Outgoing Prefix Bytes tag Outgoing Next Hop tag tag or VC or Tunnel Id switched interface 16 Pop tag 10.0.0.2/32 0 Fa0/0 10.0.12.2 17 Pop tag 10.0.0.3/32 0 Fa0/1 10.0.13.3 18 Pop tag 10.0.24.0/24 0 Fa0/0 10.0.12.2 19 Pop tag 10.0.35.0/24 0 Fa0/1 10.0.13.3 20 20 10.0.57.0/24 0 Fa0/1 10.0.13.3 21 20 10.0.46.0/24 0 Fa0/0 10.0.12.2 22 21 10.0.76.0/24 0 Fa0/1 10.0.13.3 21 10.0.76.0/24 0 Fa0/0 10.0.12.2 23 23 10.0.0.4/32 0 Fa0/0 10.0.12.2 24 24 10.0.0.5/32 0 Fa0/1 10.0.13.3 25 25 10.0.0.6/32 0 Fa0/0 10.0.12.2 26 26 10.0.0.7/32 0 Fa0/1 10.0.13.3
If my understanding is correct, R1 has generated labels for each FEC and R2 and R3 send R1 their LDP bindings (each MPLS label) for every MPLS FEC they have. Using this information R1 (for example) performs a lookup for traffic towards 10.0.0.6 and PUSHes the outgoing tag 25 before sending the the MPLS tagged packet towards 10.0.12.2 (R2).
A few questions arise here for me;
After the initial convergence of the network, LSPs now exist between all FECs which are typically interfaces on LERs that connect to a subnet. R1 is a LER for an LSP towards R6 which is the other LER in that LSP. If R7 were also a PE router for example an LSP would exist between each R1 interface and each R7 interface and so more LSPs would exist then with R1 and R7 being the two LERs for those LSPs. Is that all correct?
Assuming that baseline is correct; How does R1 know it is an LER for an LSP that spans to R6 for example (and all other possible LSPs that exist in this topology where R1 is one end device of the LSP such as if we introduced R7 as a PE as before?). Is this because the IGP (OSPF in this case) has full visibility of the network so it (all the edges) can be calculated from the IGP database?
If 2 is correct, how did we get to that stage? Once the network is fully converged with IGP and LDP exchanges are completed, does a PE router then look through the FIB (or is it IGP RIB?) and work out all possible LDPs and which ones it would be an LER for, and who/what is the LER for the other end?