欢迎光临
我们一直在努力

实验:Segment Routing L3VPNv4 SR-MPLS BE

一、Segment Routing MPLS 基本原理

        1、概述

                Segment Routing,段路由SR

                基于源路由理念而设计的在网络上转发数据包的一种协议

                Segment Routing MPLS指基于MPLS转发平面的Segment Routing。Segment Routing将网络路径分成一个个段,并且为这些段和网络中的转发节点分配段标识ID。通过对段和网络节点进行有序排列(Segment List),得到一条转发路径

        2、基础概念

                SR域:Segment Routing Domain,SR节点的集合

                SID:Segment ID,用来标识唯一的段。在转发层面可映射为MPLS标签

                SRGB:Segment Routing Global Block,用户指定的为Segment Routing MPLS预留的全局标签集合

                SRLB:Segment Routing Local Block,用户指定的为Segment Routing MPLS预留的本地标签集合,本地配置 ,仅在本地有效,全局可见

        3、Segment分类

                (1)Prefix Segment:

                        前缀段,用于标识网络中的某个目的地址前缀

                        通过IGP扩散到其他网元,全局可见,全局有效

                        通过Prefix SID标识

                        手工配置

                        Prefix SID的生成过程:

                                源端在SRGB范围内配置一个Prefix SID绝对值或偏移值(SID Index)

                                设备通过IGP对外发布Prefix SID偏移值,如果配置绝对值,需减去本机SRGB起始值转换为偏移值

                                本机收到Prefix SID偏移值后,生成MPLS转发表项

                                        本机实际入标签值根据本机的SRGB和Prefix SID偏移值计算生成

                                        本机实际出标签值根据下一跳邻居发布的SRGB和Prefix SID偏移值计算生成

                (2)Adjacency Segment

                        邻接段,用于标识网络中的某个邻接

                        通过IGP扩散,全局可见,本地有效

                        通过Adjacency SID标识

                        可静态配置,也可由IS-IS或OSPF动态生成

                (3)Node Segment

                        节点段,是特殊的Prefix Segment,用于标识特定的节点

                        通过Node SID标识

                        在节点的Loopback接口下配置IP地址作为前缀,这个节点的Prefix SID实际就是Node SID

                (4)三种类型的使用

                        基于Prefix SID的转发路径

                                由IGP通过最短路径算法计算得出

                                不是一条固定路径,头节点也无法控制报文的整条转发路径

                                如果网络中存在等价路径,则可实现负载分担,如果存在不等价路径,则可形成链路备份

                        

                        基于Adjacency SID的转发路径

                                通过给网络中每个邻接分配一个Adjacency SID,然后在头节点上定义一个包含多个Adjacency SID的Segment List,可严格指定任意一条显式路径

                                Adjacency SID对应的是设备的一个接口,当Adjacency SID对应的邻接发生故障时,只能依赖端到端保护。支持Adjacency SID的本地保护后,该Adjacency SID携带保护标记,控制器算路时可选择携带保护标记的Adjacency ISD,并为具有保护资格的Adjacency SID计算一条备份路径,当该Adjacency SID对应的邻接故障时,可快速切换到备份路径

                        基于Adjacency SID + Node SID的转发路径

                                将Adjacency SID和Node SID结合,通过Adjacency SID强制整条路径包含某一个邻接。

                                对于Node SID,节点可使用SPF计算最短路径,也可负载分担

                                这种方式的路径并不是严格固定的,也称为松散路径

        4、Segment Routing转发机制

                Segment Routing可直接应用在MPLS架构,转发机制没有变化。代表段的SID被编码为MPLS标签。段序列被编码为标签栈。要处理的段位于栈顶。一个段处理完成后,相关标签从标签栈中弹出

                基于MPLS转发机制的SR也称为SR-MPLS

        5、Segment Routing标签冲突处理原则

                由于Prefix SID通过手工配置,不同设备上的配置可能发生标签冲突

                标签冲突分类:

                        前缀冲突:指相同的前缀关联了两个不同的SID

                        SID冲突:指相同的SID关联到不同的前缀

                处理原则:

                        当冲突产生后,优先处理前缀冲突,之后根据处理结果再进行SID冲突处理

                        相同前缀情况下,SID更小者优选

                        相同SID情况下,如果是不同前缀则前缀更小者优选;如果是相同前缀则掩码更大者优选

