Sunday, July 11, 2021

SRv6 simple configuration example

 最近测试了SRv6,顺便记录下, SRv6具体是什么?对比我们平常的MPLS VPN的网络,数据转发采用的MPLS标签, 那MPLS标签常见的可以是LDP或者SR分配的; SRv6使用的IPv6的报头进行转发,在IPv6 Header 中新增SRH(Segment Routing Header)用来记录128bit IPv6地址格式的SRv6 SID(segment ID)如下图所示:


RFC2460

SRv6 Segment

Locator

128Bit的IPv6 SID由两部分组成, 其中前64bit 为Locator。
Locator 的前40Bit 必须在SRv6 domain中一致;余下的24bit 为node-id, 用于表示node,不能为0且SRv6域内node-id 不能一致。

1
2
3
4
5
segment-routing
 srv6
  locators
   locator r7
    prefix 2002:0:0:7::/64   <<<<<

Function

简单记录下Function的一些类别:

1
2
3
4
5
6
7
8
9
10
11
12
RP/0/RP0/CPU0:r1#show segment-routing srv6 sid
Wed Apr 21 04:36:25.814 UTC
 
*** Locator: 'MAIN' ***
 
SID                         Behavior          Context                           Owner               State  RW
--------------------------  ----------------  ------------------------------    ------------------  -----  --
fcbb:bb00:1::               uN (PSP/USD)      'default':1                       sidmgr              InUse  Y
fcbb:bb00:1:e000::          uA (PSP/USD)      [Gi0/0/0/0, Link-Local]:0         isis-1              InUse  Y
fcbb:bb00:1:e001::          uA (PSP/USD)      [Gi0/0/0/1, Link-Local]:0         isis-1              InUse  Y
fcbb:bb00:1:e002::          uDT4              '1'                               bgp-1               InUse  Y
fcbb:bb00:1:e003::          uDT6              '1'                               bgp-1               InUse  Y

Topo

Configuration

Locator
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//R1
RP/0/RP0/CPU0:r1#show run segment-routing
Wed Apr 21 04:51:26.026 UTC
segment-routing
 srv6
  encapsulation
   source-address 2001::1
  !
  locators
   locator MAIN
    micro-segment behavior unode psp-usd
    prefix fcbb:bb00:1::/48
   !
  !
 !
!

ISIS

控制层面ISIS的意义在于将Locator通告出去。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
RP/0/RP0/CPU0:r1#show run router isis
Wed Apr 21 04:52:23.675 UTC
router isis 1
 is-type level-2-only
 net 49.0000.0000.0001.00
 address-family ipv6 unicast
  metric-style wide
  segment-routing srv6    <<<<
   locator MAIN           <<<<
   !
  !
 !
 interface Loopback0
  address-family ipv6 unicast
  !
 !
 interface GigabitEthernet0/0/0/0
  point-to-point
  address-family ipv6 unicast
  !
 !
 interface GigabitEthernet0/0/0/1
  point-to-point
  address-family ipv6 unicast
  !
 !
!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
RP/0/RP0/CPU0:r1#show route ipv6 isis   
Wed Apr 21 04:47:31.557 UTC
 
i L2 2001::2/128
      [115/20] via fe80::250:56ff:feaa:71fd, 6d11h, GigabitEthernet0/0/0/0
i L2 2001::3/128
      [115/30] via fe80::250:56ff:feaa:71fd, 6d11h, GigabitEthernet0/0/0/0
i L2 2001::4/128
      [115/30] via fe80::250:56ff:feaa:6632, 6d11h, GigabitEthernet0/0/0/1
i L2 2001::5/128
      [115/20] via fe80::250:56ff:feaa:6632, 6d11h, GigabitEthernet0/0/0/1
i L2 2001:0:0:23::/64
      [115/20] via fe80::250:56ff:feaa:71fd, 6d11h, GigabitEthernet0/0/0/0
i L2 2001:0:0:34::/64
      [115/30] via fe80::250:56ff:feaa:6632, 6d11h, GigabitEthernet0/0/0/1
      [115/30] via fe80::250:56ff:feaa:71fd, 6d11h, GigabitEthernet0/0/0/0
i L2 2001:0:0:45::/64
      [115/20] via fe80::250:56ff:feaa:6632, 6d11h, GigabitEthernet0/0/0/1
i L2 fcbb:bb00:2::/48
      [115/11] via fe80::250:56ff:feaa:71fd, 6d11h, GigabitEthernet0/0/0/0
i L2 fcbb:bb00:3::/48
      [115/21] via fe80::250:56ff:feaa:71fd, 6d11h, GigabitEthernet0/0/0/0
