SR 配置案例

SR ISIS

router isis 1
 is-type level-2-only
 net 49.0000.0000.0001.00
 address-family ipv4 unicast
  metric-style wide
  segment-routing mpls
 !
 interface Loopback0
  address-family ipv4 unicast
   prefix-sid index 1
  !

SR OSPF

router ospf 1
 router-id 10.1.2.2
 segment-routing mpls
 redistribute isis 1 route-policy Loopback
 address-family ipv4 unicast
 area 0
  interface Loopback0
   passive enable
   prefix-sid index 2

SR BGP

route-policy SID($SID)
  set label-index $SID
end-policy
!
router bgp 4
 bgp router-id 10.1.4.4
 address-family ipv4 unicast
  network 10.1.4.4/32 route-policy SID(4)
  allocate-label all
 !
 neighbor 10.1.45.5
  remote-as 5
  address-family ipv4 labeled-unicast
   route-policy pass in
   route-policy pass out
  !
 !
!

SR 路由重分发案例

使用router-policy只重分发Loopback (/32 prefix)。

route-policy Loopback
  if destination in (0.0.0.0/0 eq 32) then
    pass
  else
    drop
  endif
end-policy

 address-family ipv4 unicast
  redistribute xx 1 route-policy Loopback

ISIS

RP/0/0/CPU0:R1#show isis database R2.00-00 detail verbose 
Tue Nov 12 12:26:08.786 UTC

IS-IS 1 (Level-2) Link State Database
LSPID                 LSP Seq Num  LSP Checksum  LSP Holdtime/Rcvd  ATT/P/OL
R2.00-00              0x0000021a   0x9162        380  /1199         0/0/0
  Area Address:   49
  Metric: 10         IS-Extended R1.00
    Interface IP Address: 10.1.12.2
    Neighbor IP Address: 10.1.12.1
    Link Maximum SID Depth: 
      Subtype: 1, Value: 10
    ADJ-SID: F:0 B:0 V:1 L:1 S:0 P:0 weight:0 Adjacency-sid:24001
  NLPID:          0xcc
  IP Address:     10.1.2.2
  Metric: 10         IP-Extended 10.1.2.2/32
    Prefix-SID Index: 2, Algorithm:0, R:0 N:1 P:0 E:0 V:0 L:0
    Prefix Attribute Flags: X:0 R:0 N:1
  Metric: 0          IP-Extended 10.1.3.3/32
    Prefix-SID Index: 3, Algorithm:0, R:1 N:0 P:1 E:0 V:0 L:0
    Prefix Attribute Flags: X:1 R:0 N:0
  Metric: 0          IP-Extended 10.1.4.4/32
    Prefix-SID Index: 4, Algorithm:0, R:1 N:0 P:1 E:0 V:0 L:0
    Prefix Attribute Flags: X:1 R:0 N:0
  Metric: 10         IP-Extended 10.1.12.0/24
    Prefix Attribute Flags: X:0 R:0 N:0
  Metric: 0          IP-Extended 10.1.5.5/32
    Prefix-SID Index: 5, Algorithm:0, R:1 N:0 P:1 E:0 V:0 L:0
    Prefix Attribute Flags: X:1 R:0 N:0
  Hostname:       R2
  Router Cap:     10.1.2.2, D:0, S:0
    Segment Routing: I:1 V:0, SRGB Base: 16000 Range: 8000
    SR Algorithm: 
      Algorithm: 0
      Algorithm: 1
    Node Maximum SID Depth: 
      Subtype: 1, Value: 10

OSPF

RP/0/0/CPU0:R2#show ospf database  opaque-as 7.0.0.1   
Tue Nov 12 12:32:53.108 UTC


            OSPF Router with ID (10.1.2.2) (Process ID 1)

                Type-11 Opaque Link AS Link States

  LS age: 651
  Options: (No TOS-capability, DC)
  LS Type: Opaque AS Link
  Link State ID: 7.0.0.1
  Opaque Type: 7
  Opaque ID: 1
  Advertising Router: 10.1.2.2
  LS Seq Number: 800000d0
  Checksum: 0x9b12
  Length: 44

    Extended Prefix TLV: Length: 20
      Route-type: 5
      AF        : 0
      Flags     : 0x0
      Prefix    : 10.1.1.1/32

      SID sub-TLV: Length: 8
        Flags     : 0x40
        MTID      : 0
        Algo      : 0
        SID Index : 1

  LS age: 359
  Options: (No TOS-capability, DC)
  LS Type: Opaque AS Link
  Link State ID: 7.0.0.1
  Opaque Type: 7
  Opaque ID: 1
  Advertising Router: 10.1.4.4
  LS Seq Number: 800000d0
  Checksum: 0x5647
  Length: 44

    Extended Prefix TLV: Length: 20
      Route-type: 5
      AF        : 0
      Flags     : 0x0
      Prefix    : 10.1.5.5/32

      SID sub-TLV: Length: 8
        Flags     : 0x40
        MTID      : 0
        Algo      : 0
        SID Index : 5

RP/0/0/CPU0:R2# 

BGP

RP/0/0/CPU0:R5#show route 10.1.4.4/32
Tue Nov 12 12:24:39.372 UTC

Routing entry for 10.1.4.4/32
  Known via "bgp 5", distance 20, metric 0, [ei]-bgp, labeled unicast (3107), labeled SR
  Tag 4, type external
  Installed Nov  7 16:44:44.757 for 4d19h
  Routing Descriptor Blocks
    10.1.45.4, from 10.1.45.4, BGP external
      Route metric is 0
  No advertising protos. 
RP/0/0/CPU0:R5#show bgp ipv4 labeled-unicast 10.1.4.4/32
Tue Nov 12 12:25:15.710 UTC
BGP routing table entry for 10.1.4.4/32
Versions:
  Process           bRIB/RIB  SendTblVer
  Speaker                  7           7
    Local Label: 16004
Last Modified: Nov  7 16:44:44.269 for 4d19h
Paths: (1 available, best #1)
  Not advertised to any peer
  Path #1: Received by speaker 0
  Not advertised to any peer
  4
    10.1.45.4 from 10.1.45.4 (10.1.4.4)
      Received Label 3 
      Origin IGP, metric 0, localpref 100, valid, external, best, group-best, labeled-unicast
      Received Path ID 0, Local Path ID 1, version 7
      Origin-AS validity: (disabled)
      Prefix SID Attribute Size: 7
      Label Index: 4

Tags:

           

No comments

Comments feed for this article

Reply

Your email address will not be published.