二、SR-MPLS BE

       SR-MPLS BE (Segment Routing-MPLS Best Effort)

                指使用SID来指导设备基于最短路径进行数据转发

                SR LSP是指使用Segment Routing技术建立的标签转发路径,由一个Prefix SID或Node SID指导数据包转发。不存在Tunnel接口。

                SR LSP基于前缀标签创建。目的节点通过IGP发布Prefix SID,转发器解析Prefix SID,并根据自己的SRGB计算标签值。此后各节点使用IGP收集的拓扑信息,根据最短路径算法计算标签转发路径,并将计算的下一跳及出标签信息下发转发表,指导数据报文转发。

三、实验

        1、实验拓扑

        

        2、规划

                接口互联地址:10.0.0.X/30

                Loopback 0 接口地址:

                        PE1:10.0.1.1/32

                        PE2:10.0.2.2/32

                        PE3:10.0.3.3/32

                        PE4:10.0.4.4/32

                        P1:10.0.5.5/32

                        P2:10.0.6.6/32

                Loopback 1 接口地址:

                        PE1:10.1.1.1/32

                        PE4:10.1.4.4/32

                

                BGP Number:65100

                SR全局标签范围:16000 ~ 17000

        3、目标

                实现通过IS-IS完成PE之间的路由可达

                实现通过配置SR-MPLS建立SR LSP

                实现CE之间互访使用的L3VPN隧道迭代到SR-MPLS BE隧道

        4、配置思路

                a、设备基础IP地址配置(略)

                b、配置SR域内的IS-IS,在互联接口、Loopback 0 接口上开启IS-IS,实现SR域内互通

                c、配置MPLS,使能设备MPLS功能,配置MPLS LSR ID

                d、完成SR配置,全局使能SR,在IS-IS中开启对SR的扩展能力,并配置Node SID

                e、配置PE1、PE4与P1、P2之间的MP-IBGP对等体关系,P1、P2为RR

                f、在PE1、PE4上创建vpn-instance vpna,并绑定Loopback 1接口,在BGP中引入路由

        5、配置步骤

                (1)IS-IS路由协议配置

# PE1的IS-IS配置
[~PE1]isis 1
[*PE1-isis-1]is-level level-2
[*PE1-isis-1]cost-style wide
[*PE1-isis-1]network-entity 49.0001.0001.0001.0001.00
[*PE1-isis-1]is-na
[*PE1-isis-1]is-name PE1
[*PE1-isis-1]int lo0
[*PE1-LoopBack0]isis en 1
[*PE1-LoopBack0]int ether1/0/1
[*PE1-Ethernet1/0/1]isis en 1
[*PE1-Ethernet1/0/1]isis circuit-type p2p
[*PE1-Ethernet1/0/1]int ether1/0/0
[*PE1-Ethernet1/0/0]isis en 1
[*PE1-Ethernet1/0/0]isis circuit-type p2p
[*PE1-Ethernet1/0/0]commit

# PE2的IS-IS配置
[~PE2]isis 1
[*PE2-isis-1]is-level level-2
[*PE2-isis-1]cost-style wide
[*PE2-isis-1]network-entity 49.0001.0002.0002.0002.00
[*PE2-isis-1]is-name PE2
[*PE2-isis-1]int lo0
[*PE2-LoopBack0]isis en 1
[*PE2-LoopBack0]int ether1/0/0
[*PE2-Ethernet1/0/0]isis en 1
[*PE2-Ethernet1/0/0]isis circuit-type p2p
[*PE2-Ethernet1/0/0]int ether1/0/1
[*PE2-Ethernet1/0/1]isis en 1
[*PE2-Ethernet1/0/1]isis circuit-type p2p
[*PE2-Ethernet1/0/1]commit