i L2 fcbb:bb00:4::/48
      [115/21] via fe80::250:56ff:feaa:6632, 6d11h, GigabitEthernet0/0/0/1
i L2 fcbb:bb00:5::/48
      [115/11] via fe80::250:56ff:feaa:6632, 6d11h, GigabitEthernet0/0/0/1
BGP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
RP/0/RP0/CPU0:r1#show run router bgp
Wed Apr 21 04:54:58.113 UTC
router bgp 1
 bgp router-id 1.1.1.1
 address-family vpnv4 unicast
 !
 address-family vpnv6 unicast
 !
 neighbor 2001::3
  remote-as 1
  update-source Loopback0
  address-family vpnv4 unicast
  !
  address-family vpnv6 unicast
  !
 !
 vrf 1
  rd 1:1
  address-family ipv4 unicast     <<<< SRv6 IPv4 L3VPN service , support from XR 6.6.x
   segment-routing srv6
    locator MAIN
    alloc mode per-vrf
   !
   redistribute connected
  !
  address-family ipv6 unicast      <<<<< SRv6 IPv6 L3VPN service , support from XR 7.3.1
   segment-routing srv6
    locator MAIN
    alloc mode per-vrf
   !
   redistribute connected
  !
  neighbor 10.1.6.6
   remote-as 6
   address-family ipv4 unicast
    route-policy PASS in
    route-policy PASS out
   !
  !
 !
!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
RP/0/RP0/CPU0:r1#show cef vrf  1 7.7.7.7/32 detail
Wed Apr 21 05:18:48.299 UTC
7.7.7.7/32, version 24, SRv6 Headend, internal 0x5000001 0x30 (ptr 0xd3ab658) [1], 0x0 (0xe607840), 0x0 (0xf636408)
 Updated Apr 14 17:20:16.295
 Prefix Len 32, traffic index 0, precedence n/a, priority 3
  gateway array (0xf7740a8) reference count 2, flags 0x10, source rib (7), 0 backups
                [3 type 3 flags 0x8441 (0xe522968) ext 0x0 (0x0)]
  LW-LDI[type=3, refc=1, ptr=0xe607840, sh-ldi=0xe522968]
  gateway array update type-time 1 Apr 14 17:20:16.295
 LDI Update time Apr 14 17:20:16.367
 LW-LDI-TS Apr 14 17:20:16.367
 
  Level 1 - Load distribution: 0
  [0] via fcbb:bb00:3::/128, recursive
 
   via fcbb:bb00:3::/128, 5 dependencies, recursive [flags 0x6000]
    path-idx 0 NHID 0x0 [0xe20b890 0x0]
    next hop VRF - 'default', table - 0xe0800000
    next hop fcbb:bb00:3::/128 via fcbb:bb00:3::/48
    SRv6 H.Encaps.Red SID-list {fcbb:bb00:3:e002::}
 
    Load distribution: 0 (refcount 3)
 
    Hash  OK  Interface                 Address
    0     Y   GigabitEthernet0/0/0/0    remote        
 
RP/0/RP0/CPU0:r1#
1
2
3
4
5
6
7
8
9
10
11
12
13
RP/0/RP0/CPU0:r3#show segment-routing srv6 sid   <<<< R3  sid allocate
Wed Apr 21 05:25:05.037 UTC
 
*** Locator: 'MAIN' ***
 
SID                         Behavior          Context                           Owner               State  RW
--------------------------  ----------------  ------------------------------    ------------------  -----  --
fcbb:bb00:3::               uN (PSP/USD)      'default':3                       sidmgr              InUse  Y
fcbb:bb00:3:e000::          uA (PSP/USD)      [Gi0/0/0/0, Link-Local]:0         isis-1              InUse  Y
fcbb:bb00:3:e001::          uA (PSP/USD)      [Gi0/0/0/1, Link-Local]:0         isis-1              InUse  Y
fcbb:bb00:3:e002::          uDT4              '1'                               bgp-1               InUse  Y
fcbb:bb00:3:e003::          uDT6              '1'                               bgp-1               InUse  Y
RP/0/RP0/CPU0:r3#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
RP/0/RP0/CPU0:r1#show bgp  vrf 1 ipv4 unicast  7.7.7.7/32 detail
Wed Apr 21 05:25:46.271 UTC
BGP routing table entry for 7.7.7.7/32, Route Distinguisher: 1:1
Versions:
  Process           bRIB/RIB  SendTblVer
  Speaker                 27          27
    Flags: 0x00041001+0x00000000;
