1. 配置IP地址
[LSR1-GigabitEthernet0/0/0]ip add 172.1.1.1 24
[LSR1-GigabitEthernet0/0/1]ip add 172.3.1.1 24
[LSR1-GigabitEthernet0/0/2]ip add 172.5.1.1 24
[LSR1-LoopBack0]ip add 1.1.1.1 32
[LSR2-GigabitEthernet0/0/0]ip add 172.1.1.2 24
[LSR2-GigabitEthernet0/0/1]ip add 172.2.1.2 24
[LSR2-LoopBack0]ip add 2.2.2.2 32
[LSR3-GigabitEthernet0/0/0]ip add 172.2.1.3 24
[LSR3-GigabitEthernet0/0/1]ip add 172.4.1.3 24
[LSR3-LoopBack0]ip add 3.3.3.3 32
[LSR4-GigabitEthernet0/0/0]ip add 172.4.1.4 24
[LSR4-GigabitEthernet0/0/1]ip add 172.3.1.4 24
[LSR4-GigabitEthernet0/0/2]ip add 172.6.1.4 24
[LSR4-LoopBack0]ip add 4.4.4.4 32
[LSR5-GigabitEthernet0/0/0]ip add 172.6.1.5 24
[LSR5-GigabitEthernet0/0/1]ip add 172.5.1.5 24
[LSR5-LoopBack0]ip add 5.5.5.5 32
2. 配置OSPF以及链路的OSPF cost值
[LSR1]ospf 1
[LSR1-ospf-1]area 0
[LSR1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[LSR1-ospf-1-area-0.0.0.0]network 172.1.1.0 0.0.0.255
[LSR1-ospf-1-area-0.0.0.0]network 172.3.1.0 0.0.0.255
[LSR1-ospf-1-area-0.0.0.0]network 172.5.1.0 0.0.0.255
[LSR1-GigabitEthernet0/0/0]ospf cost 15
[LSR1-GigabitEthernet0/0/1]ospf cost 10
[LSR1-GigabitEthernet0/0/2]ospf cost 10
[LSR2]ospf 1
[LSR2-ospf-1]area 0
[LSR2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[LSR2-ospf-1-area-0.0.0.0]network 172.1.1.0 0.0.0.255
[LSR2-ospf-1-area-0.0.0.0]network 172.2.1.0 0.0.0.255
[LSR2-GigabitEthernet0/0/0]ospf cost 15
[LSR2-GigabitEthernet0/0/1]ospf cost 10
[LSR3]ospf 1
[LSR3-ospf-1]area 0
[LSR3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[LSR3-ospf-1-area-0.0.0.0]network 172.2.1.0 0.0.0.255
[LSR3-ospf-1-area-0.0.0.0]network 172.4.1.0 0.0.0.255
[LSR3-GigabitEthernet0/0/0]ospf cost 10
[LSR3-GigabitEthernet0/0/1]ospf cost 10
[LSR4]ospf 1
[LSR4-ospf-1]area 0
[LSR4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[LSR4-ospf-1-area-0.0.0.0]network 172.4.1.0 0.0.0.255
[LSR4-ospf-1-area-0.0.0.0]network 172.3.1.0 0.0.0.255
[LSR4-ospf-1-area-0.0.0.0]network 172.6.1.0 0.0.0.255
[LSR4-GigabitEthernet0/0/0]ospf cost 10
[LSR4-GigabitEthernet0/0/1]ospf cost 10
[LSR4-GigabitEthernet0/0/2]ospf cost 10
[LSR5]ospf 1
[LSR5-ospf-1]area 0
[LSR5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[LSR5-ospf-1-area-0.0.0.0]network 172.5.1.0 0.0.0.255
[LSR5-ospf-1-area-0.0.0.0]network 172.6.1.0 0.0.0.255
[LSR5-GigabitEthernet0/0/0]ospf cost 10
[LSR5-GigabitEthernet0/0/1]ospf cost 10
3. 配置MPLS基本能力,使能MPLS TE、RSVP-TE和CSPF,需在主隧道的入节点上使能CSPF
[LSR1]mpls lsr-id 1.1.1.1
[LSR1]mpls
[LSR1-mpls]mpls te
[LSR1-mpls]mpls rsvp-te
[LSR1-mpls]mpls te cspf
[LSR1-GigabitEthernet0/0/0]mpls
[LSR1-GigabitEthernet0/0/0]mpls te
[LSR1-GigabitEthernet0/0/0]mpls rsvp-te
[LSR2]mpls lsr-id 2.2.2.2
[LSR2]mpls
[LSR2-mpls]mpls te
[LSR2-mpls]mpls rsvp-te
[LSR2-GigabitEthernet0/0/0]mpls
[LSR2-GigabitEthernet0/0/0]mpls te
[LSR2-GigabitEthernet0/0/0]mpls rsvp-te
[LSR2-GigabitEthernet0/0/1]mpls
[LSR2-GigabitEthernet0/0/1]mpls te
[LSR2-GigabitEthernet0/0/1]mpls rsvp-te
[LSR3]mpls lsr-id 3.3.3.3
[LSR3]mpls
[LSR3-mpls]mpls te
[LSR3-mpls]mpls rsvp-te
[LSR3-mpls]mpls te cspf
[LSR3-GigabitEthernet0/0/0]mpls
[LSR3-GigabitEthernet0/0/0]mpls te
[LSR3-GigabitEthernet0/0/0]mpls rsvp-te
4. 配置OSPF TE
[LSR1]ospf
[LSR1-ospf-1]opaque-capability enable
[LSR1-ospf-1]area 0
[LSR1-ospf-1-area-0.0.0.0]mpls-te enable
[LSR2]ospf
[LSR2-ospf-1]opaque-capability enable
[LSR2-ospf-1]area 0
[LSR2-ospf-1-area-0.0.0.0]mpls-te enable
[LSR3]ospf
[LSR3-ospf-1]opaque-capability enable
[LSR3-ospf-1]area 0
[LSR3-ospf-1-area-0.0.0.0]mpls-te enable
5. 创建MPLS TE隧道
[LSR1]explicit-path pp1
[LSR1-explicit-path-pp1]next hop 172.1.1.2
[LSR1-explicit-path-pp1]next hop 172.2.1.3
[LSR1-explicit-path-pp1]next hop 3.3.3.3
[LSR1]int Tunnel 0/0/1
[LSR1-Tunnel0/0/1]ip add unnumbered interface LoopBack 0
[LSR1-Tunnel0/0/1]tunnel-protocol mpls te
[LSR1-Tunnel0/0/1]destination 3.3.3.3
[LSR1-Tunnel0/0/1]mpls te tunnel-id 13
[LSR1-Tunnel0/0/1]mpls te path explicit-path pp1
[LSR1-Tunnel0/0/1]mpls te commit
[LSR3]explicit-path pp1
[LSR3-explicit-path-pp1]next hop 172.2.1.2
[LSR3-explicit-path-pp1]next hop 172.1.1.1
[LSR3-explicit-path-pp1]next hop 1.1.1.1
[LSR3]int Tunnel 0/0/1
[LSR3-Tunnel0/0/1]ip add unnumbered interface LoopBack 0
[LSR3-Tunnel0/0/1]tunnel-protocol mpls te
[LSR3-Tunnel0/0/1]destination 1.1.1.1
[LSR3-Tunnel0/0/1]mpls te tunnel-id 31
[LSR3-Tunnel0/0/1]mpls te path explicit-path pp1
[LSR3-Tunnel0/0/1]mpls te commit
6. 配置转发邻接:在TE隧道接口下使能转发邻接,配置IGP度量值为10(绝对度量)
[LSR1]int Tunnel 0/0/1
[LSR1-Tunnel0/0/1]mpls te igp advertise
[LSR1-Tunnel0/0/1]mpls te igp metric absolute 10
[LSR1-Tunnel0/0/1]mpls te commit
[LSR1]ospf 1
[LSR1-ospf-1]enable traffic-adjustment advertise
[LSR3]int Tunnel 0/0/1
[LSR3-Tunnel0/0/1]mpls te igp advertise
[LSR3-Tunnel0/0/1]mpls te igp metric absolute 10
[LSR3-Tunnel0/0/1]mpls te commit
[LSR3]ospf 1
[LSR3-ospf-1]enable traffic-adjustment advertise
7. 检查配置