# P1的IS-IS配置
[~P1]isis 1
[*P1-isis-1]is-level level-2
[*P1-isis-1]cost-style wide
[*P1-isis-1]network-entity 49.0001.0005.0005.0005.00
[*P1-isis-1]is-name P1
[*P1-isis-1]int lo0
[*P1-LoopBack0]isis en 1
[*P1-LoopBack0]int ether1/0/0
[*P1-Ethernet1/0/0]isis en 1
[*P1-Ethernet1/0/0]isis circuit-type p2p
[*P1-Ethernet1/0/0]int ether1/0/1
[*P1-Ethernet1/0/1]isis enable 1
[*P1-Ethernet1/0/1]isis circuit-type p2p
[*P1-Ethernet1/0/1]int ether1/0/2
[*P1-Ethernet1/0/2]isis en 1
[*P1-Ethernet1/0/2]isis circuit-type p2p
[*P1-Ethernet1/0/2]commit

# P2的IS-IS配置
[~HUAWEI]sysname P2
[*HUAWEI]isis 1
[*HUAWEI-isis-1]is-level level-2
[*HUAWEI-isis-1]cost-style wide
[*HUAWEI-isis-1]network-entity 49.0001.0006.0006.0006.00
[*HUAWEI-isis-1]is-na
[*HUAWEI-isis-1]is-name P2
[*HUAWEI-isis-1]int lo0
[*HUAWEI-LoopBack0]isis en 1
[*HUAWEI-LoopBack0]int ether1/0/0
[*HUAWEI-Ethernet1/0/0]isis en 1
[*HUAWEI-Ethernet1/0/0]isis circuit-type p2p
[*HUAWEI-Ethernet1/0/0]int ether1/0/1
[*HUAWEI-Ethernet1/0/1]isis en 1
[*HUAWEI-Ethernet1/0/1]isis circuit-type p2p
[*HUAWEI-Ethernet1/0/1]int ether1/0/2
[*HUAWEI-Ethernet1/0/2]isis en 1
[*HUAWEI-Ethernet1/0/2]isis circuit-type p2p
[*HUAWEI-Ethernet1/0/2]commit

# PE3的IS-IS配置
[~PE3]isis 1
[*PE3-isis-1]is-level level-2
[*PE3-isis-1]cost-style wide
[*PE3-isis-1]network-entity 49.0001.0003.0003.0003.00
[*PE3-isis-1]is-name PE3
[*PE3-isis-1]int lo0
[*PE3-LoopBack0]isis en 1
[*PE3-LoopBack0]int ether1/0/0
[*PE3-Ethernet1/0/0]isis en 1
[*PE3-Ethernet1/0/0]isis circuit-type p2p
[*PE3-Ethernet1/0/0]int ether1/0/1
[*PE3-Ethernet1/0/1]isis en 1
[*PE3-Ethernet1/0/1]isis circuit-type p2
[*PE3-Ethernet1/0/1]commit

# PE4的IS-IS配置
[~PE4]isis 1
[*PE4-isis-1]is-level level-2
[*PE4-isis-1]cost-style wide
[*PE4-isis-1]network-entity 49.0001.0004.0004.0004.00
[*PE4-isis-1]is-name PE4
[*PE4-isis-1]int lo0
[*PE4-LoopBack0]isis en 1
[*PE4-LoopBack0]int ether1/0/0
[*PE4-Ethernet1/0/0]isis en 1
[*PE4-Ethernet1/0/0]isis circuit-type p2p
[*PE4-Ethernet1/0/0]int ether1/0/1
[*PE4-Ethernet1/0/1]isis en 1
[*PE4-Ethernet1/0/1]isis circuit-type p2p
[*PE4-Ethernet1/0/1]commit

                        IS-IS路由验证:

        (2)配置MPLS,使能设备MPLS功能,配置MPLS LSR ID,全局使能SR,在IS-IS中开启对SR的扩展能力,并配置Node SID

# PE1的MPLS SR配置
[~PE1]mpls lsr-id 10.0.1.1
[*PE1]mpls
[*PE1-mpls]quit
[*PE1]segment-routing
[*PE1-segment-routing]quit
[*PE1]isis 1
[*PE1-isis-1]segment mpls
[*PE1-isis-1]segment-routing global-block 16000 17000
[*PE1-isis-1]inter loop 0
[*PE1-LoopBack0]isis prefix-sid index 1
[*PE1-LoopBack0]commit

# PE2的MPLS SR配置
[~PE2]mpls lsr-id 10.0.2.2
[*PE2]mpls
[*PE2-mpls]quit
[*PE2]segment-routing
[*PE2-segment-routing]quit
[*PE2]isis 1
[*PE2-isis-1]segment-routing mpls
[*PE2-isis-1]segment-routing global-block 16000 17000
[*PE2-isis-1]int lo0
[*PE2-LoopBack0]isis prefix-sid index 2
[*PE2-LoopBack0]commit

