1. 配置IP地址
[PE1-GigabitEthernet0/0/0]ip add 10.1.1.1 24
[PE1-GigabitEthernet0/0/1]ip add 10.1.3.1 24
[PE1-LoopBack0]ip add 1.1.1.1 32
[PE2-GigabitEthernet0/0/0]ip add 10.1.2.2 24
[PE2-GigabitEthernet0/0/1]ip add 10.1.4.2 24
[PE2-LoopBack0]ip add 2.2.2.2 32
[P1-GigabitEthernet0/0/0]ip add 10.1.1.3 24
[P1-GigabitEthernet0/0/1]ip add 10.1.2.3 24
[P1-LoopBack0]ip add 3.3.3.3 32
[P2-GigabitEthernet0/0/0]ip add 10.1.3.4 24
[P2-GigabitEthernet0/0/1]ip add 10.1.4.4 24
[P2-LoopBack0]ip add 4.4.4.4 32
2. 配置OSPF协议发布各节点接口所连网段和LSR ID的主机路由
[PE1]ospf 1
[PE1-ospf-1]area 0
[PE1-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[PE1-ospf-1-area-0.0.0.0]network 10.1.3.0 0.0.0.255
[PE1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[PE2]ospf 1
[PE2-ospf-1]area 0
[PE2-ospf-1-area-0.0.0.0]network 10.1.2.0 0.0.0.255
[PE2-ospf-1-area-0.0.0.0]network 10.1.4.0 0.0.0.255
[PE2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[P1]ospf 1
[P1-ospf-1]area 0
[P1-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[P1-ospf-1-area-0.0.0.0]network 10.1.2.0 0.0.0.255
[P1-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[P2]ospf 1
[P2-ospf-1]area 0
[P2-ospf-1-area-0.0.0.0]network 10.1.3.0 0.0.0.255
[P2-ospf-1-area-0.0.0.0]network 10.1.4.0 0.0.0.255
[P2-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
3. 配置PE1的接口g0/0/1的cost值为1000
[PE1-GigabitEthernet0/0/1]ospf cost 1000
4. 配置本地LDP会话
[PE1]mpls lsr-id 1.1.1.1
[PE1]mpls
[PE1]mpls ldp
[PE1-GigabitEthernet0/0/0]mpls
[PE1-GigabitEthernet0/0/0]mpls ldp
[PE1-GigabitEthernet0/0/1]mpls
[PE1-GigabitEthernet0/0/1]mpls ldp
[PE2]mpls lsr-id 2.2.2.2
[PE2]mpls
[PE2]mpls ldp
[PE2-GigabitEthernet0/0/0]mpls
[PE2-GigabitEthernet0/0/0]mpls ldp
[PE2-GigabitEthernet0/0/1]mpls
[PE2-GigabitEthernet0/0/1]mpls ldp
[P1]mpls lsr-id 3.3.3.3
[P1]mpls
[P1]mpls ldp
[P1-GigabitEthernet0/0/0]mpls
[P1-GigabitEthernet0/0/0]mpls ldp
[P1-GigabitEthernet0/0/1]mpls
[P1-GigabitEthernet0/0/1]mpls ldp
[P2]mpls lsr-id 4.4.4.4
[P2]mpls
[P2]mpls ldp
[P2-GigabitEthernet0/0/0]mpls
[P2-GigabitEthernet0/0/0]mpls ldp
[P2-GigabitEthernet0/0/1]mpls
[P2-GigabitEthernet0/0/1]mpls ldp
5. 在被检测链路两端节点上使能全局BFD能力
[PE1]bfd
[PE2]bfd
6. 在PE1上配置绑定到LDP LSP的BFD会话,发送报文的时间间隔是100毫秒,接收报文的时间间隔是100毫秒,并且能够修改端口状态表
[PE1]bfd pe1tope2 bind ldp-lsp peer-ip 2.2.2.2 nexthop 10.1.1.3 interface g0/0/0
[PE1-bfd-lsp-session-pe1tope2]discriminator local 1
[PE1-bfd-lsp-session-pe1tope2]discriminator remote 2
[PE1-bfd-lsp-session-pe1tope2]min-rx-interval 100
[PE1-bfd-lsp-session-pe1tope2]min-tx-interval 100
[PE1-bfd-lsp-session-pe1tope2]process-pst
[PE1-bfd-lsp-session-pe1tope2]commit
7. 在PE2上配置绑定到IP链路的BFD会话,用来将LDP LSP的故障通告给PE1
[PE2]bfd pe2tope1 bind peer-ip 1.1.1.1
[PE2-bfd-session-pe2tope1]discriminator local 2
[PE2-bfd-session-pe2tope1]discriminator remote 1
[PE2-bfd-session-pe2tope1]min-rx-interval 100
[PE2-bfd-session-pe2tope1]min-tx-interval 100
[PE2-bfd-session-pe2tope1]commit
8. 检测配置