网络拓扑:
XRV1
=======================================================================
hostname XRV1
explicit-path name SRTE
index 10 next-address strict ipv4 unicast 10.10.2.2
index 20 next-address strict ipv4 unicast 10.10.3.2
index 30 next-address strict ipv4 unicast 10.10.4.1
index 40 next-address strict ipv4 unicast 10.10.5.2
!
interface Loopback0
ipv4 address 192.168.1.1 255.255.255.255
!
interface tunnel-te16
ipv4 unnumbered Loopback0
autoroute announce
!
destination 192.168.1.5
path-option 1 explicit name SRTE segment-routing
!
interface MgmtEth0/0/CPU0/0
shutdown
!
interface GigabitEthernet0/0/0/0
ipv4 address 10.10.1.1 255.255.255.252
!
interface GigabitEthernet0/0/0/1
ipv4 address 10.10.2.1 255.255.255.252
!
interface GigabitEthernet0/0/0/2
shutdown
!
router ospf 100
router-id 192.168.1.1
segment-routing mpls
segment-routing forwarding mpls
area 0
mpls traffic-eng
interface Loopback0
passive enable
prefix-sid index 1
!
interface GigabitEthernet0/0/0/0
network point-to-point
!
interface GigabitEthernet0/0/0/1
network point-to-point
!
!
mpls traffic-eng router-id Loopback0
!
mpls traffic-eng
!
end
XRV2
=======================================================================
!
hostname XRV2
interface Loopback0
ipv4 address 192.168.1.2 255.255.255.255
!
interface MgmtEth0/0/CPU0/0
shutdown
!
interface GigabitEthernet0/0/0/0
ipv4 address 10.10.1.2 255.255.255.252
!
interface GigabitEthernet0/0/0/1
ipv4 address 10.10.5.1 255.255.255.252
!
interface GigabitEthernet0/0/0/2
ipv4 address 10.10.4.1 255.255.255.252
!
router ospf 100
router-id 192.168.1.2
segment-routing mpls
segment-routing forwarding mpls
area 0
mpls traffic-eng
interface Loopback0
passive enable
prefix-sid index 2
!
interface GigabitEthernet0/0/0/0
network point-to-point
!
interface GigabitEthernet0/0/0/1
network point-to-point
!
interface GigabitEthernet0/0/0/2
network point-to-point
!
!
mpls traffic-eng router-id Loopback0
!
mpls traffic-eng
!
segment-routing
!
end
XRV3
=======================================================================
hostname XRV3
interface Loopback0
ipv4 address 192.168.1.3 255.255.255.255
!
interface MgmtEth0/0/CPU0/0
shutdown
!
interface GigabitEthernet0/0/0/0
ipv4 address 10.10.3.1 255.255.255.252
!
interface GigabitEthernet0/0/0/1
ipv4 address 10.10.2.2 255.255.255.252
!
interface GigabitEthernet0/0/0/2
shutdown
!
router ospf 100
router-id 192.168.1.3
segment-routing mpls
segment-routing forwarding mpls
area 0
mpls traffic-eng
interface Loopback0
passive enable
prefix-sid index 3
!
interface GigabitEthernet0/0/0/0
network point-to-point
!
interface GigabitEthernet0/0/0/1
network point-to-point
!
!
mpls traffic-eng router-id Loopback0
!
mpls traffic-eng
!
segment-routing
!
end
XRV4
=======================================================================
hostname XRV4
interface Loopback0
ipv4 address 192.168.1.4 255.255.255.255
!
interface MgmtEth0/0/CPU0/0
shutdown
!
interface GigabitEthernet0/0/0/0
ipv4 address 10.10.4.2 255.255.255.252
!
interface GigabitEthernet0/0/0/1
ipv4 address 10.10.3.2 255.255.255.252
!
interface GigabitEthernet0/0/0/2
ipv4 address 10.10.6.1 255.255.255.252
!
router ospf 100
router-id 192.168.1.4
segment-routing mpls
segment-routing forwarding mpls
area 0
mpls traffic-eng
interface Loopback0
passive enable
prefix-sid index 4
!
interface GigabitEthernet0/0/0/0
network point-to-point
!
interface GigabitEthernet0/0/0/1
network point-to-point
!
interface GigabitEthernet0/0/0/2
network point-to-point
!
!
mpls traffic-eng router-id Loopback0
!
mpls traffic-eng
!
segment-routing
!
end
XRV5
=======================================================================
hostname XRV5
explicit-path name SRTE
index 10 next-address strict ipv4 unicast 10.10.5.1
index 20 next-address strict ipv4 unicast 10.10.4.2
index 30 next-address strict ipv4 unicast 10.10.3.1
index 40 next-address strict ipv4 unicast 10.10.2.1
!
interface Loopback0
ipv4 address 192.168.1.5 255.255.255.255
!
interface tunnel-te16
ipv4 unnumbered Loopback0
autoroute announce
!
destination 192.168.1.1
path-option 1 explicit name SRTE segment-routing
!
interface MgmtEth0/0/CPU0/0
shutdown
!
interface GigabitEthernet0/0/0/0
shutdown
!
interface GigabitEthernet0/0/0/1
ipv4 address 10.10.5.2 255.255.255.252
!
interface GigabitEthernet0/0/0/2
ipv4 address 10.10.6.2 255.255.255.252
!
router ospf 100
router-id 192.168.1.5
segment-routing mpls
segment-routing forwarding mpls
area 0
mpls traffic-eng
interface Loopback0
passive enable
prefix-sid index 5
!
interface GigabitEthernet0/0/0/1
network point-to-point
!
interface GigabitEthernet0/0/0/2
network point-to-point
!
!
mpls traffic-eng router-id Loopback0
!
mpls traffic-eng
!
segment-routing
!
end
做TE要求如下:
XRV1-----> XRV5
10.10.2.2 -> 10.10.3.2 ->10.10.4.1 ->10.10.5.2
XRV5----->XRV1
10.10.5.1 ->10.10.4.2 ->10.10.3.1 ->10.10.2.1
测试如下:
XRV1-----> XRV5
RP/0/0/CPU0:XRV1#traceroute 192.168.1.5
Mon Jul 22 07:43:31.705 UTC
Type escape sequence to abort.
Tracing the route to 192.168.1.5
1 10.10.2.2 [MPLS: Labels 24001/24001/24003 Exp 0] 19 msec 9 msec 9 msec
2 10.10.3.2 [MPLS: Labels 24001/24003 Exp 0] 19 msec 29 msec 19 msec
3 10.10.4.1 [MPLS: Label 24003 Exp 0] 29 msec 29 msec 29 msec
4 10.10.5.2 19 msec * 19 msec
XRV5----->XRV1
RP/0/0/CPU0:XRV5#traceroute 192.168.1.1
Mon Jul 22 07:44:16.853 UTC
Type escape sequence to abort.
Tracing the route to 192.168.1.1
1 10.10.5.1 [MPLS: Labels 24005/24003/24003 Exp 0] 9 msec 9 msec 9 msec
2 10.10.4.2 [MPLS: Labels 24003/24003 Exp 0] 9 msec 9 msec 9 msec
3 10.10.3.1 [MPLS: Label 24003 Exp 0] 9 msec 9 msec 9 msec
4 10.10.2.1 9 msec * 19 msec