# P1的MPLS SR配置
[~P1]mpls lsr-id 10.0.5.5
[*P1]mpls
[*P1-mpls]quit
[*P1]segment-routing
[*P1-segment-routing]quit
[*P1]isis 1
[*P1-isis-1]segment-routing mpls
[*P1-isis-1]segment-routing global-block 16000 17000
[*P1-isis-1]int lo0
[*P1-LoopBack0]isis prefix-sid index 5
[*P1-LoopBack0]commit

# P2的MPLS SR配置
[~P2]mpls lsr-id 10.0.6.6
[*P2]mpls
[*P2-mpls]quit
[*P2]segment-routing
[*P2-segment-routing]quit
[*P2]isis 1
[*P2-isis-1]segment-routing mpls
[*P2-isis-1]segment-routing global-block 16000 17000
[*P2-isis-1]quit
[*P2]interface loopback 0
[*P2-LoopBack0]isis prefix-sid index 6
[*P2-LoopBack0]commit

# PE3的MPLS SR配置
[~PE3]mpls lsr-id 10.0.3.3
[*PE3]mpls
Info: Mpls starting, please wait… OK!
[*PE3-mpls]
[*PE3-mpls]
[*PE3-mpls]quit
[*PE3]segment-routing
[*PE3-segment-routing]quit
[*PE3]isis 1
[*PE3-isis-1]segment-routing mpls
[*PE3-isis-1]segment-routing global-block 16000 17000
[*PE3-isis-1]inter lo0
[*PE3-LoopBack0]isis prefix-sid index 3
[*PE3-LoopBack0]commit

# PE4的MPLS SR配置
[~PE4]mpls lsr-id 10.0.4.4
[*PE4]mpls
Info: Mpls starting, please wait… OK!
[*PE4-mpls]quit
[*PE4]segment-routing
[*PE4-segment-routing]quit
[*PE4]isis 1
[*PE4-isis-1]segment-routing mpls
[*PE4-isis-1]segment-routing glo
[*PE4-isis-1]segment-routing global-block 16000 17000
[*PE4-isis-1]int lo0
[*PE4-LoopBack0]isis prefix-si
[*PE4-LoopBack0]isis prefix-sid ind
[*PE4-LoopBack0]isis prefix-sid index 4
Info: A 32-bit primary IP address must be configured for the IS-IS prefix SID to take effect.
[*PE4-LoopBack0]commit

                        结果验证:

        (3)配置PE1、PE4与P1、P2之间的MP-IBGP对等体关系,P1、P2为RR,在PE1、PE4上创建vpn-instance vpna,并绑定Loopback 1接口,在BGP中引入路由

# PE1的 BGP、vpn-instance配置
[~PE1]ip vpn
[~PE1]ip vpn-instance vpna
[*PE1-vpn-instance-vpna]ipv4-family
[*PE1-vpn-instance-vpna-af-ipv4]route-distinguisher 100:10
[*PE1-vpn-instance-vpna-af-ipv4]vpn-target 100:1020 both
[*PE1-vpn-instance-vpna-af-ipv4]quit
[*PE1-vpn-instance-vpna]quit
[*PE1]interface LoopBack 1
[*PE1-LoopBack1]ip binding vpn-instance vpna
[*PE1-LoopBack1]ip add 10.1.1.1 32
[*PE1-LoopBack1]quit
[*PE1]bgp 65100
[*PE1-bgp]router
[*PE1-bgp]router-id 10.0.1.1
[*PE1-bgp]peer 10.0.5.5 as-number 65100
[*PE1-bgp]peer 10.0.5.5 connect-interface LoopBack 0
[*PE1-bgp]peer 10.0.6.6 as-number 65100
[*PE1-bgp]peer 10.0.6.6 connect-interface LoopBack 0
[*PE1-bgp]ipv4-family vpnv4
[*PE1-bgp-af-vpnv4]peer 10.0.5.5 en
Warning: This operation will reset the peer session. Continue? [Y/N]:y
[*PE1-bgp-af-vpnv4]peer 10.0.6.6 en
Warning: This operation will reset the peer session. Continue? [Y/N]:y
[*PE1-bgp-af-vpnv4]commit
[~PE1-bgp-af-vpnv4]quit
[~PE1-bgp]ipv4-family vpn-instance vpna
[*PE1-bgp-vpna]import-route direct
[*PE1-bgp-vpna]
[*PE1-bgp-vpna]commit

