[R1]int e0/0/0
[R1-Ethernet0/0/0]ip add 10.0.12.1 24
[R1]int loo0
[R1-LoopBack0]ip add 1.1.1.1 32
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]net 1.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]net 10.0.12.0 0.0.0.255
[R1]mpls lsr-id 1.1.1.1
[R1]mpls
[R1]mpls ldp
[R1-mpls]int e0/0/0
[R1-Ethernet0/0/0]mpls
[R1-Ethernet0/0/0]mpls ldp
[R2]int E0/0/0
[R2-Ethernet0/0/0]ip add 10.0.12.2 24
[R2-Ethernet0/0/0]int e0/0/1
[R2-Ethernet0/0/1]ip add 10.0.23.2 24
[R2-Ethernet0/0/0]int loo0
[R2-LoopBack0]ip add 2.2.2.2 32
[R2-LoopBack0]q
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]net 10.0.12.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]net 10.0.23.0 0.0.0.255
[R2]mpls lsr-id 2.2.2.2
[R2]mpls
[R2]mpls ldp
[R2-mpls]int e0/0/0
[R2-Ethernet0/0/0]mpls
[R2-Ethernet0/0/0]mpls ldp
[R2-Ethernet0/0/0]int e0/0/1
[R2-Ethernet0/0/1]mpls
[R2-Ethernet0/0/1]mpls ldp
R3,R4,R5都这么设置就行
验证命令
dis mpls lsp session
出现上面那些即正确