Last Modified: Apr 14 17:20:16.575 for 6d12h
Paths: (1 available, best #1)
  Advertised to CE peers (in unique update groups):
    10.1.6.6       
  Path #1: Received by speaker 0
  Flags: 0x2000000085060005, import: 0x9f
  Advertised to CE peers (in unique update groups):
    10.1.6.6       
  7
    2001::3 (metric 30) from 2001::3 (3.3.3.3), if-handle 0x00000000
      Received Label 0xe00200
      Origin incomplete, metric 0, localpref 100, valid, internal, best, group-best, import-candidate, imported
      Received Path ID 0, Local Path ID 1, version 27
      Extended community: RT:1:1
      PSID-Type:L3, SubTLV Count:1, R:0x00,
       SubTLV:
        T:1(Sid information), Sid:fcbb:bb00:3::, F:0x00, R2:0x00, Behavior:63, R3:0x00, SS-TLV Count:1
         SubSubTLV:
          T:1(Sid structure):
           Length [Loc-blk,Loc-node,Func,Arg]:[32,16,16,0], Tpose-len:16, Tpose-offset:48
      Source AFI: VPNv4 Unicast, Source VRF: 1, Source Route Distinguisher: 1:1
RP/0/RP0/CPU0:r1#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
RP/0/RP0/CPU0:r1#show bgp  vrf 1 ipv6 unicast 3333::1/128  detail
Wed Apr 21 05:26:33.662 UTC
BGP routing table entry for 3333::1/128, Route Distinguisher: 1:1
Versions:
  Process           bRIB/RIB  SendTblVer
  Speaker                  8           8
    Flags: 0x00041001+0x00000000;
Last Modified: Apr 14 17:24:01.575 for 6d12h
Paths: (1 available, best #1)
  Not advertised to any peer
  Path #1: Received by speaker 0
  Flags: 0x2000000085060005, import: 0x9f
  Not advertised to any peer
  Local
    2001::3 (metric 30) from 2001::3 (3.3.3.3), if-handle 0x00000000
      Received Label 0xe00300
      Origin incomplete, metric 0, localpref 100, valid, internal, best, group-best, import-candidate, imported
      Received Path ID 0, Local Path ID 1, version 8
      Extended community: RT:1:1
      PSID-Type:L3, SubTLV Count:1, R:0x00,
       SubTLV:
        T:1(Sid information), Sid:fcbb:bb00:3::, F:0x00, R2:0x00, Behavior:62, R3:0x00, SS-TLV Count:1
         SubSubTLV:
          T:1(Sid structure):
           Length [Loc-blk,Loc-node,Func,Arg]:[32,16,16,0], Tpose-len:16, Tpose-offset:48
      Source AFI: VPNv6 Unicast, Source VRF: 1, Source Route Distinguisher: 1:1
RP/0/RP0/CPU0:r1#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
RP/0/RP0/CPU0:r1#show cef vrf 1 ipv6 3333::1/128 detail
Wed Apr 21 05:32:37.066 UTC
3333::1/128, version 3, SRv6 Headend, internal 0x5000001 0x30 (ptr 0xe209668) [1], 0x0 (0xe3a1e28), 0x0 (0xf636498)
 Updated Apr 14 17:24:01.188
 Prefix Len 128, traffic index 0, precedence n/a, priority 3
  gateway array (0xe20fda8) reference count 1, flags 0x10, source rib (7), 0 backups
                [2 type 3 flags 0x8441 (0xe2bce38) ext 0x0 (0x0)]
  LW-LDI[type=3, refc=1, ptr=0xe3a1e28, sh-ldi=0xe2bce38]
  gateway array update type-time 1 Apr 14 17:24:01.189
 LDI Update time Apr 14 17:24:01.190
 LW-LDI-TS Apr 14 17:24:01.190
 
  Level 1 - Load distribution: 0
  [0] via fcbb:bb00:3::/128, recursive
 
   via fcbb:bb00:3::/128, 5 dependencies, recursive [flags 0x6000]
    path-idx 0 NHID 0x0 [0xe20b890 0x0]
    next hop VRF - 'default', table - 0xe0800000
    next hop fcbb:bb00:3::/128 via fcbb:bb00:3::/48
    SRv6 H.Encaps.Red SID-list {fcbb:bb00:3:e003::}
 
    Load distribution: 0 (refcount 2)
 
    Hash  OK  Interface                 Address
    0     Y   GigabitEthernet0/0/0/0    remote        
 
RP/0/RP0/CPU0:r1#

No comments:

Post a Comment