# PE2的BGP配置
[~PE2]bgp 65100
[*PE2-bgp]router
[*PE2-bgp]router-id 10.0.2.2
[*PE2-bgp]peer 10.0.5.5 as-number 65100
[*PE2-bgp]peer 10.0.5.5 connect-interface LoopBack 0
[*PE2-bgp]peer 10.0.6.6 as-number 65100
[*PE2-bgp]peer 10.0.6.6 connect-interface LoopBack 0
[*PE2-bgp]ipv4-family vpnv4
[*PE2-bgp-af-vpnv4]peer 10.0.5.5 en
Warning: This operation will reset the peer session. Continue? [Y/N]:y
[*PE2-bgp-af-vpnv4]peer 10.0.6.6 en
Warning: This operation will reset the peer session. Continue? [Y/N]:y
[*PE2-bgp-af-vpnv4]commit

# P1的BGP配置
[~P1]bgp 65100
[*P1-bgp]router-id 10.0.5.5
[*P1-bgp]peer 10.0.1.1 as-number 65100
[*P1-bgp]peer 10.0.1.1 connect-interface LoopBack 0
[*P1-bgp]peer 10.0.2.2 as-number 65100
[*P1-bgp]peer 10.0.2.2 connect-interface LoopBack 0
[*P1-bgp]peer 10.0.3.3 as-number 65100
[*P1-bgp]peer 10.0.4.4 connect-interface LoopBack 0
Error: The peer session does not exist.
[*P1-bgp]peer 10.0.4.4 as-number 65100
[*P1-bgp]peer 10.0.4.4 connect-interface LoopBack 0
[*P1-bgp]ipv4-family vpnv4
[*P1-bgp-af-vpnv4]undo policy vpn-target
[*P1-bgp-af-vpnv4]peer 10.0.1.1 en
Warning: This operation will reset the peer session. Continue? [Y/N]:y
[*P1-bgp-af-vpnv4]peer 10.0.1.1 re
[*P1-bgp-af-vpnv4]peer 10.0.2.2 en
Warning: This operation will reset the peer session. Continue? [Y/N]:y
[*P1-bgp-af-vpnv4]peer 10.0.2.2 re
[*P1-bgp-af-vpnv4]peer 10.0.2.2 reflect-client
[*P1-bgp-af-vpnv4]peer 10.0.3.3 en
Warning: This operation will reset the peer session. Continue? [Y/N]:y
[*P1-bgp-af-vpnv4]peer 10.0.3.3 re
[*P1-bgp-af-vpnv4]peer 10.0.4.4 en
Warning: This operation will reset the peer session. Continue? [Y/N]:y
[*P1-bgp-af-vpnv4]peer 10.0.4.4 re
[*P1-bgp-af-vpnv4]commit

# P2的BGP配置
[~P2]bgp 65100
[*P2-bgp]router-id 10.0.6.6
[*P2-bgp]peer 10.0.1.1 as-nu 65100
[*P2-bgp]peer 10.0.1.1 connect-interface LoopBack 0
[*P2-bgp]peer 10.0.2.2 as-nu 65100
[*P2-bgp]peer 10.0.2.2 con lo 0
[*P2-bgp]peer 10.0.3.3 as-nu 65100
[*P2-bgp]peer 10.0.3.3 con lo 0
[*P2-bgp]peer 10.0.4.4 as-nu 65100
[*P2-bgp]peer 10.0.4.4 con lo 0
[*P2-bgp]peer 10.0.5.5 as-nu 65100
[*P2-bgp]peer 10.0.5.5 con lo0
[*P2-bgp]ipv4-family vpnv4
[*P2-bgp-af-vpnv4]undo policy vpn
[*P2-bgp-af-vpnv4]undo policy vpn-target
[*P2-bgp-af-vpnv4]peer 10.0.1.1 en
Warning: This operation will reset the peer session. Continue? [Y/N]:y
[*P2-bgp-af-vpnv4]peer 10.0.1.1 re
[*P2-bgp-af-vpnv4]peer 10.0.2.2 en
Warning: This operation will reset the peer session. Continue? [Y/N]:y
[*P2-bgp-af-vpnv4]peer 10.0.2.2 re
[*P2-bgp-af-vpnv4]peer 10.0.3.3 en
Warning: This operation will reset the peer session. Continue? [Y/N]:y
[*P2-bgp-af-vpnv4]peer 10.0.3.3 re
[*P2-bgp-af-vpnv4]peer 10.0.4.4 en
Warning: This operation will reset the peer session. Continue? [Y/N]:y
[*P2-bgp-af-vpnv4]peer 10.0.4.4 re
[*P2-bgp-af-vpnv4]commit
Committing….done.
[~P2-bgp-af-vpnv4]

