场景分析:
R1.R2.R3 分别开启OSPF协议,他们之间路由表是同步的。由于R4没有开启OSPF协议且只有到R3的静态路由(R4假如没有到R1.R2的IGP路由的时候,那么ldp database里面将不会有到R1和R2标签)
R3通过策略将到4.4.4.4的静态路由发布到OSPF协议里面去
只考虑R4--->R3---->r1----->r2方向 反过来道理也一个样
LDP依靠IGP协议的最短路径机制

下面的输出只侧重于R2(路由表同步的情况下)
R2路由表:

run show route logical-system r2   
inet.3: 3 destinations, 3 routes (3 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

1.1.1.1/32         *[LDP/9] 00:40:01, metric 1 因为和R1是直连收到的label是0所以不做标签的处理
                    > to 10.0.4.5 via em1.33
3.3.3.3/32         *[LDP/9] 00:40:01, metric 1
                    > to 10.0.4.5 via em1.33, Push 299824   299824实际上是收到的label
4.4.4.4/32         *[LDP/9] 00:40:01, metric 1
                    > to 10.0.4.5 via em1.33, Push 299840  299840实际上是收到的label

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

299824             *[LDP/9] 00:40:01, metric 1   收到的标签
                    > to 10.0.4.5 via em1.33, Pop     
299824(S=0)        *[LDP/9] 00:40:01, metric 1
                    > to 10.0.4.5 via em1.33, Pop     
299840             *[LDP/9] 00:40:01, metric 1   当有label=299840的将它SWAP成299824 通过em1.33送出去
                    > to 10.0.4.5 via em1.33, Swap 299824 ----R2自己产生的标签
299856             *[LDP/9] 00:40:01, metric 1   当有label=299856的将它SWAP成299840 通过em1.33送出去
                    > to 10.0.4.5 via em1.33, Swap 299840  ----R2自己产生的标签


root# run show ldp database extensive logical-system r2  对应于 route table inet.3:  用于R2自己始发的情况(R2到R3.R4.R1封装的标签)
Input label database, 2.2.2.2:0--1.1.1.1:0
  Label     Prefix
      3     1.1.1.1/32
            State: Active
            Age: 40:59
 299856     2.2.2.2/32   
            State: Active
            Age: 40:59
 299824     3.3.3.3/32 
            State: Active
            Age: 40:59
 299840     4.4.4.4/32 
            State: Active
            Age: 40:59

Output label database, 2.2.2.2:0--1.1.1.1:0 对应于route table mpls.0 用于入站mpls label的解析(当R2作为ingress路由器的时候告诉其他peer如何通过自己到达R3&R4)
  Label     Prefix
 299824    1.1.1.1/32
            State: Active
            Age: 40:59
      3     2.2.2.2/32
            State: Active
            Age: 40:59
 299840     3.3.3.3/32  R2向其他的ldp peer通告               
            State: Active
            Age: 40:59
 299856     4.4.4.4/32  R2向其他的ldp peer通告               
            State: Active
            Age: 40:59