七、SRv6 TE Policy测试
7.1 测试拓扑
7.2 测试说明
- PE1配置1条SRv6 TE Policy,命名为policy1
- PE1接收EVPN路由172.20.1.0时对此路由进行染色,通过color引流的方式,将CE1 ping CE2的业务流量引入SRv6 TE Policy policy1
- 为简化测试,只在PE1配置SRv6 TE Policy,所以CE1 Ping CE2时,CE1去往CE2方向的流量会走SRv6 TE Policy,CE2返回CE1方向的流量走SRv6 BE
7.3 测试步骤
7.3.1 查看End SID信息
<PE1>dis segment-routing ipv6 local-sid end forwarding
My Local-SID End Forwarding Table
---------------------------------
SID : 3001:1::10:0/128 FuncType : End
Flavor : PSP SidCompress : NO
LocatorName : PE1 LocatorID : 1
ProtocolType: STATIC ProcessID : --
UpdateTime : 2023-09-23 09:48:00.553
SID : 3001:1::8021:0/128 FuncType : End
Flavor : NO-FLAVOR SidCompress : NO
LocatorName : PE1 LocatorID : 1
ProtocolType: ISIS ProcessID : 100
UpdateTime : 2023-09-23 09:58:13.667
SID : 3001:1::8022:0/128 FuncType : End
Flavor : PSP USP USD SidCompress : NO
LocatorName : PE1 LocatorID : 1
ProtocolType: ISIS ProcessID : 100
UpdateTime : 2023-09-23 09:58:13.667
Total SID(s): 3
<PE1>
-------------
[P2]dis segment-routing ipv6 local-sid end forwarding
My Local-SID End Forwarding Table
---------------------------------
SID : 3001:2::10:0/128 FuncType : End
Flavor : PSP SidCompress : NO
LocatorName : P2 LocatorID : 1
ProtocolType: STATIC ProcessID : --
UpdateTime : 2023-09-23 09:49:30.230
SID : 3001:2::8024:0/128 FuncType : End
Flavor : NO-FLAVOR SidCompress : NO
LocatorName : P2 LocatorID : 1
ProtocolType: ISIS ProcessID : 100
UpdateTime : 2023-09-23 09:59:43.963
SID : 3001:2::8025:0/128 FuncType : End
Flavor : PSP USP USD SidCompress : NO
LocatorName : P2 LocatorID : 1
ProtocolType: ISIS ProcessID : 100
UpdateTime : 2023-09-23 09:59:43.963
Total SID(s): 3
[P2]
------------------
[P3]dis segment-routing ipv6 local-sid end forwarding
My Local-SID End Forwarding Table
---------------------------------
SID : 3001:3::10:0/128 FuncType : End
Flavor : PSP SidCompress : NO
LocatorName : P3 LocatorID : 1
ProtocolType: STATIC ProcessID : --
UpdateTime : 2023-09-23 09:47:17.136
SID : 3001:3::8021:0/128 FuncType : End
Flavor : NO-FLAVOR SidCompress : NO
LocatorName : P3 LocatorID : 1
ProtocolType: ISIS ProcessID : 100
UpdateTime : 2023-09-23 10:01:22.990
SID : 3001:3::8022:0/128 FuncType : End
Flavor : PSP USP USD SidCompress : NO
LocatorName : P3 LocatorID : 1
ProtocolType: ISIS ProcessID : 100
UpdateTime : 2023-09-23 10:01:22.990
Total SID(s): 3
[P3]
--------------
[PE4]dis segment-routing ipv6 local-sid end forwarding
My Local-SID End Forwarding Table
---------------------------------
SID : 3001:4::10:0/128 FuncType : End
Flavor : PSP SidCompress : NO
LocatorName : PE4 LocatorID : 1
ProtocolType: STATIC ProcessID : --
UpdateTime : 2023-09-23 09:47:29.087
SID : 3001:4::8000:0/128 FuncType : End
Flavor : NO-FLAVOR SidCompress : NO
LocatorName : PE4 LocatorID : 1
ProtocolType: ISIS ProcessID : 100
UpdateTime : 2023-09-23 10:01:43.051
SID : 3001:4::8001:0/128 FuncType : End
Flavor : PSP USP USD SidCompress : NO
LocatorName : PE4 LocatorID : 1
ProtocolType: ISIS ProcessID : 100
UpdateTime : 2023-09-23 10:01:43.051
Total SID(s): 3
[PE4]
7.3.2 配置SRv6 TE Policy
PE1配置:
#
segment-routing ipv6
segment-list list1
index 5 sid ipv6 3001:2::10:0
index 10 sid ipv6 3001:4::10:0
srv6-te policy policy1 endpoint 2001:4::1 color 101
candidate-path preference 100
segment-list list1
#
7.3.3 查看SRv6 TE Policy信息
[PE1]dis srv6-te policy policy-name policy1
PolicyName : policy1
Color : 101 Endpoint : 2001:4::1
TunnelId : 3 Binding SID : -
TunnelType : SRv6-TE Policy DelayTimerRemain : -
Policy State : Up State Change Time : 2023-09-23 09:49:57
Admin State : Up Traffic Statistics : Disable
Backup Hot-Standby : Disable BFD : Disable
Interface Index : - Interface Name : -
Interface State : - Encapsulation Mode : Insert
Candidate-path Count : 1
Candidate-path Preference : 100
Path State : Active Path Type : Primary
Protocol-Origin : Configuration(30) Originator : 0, 0.0.0.0
Discriminator : 100 Binding SID : -
GroupId : 3 Policy Name : policy1
Template ID : 0 Path Verification : Enable
DelayTimerRemain : - Network Slice ID : -
Segment-List Count : 1
Segment-List : list1
Segment-List ID : 3 XcIndex : 3
List State : Up DelayTimerRemain : -
Verification State : Up SuppressTimeRemain : -
PMTU : 9600 Active PMTU : 9600
Weight : 1 BFD State : -
Network Slice ID : -
Binding SID : -
Reverse Binding SID : -
SID :
3001:2::10:0
3001:4::10:0
[PE1]
7.3.4 配置Color引流
在PE1,对172.20.1.0/24 BGP 路由染色,color为101
#
#配置对BGP VPN路由进行染色
#
route-policy p1 permit node 10
if-match ip-prefix 1
apply extcommunity color 0:101
#
route-policy p1 permit node 20
#
ip ip-prefix 1 index 10 permit 172.20.1.0 24
#
bgp 100
#
l2vpn-family evpn
peer RR route-policy p1 import
#
#配置隧道策略
#
tunnel-policy tnl-1
tunnel select-seq ipv6 srv6-te-policy load-balance-number 1
#
#把隧道策略部署到VPN实例中
#
ip vpn-instance vpn1
ipv4-family
tnl-policy tnl-1 evpn
ipv6-family
tnl-policy tnl-1 evpn
#
7.3.5 查看BGP EVPN路由
[PE1]dis bgp evpn all routing-table
Local AS number : 100
BGP Local router ID is 192.168.1.1
Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
EVPN address family:
Number of Ip Prefix Routes: 8
Route Distinguisher: 100:1
Network(EthTagId/IpPrefix/IpPrefixLen) NextHop
*> 0:172.10.1.0:24 0.0.0.0
*> 0:[172:10:1::]:64 ::
Route Distinguisher: 100:2
Network(EthTagId/IpPrefix/IpPrefixLen) NextHop
*>i 0:172.30.0.0:16 2001:4::1
* i 2001:4::1
*>i 0:172.20.1.0:24 2001:4::1
* i 2001:4::1
*>i 0:[172:20:1::]:64 2001:4::1
* i 2001:4::1
[PE1]
[PE1]dis bgp evpn all routing-table prefix-route 0:172.20.1.0:24
BGP local router ID : 192.168.1.1
Local AS number : 100
Total routes of Route Distinguisher(100:2): 2
BGP routing table entry information of 0:172.20.1.0:24:
Label information (Received/Applied): 3/NULL
From: 2001:2::1 (192.168.2.1)
Route Duration: 0d00h16m42s
Relay IP Nexthop: FE80::3A06:FF:FE11:301
Relay IP Out-Interface: Ethernet3/0/0
Relay Tunnel Out-Interface:
Original nexthop: 2001:4::1
Qos information : 0x0
Ext-Community: RT <100 : 100>, Color <0 : 101>
Prefix-sid: 3001:4::4001:0, Endpoint Behavior: 19
AS-path Nil, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal, best, select, pre 255, IGP cost 20
Originator: 192.168.4.1
Cluster list: 0.0.0.100
Route Type: 5 (Ip Prefix Route)
Ethernet Tag ID: 0, IP Prefix/Len: 172.20.1.0/24, ESI: 0000.0000.0000.0000.0000, GW IP Address: 0.0.0.0
Not advertised to any peer yet
BGP routing table entry information of 0:172.20.1.0:24:
Label information (Received/Applied): 3/NULL
From: 2001:3::1 (192.168.3.1)
Route Duration: 0d00h18m04s
Relay IP Nexthop: FE80::3A06:FF:FE11:301
Relay IP Out-Interface: Ethernet3/0/0
Relay Tunnel Out-Interface:
Original nexthop: 2001:4::1
Qos information : 0x0
Ext-Community: RT <100 : 100>, Color <0 : 101>
Prefix-sid: 3001:4::4001:0, Endpoint Behavior: 19
AS-path Nil, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal, pre 255, IGP cost 20, not preferred for peer address
Originator: 192.168.4.1
Cluster list: 0.0.0.100
Route Type: 5 (Ip Prefix Route)
Ethernet Tag ID: 0, IP Prefix/Len: 172.20.1.0/24, ESI: 0000.0000.0000.0000.0000, GW IP Address: 0.0.0.0
Not advertised to any peer yet
[PE1]
7.3.6 查看BGP VPN路由
[PE1]dis bgp vpnv4 vpn-instance vpn1 routing-table
BGP Local router ID is 192.168.1.1
Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V - valid, I - invalid, N - not-found
VPN-Instance vpn1, Router ID 192.168.1.1:
Total Number of Routes: 7
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 127.0.0.0/8 0.0.0.0 0 0 ?
*> 172.10.1.0/24 0.0.0.0 0 0 ?
*> 172.10.1.1/32 0.0.0.0 0 0 ?
*>i 172.20.1.0/24 2001:4::1 0 100 0 ?
* i 2001:4::1 0 100 0 ?
*>i 172.30.0.0/16 2001:4::1 0 100 0 ?
* i 2001:4::1 0 100 0 ?
[PE1]
[PE1]dis bgp vpnv4 vpn-instance vpn1 routing-table 172.20.1.0
BGP local router ID : 192.168.1.1
Local AS number : 100
VPN-Instance vpn1, Router ID 192.168.1.1:
Paths: 2 available, 1 best, 1 select, 0 best-external, 0 add-path
BGP routing table entry information of 172.20.1.0/24:
Route Distinguisher: 100:2
Remote-Cross route
Evpn route: Type 5, ip-prefix
Label information (Received/Applied): 3/NULL
From: 2001:2::1 (192.168.2.1)
Route Duration: 0d00h18m27s
Relay IP Nexthop: FE80::3A06:FF:FE11:301
Relay IP Out-Interface: Ethernet3/0/0
Relay Tunnel Out-Interface: policy1(srv6tepolicy)
Original nexthop: 2001:4::1
Qos information : 0x0
Ext-Community: RT <100 : 100>, Color <0 : 101>
Prefix-sid: 3001:4::4001:0, Endpoint Behavior: 19
AS-path Nil, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal, best, select, pre 255
Originator: 192.168.4.1
Cluster list: 0.0.0.100
Not advertised to any peer yet
BGP routing table entry information of 172.20.1.0/24:
Route Distinguisher: 100:2
Remote-Cross route
Evpn route: Type 5, ip-prefix
Label information (Received/Applied): 3/NULL
From: 2001:3::1 (192.168.3.1)
Route Duration: 0d00h18m27s
Relay IP Nexthop: FE80::3A06:FF:FE11:301
Relay IP Out-Interface: Ethernet3/0/0
Relay Tunnel Out-Interface: policy1(srv6tepolicy)
Original nexthop: 2001:4::1
Qos information : 0x0
Ext-Community: RT <100 : 100>, Color <0 : 101>
Prefix-sid: 3001:4::4001:0, Endpoint Behavior: 19
AS-path Nil, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal, pre 255, not preferred for peer address
Originator: 192.168.4.1
Cluster list: 0.0.0.100
Not advertised to any peer yet
[PE1]
7.3.7 查看VPN实例vpn1的路由
查看VPN实例IPv4路由表信息,可以看到私网路由已经成功迭代到SRv6 TE Policy。
[PE1]dis ip routing-table vpn-instance vpn1
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Table : vpn1
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
172.10.1.0/24 Direct 0 0 D 172.10.1.1 Ethernet3/0/2
172.10.1.1/32 Direct 0 0 D 127.0.0.1 Ethernet3/0/2
172.10.1.255/32 Direct 0 0 D 127.0.0.1 Ethernet3/0/2
172.20.1.0/24 IBGP 255 0 RD 2001:4::1 policy1
172.30.0.0/16 IBGP 255 0 RD 2001:4::1 SRv6-TE Flow Group
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[PE1]
[PE1]dis ip routing-table vpn-instance vpn1 172.20.1.0 verbose
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Table : vpn1
Summary Count : 1
Destination: 172.20.1.0/24
Protocol: IBGP Process ID: 0
Preference: 255 Cost: 0
NextHop: 2001:4::1 Neighbour: 2001:2::1
State: Active Adv Relied Age: 00h20m50s
Tag: 0 Priority: low
Label: NULL QoSInfo: 0x0
IndirectID: 0x10000B0 Instance:
RelayNextHop: :: Interface: policy1
TunnelID: 0x000000003400000003 Flags: RD
RouteColor: 0
[PE1]
[PE1]
7.3.8 Ping测试
CE1 ping CE2。
7.3.9 查看SRv6 TE Policy报文格式
CE1 ping CE2时,在PE1-Eth3/0/0、P2-Eth3/0/2抓取报文,并手工通过wireshark解析,查看SRH信息及IPv6目的地址的变化。
PE1-Eth3/0/0抓包:
Frame 2: 194 bytes on wire (1552 bits), 194 bytes captured (1552 bits)
Ethernet II, Src: 38:03:00:11:03:00 (38:03:00:11:03:00), Dst: 38:04:00:11:03:01 (38:04:00:11:03:01)
Internet Protocol Version 6, Src: ::, Dst: 3001:2::10:0
0110 .... = Version: 6
.... 1111 1111 .... .... .... .... .... = Traffic Class: 0xff (DSCP: Unknown, ECN: CE)
.... 0000 0000 0000 0000 0001 = Flow Label: 0x00001
Payload Length: 140
Next Header: Routing Header for IPv6 (43)
Hop Limit: 63
Source Address: ::
Destination Address: 3001:2::10:0
Routing Header for IPv6 (Segment Routing)
Next Header: IPIP (4)
Length: 6
[Length: 56 bytes]
Type: Segment Routing (4)
Segments Left: 2 <---------------待执行的SID数量
Last Entry: 2
Flags: 0x00
Tag: 0000
Address[0]: 3001:4::4001:0
Address[1]: 3001:4::10:0
Address[2]: 3001:2::10:0 <------------正在执行的SID
Internet Protocol Version 4, Src: 172.10.1.10, Dst: 172.20.1.10
Internet Control Message Protocol
P2-Eth3/0/2抓包:
Frame 2: 194 bytes on wire (1552 bits), 194 bytes captured (1552 bits)
Ethernet II, Src: 38:04:00:11:03:02 (38:04:00:11:03:02), Dst: 38:05:00:11:03:02 (38:05:00:11:03:02)
Internet Protocol Version 6, Src: ::, Dst: 3001:4::10:0
0110 .... = Version: 6
.... 1111 1111 .... .... .... .... .... = Traffic Class: 0xff (DSCP: Unknown, ECN: CE)
.... 0000 0000 0000 0000 0001 = Flow Label: 0x00001
Payload Length: 140
Next Header: Routing Header for IPv6 (43)
Hop Limit: 62
Source Address: ::
Destination Address: 3001:4::10:0
Routing Header for IPv6 (Segment Routing)
Next Header: IPIP (4)
Length: 6
[Length: 56 bytes]
Type: Segment Routing (4)
Segments Left: 1 <---------------待执行的SID数量
Last Entry: 2
Flags: 0x00
Tag: 0000
Address[0]: 3001:4::4001:0
Address[1]: 3001:4::10:0 <------------正在执行的SID
Address[2]: 3001:2::10:0
Internet Protocol Version 4, Src: 172.10.1.10, Dst: 172.20.1.10
Internet Control Message Protocol