使用SR替代LDP,配置ospf sham-link
发布时间:2023-05-14 16:19:28
首先,我们需要先回顾一下SR和LDP的区别。
SR(Segment Routing)是一种新型的路由协议,它将路径信息编码在数据包首部的标签中,在传输过程中通过标签来指示转发路径,从而实现网络流量的高效转发和优化控制。
LDP(Label Distribution Protocol)则是传统的标签分发协议,它实现了标签的分发和交换,但是对于网络路径的选择和控制相对较弱。
因此,使用SR替代LDP,可以有效地提升网络的性能和可控性。
接下来,我们将介绍如何配置OSPF sham-link来使用SR替代LDP。
1. 首先,我们需要在两个PE设备上启用SR和OSPF协议,并配置SRTE:
PE1(config)# router ospf 1
PE1(config-router)# segment-routing mpls
PE1(config-router)# segment-routing traffic-eng
PE1(config-router)# segment-routing sr-preferrer 1 path-metric
PE1(config-router)# max-metric router-lsa on-startup 3600
PE1(config-router)# interface GigabitEthernet0/1
PE1(config-if)# ip ospf 1 area 0
PE1(config-if)# segment-routing traffic-eng adjacency-color inner
PE1(config-if)# exit
PE2(config)# router ospf 1
PE2(config-router)# segment-routing mpls
PE2(config-router)# segment-routing traffic-eng
PE2(config-router)# segment-routing sr-preference 1 path-metric
PE2(config-router)# max-metric router-lsa on-startup 3600
PE2(config-router)# interface GigabitEthernet0/1
PE2(config-if)# ip ospf 1 area 0
PE2(config-if)# segment-routing traffic-eng adjacency-color inner
PE2(config-if)# exit
PE1(config)# router ospf 1
PE1(config-router)# mpls traffic-eng router-id loopback0
PE1(config-router)# mpls traffic-eng area 0
PE1(config-router)# mpls traffic-eng backup-path source
address x.x.x.x
PE1(config-router)# exit
PE2(config)# router ospf 1
PE2(config-router)# mpls traffic-eng router-id loopback0
PE2(config-router)# mpls traffic-eng area 0
PE2(config-router)# mpls traffic-eng backup-path source
address x.x.x.x
PE2(config-router)# exit
2. 然后,我们需要配置OSPF sham-link。首先,在PE1上配置:
PE1(config)# interface loopback 0 PE1(config-if)# ip address x.x.x.x 255.255.255.255 PE1(config-if)# exit PE1(config)# interface GigabitEthernet0/1 PE1(config-if)# ip address 10.1.1.1 255.255.255.0 PE1(config-if)# ip ospf 1 area 0 PE1(config-if)# exit PE1(config)# interface GigabitEthernet1/1 PE1(config-if)# ip address 192.168.1.1 255.255.255.0 PE1(config-if)# ip ospf 1 area 0 PE1(config-if)# exit PE1(config)# router ospf 1 PE1(config-router)# sham-link 10.1.1.2 10.2.2.2 PE1(config-router)# exit
3. 接着,在PE2上配置:
PE2(config)# interface loopback 0 PE2(config-if)# ip address x.x.x.x 255.255.255.255 PE2(config-if)# exit PE2(config)# interface GigabitEthernet0/1 PE2(config-if)# ip address 10.1.1.2 255.255.255.0 PE2(config-if)# ip ospf 1 area 0 PE2(config-if)# exit PE2(config)# interface GigabitEthernet1/1 PE2(config-if)# ip address 192.168.2.1 255.255.255.0 PE2(config-if)# ip ospf 1 area 0 PE2(config-if)# exit PE2(config)# router ospf 1 PE2(config-router)# sham-link 10.1.1.1 10.2.2.1 PE2(config-router)# exit
4. 最后,我们需要在SRTE策略中指定转发路径:
PE1(config)# router ospf 1 PE1(config-router)# segment-routing traffic-eng PE1(config-router)# auto-add-color PE1(config-router)# exit PE1(config)# ipv4 prefix-list p1 permit x.x.x.x/32 PE1(config)# route-map r1 permit 10 PE1(config-route-map)# match ip address prefix-list p1 PE1(config-route-map)# set add-path 1 segment-list sl1 PE1(config-route-map)# exit PE1(config)# segment-list sl1 PE1(config-sl)# index 1 mpls label 16000 PE1(config-sl)# index 2 mpls label explicit-null PE1(config-sl)# exit
至此,我们就成功地使用SR替代了LDP,并配置了OSPF sham-link。通过SRTE策略的指定,我们可以更灵活地控制数据包的传输路径,从而实现更高效的网络流量控制。