# PE3的BGP配置
[~PE3]bgp 65100
[*PE3-bgp]router-id 10.0.3.3
[*PE3-bgp]peer 10.0.5.5 as-number 65100
[*PE3-bgp]peer 10.0.5.5 connect-interface LoopBack 0
[*PE3-bgp]peer 10.0.6.6 as-number 65100
[*PE3-bgp]peer 10.0.6.6 connect-interface LoopBack 0
[*PE3-bgp]ipv4-family vpnv4
[*PE3-bgp-af-vpnv4]peer 10.0.5.5 en
Warning: This operation will reset the peer session. Continue? [Y/N]:y
[*PE3-bgp-af-vpnv4]peer 10.0.6.6 en
Warning: This operation will reset the peer session. Continue? [Y/N]:y
[*PE3-bgp-af-vpnv4]commit

# PE4的BGP、vpn-instance配置
[~PE4]ip vpn-instance vpna
[*PE4-vpn-instance-vpna]ipv4
[*PE4-vpn-instance-vpna]ipv4-family
[*PE4-vpn-instance-vpna-af-ipv4]route-distinguisher 100:40
[*PE4-vpn-instance-vpna-af-ipv4]vpn-target 100:1020 b
[*PE4-vpn-instance-vpna-af-ipv4]vpn-target 100:1020 both
IVT Assignment result:
Info: VPN-Target assignment is successful.
EVT Assignment result:
Info: VPN-Target assignment is successful.
[*PE4-vpn-instance-vpna-af-ipv4]quit
[*PE4-vpn-instance-vpna]quit
[*PE4]interface LoopBack 1
[*PE4-LoopBack1]ip binding vpn-instance vpna
Info: All IPv4 and IPv6 related configurations on this interface are removed.
[*PE4-LoopBack1]ip add 10.1.4.4 32
[*PE4-LoopBack1]quit
[*PE4]bgp 65100
[*PE4-bgp]router-id 10.0.4.4
[*PE4-bgp]peer 10.0.5.5 as-number 65100
[*PE4-bgp]peer 10.0.5.5 connect-interface LoopBack 0
[*PE4-bgp]peer 10.0.6.6 as-number 65100
[*PE4-bgp]peer 10.0.6.6 connect-interface LoopBack 0
[*PE4-bgp]ipv4-family vpnv4
[*PE4-bgp-af-vpnv4]peer 10.0.5.5 en
Warning: This operation will reset the peer session. Continue? [Y/N]:y
[*PE4-bgp-af-vpnv4]peer 10.0.6.6 en
Warning: This operation will reset the peer session. Continue? [Y/N]:y
[*PE4-bgp-af-vpnv4]commit
Committing….done.
[~PE4-bgp-af-vpnv4]quit
[~PE4-bgp]ipv4-family vpn
[~PE4-bgp]ipv4-family vpn-instance vpna
[*PE4-bgp-vpna]import-route direct
[*PE4-bgp-vpna]commit

        6、结果验证

        

        7、抓包

                (1)PE1抓包

                (2)PE4抓包

                        通过对PE4的两个接口进行抓包发现,ICMP的数据包是经由Ethernet1/0/0和Ether1/0/1两个接口接收和发送的。可以判断出数据包在经由P1采用了负载分担的方式进行了转发。

赞(0)
未经允许不得转载:171主机测评 » 实验:Segment Routing L3VPNv4 SR-MPLS BE
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址