SR ISIS
1
router isis 1
2
is-type level-2-only
3
net 49.0000.0000.0001.00
4
address-family ipv4 unicast
5
metric-style wide
6
segment-routing mpls
7
!
8
interface Loopback0
9
address-family ipv4 unicast
10
prefix-sid index 1
11
!
SR OSPF
1
router ospf 1
2
router-id 10.1.2.2
3
segment-routing mpls
4
redistribute isis 1 route-policy Loopback
5
address-family ipv4 unicast
6
area 0
7
interface Loopback0
8
passive enable
9
prefix-sid index 2
SR BGP
1
route-policy SID($SID)
2
set label-index $SID
3
end-policy
4
!
5
router bgp 4
6
bgp router-id 10.1.4.4
7
address-family ipv4 unicast
8
network 10.1.4.4/32 route-policy SID(4)
9
allocate-label all
10
!
11
neighbor 10.1.45.5
12
remote-as 5
13
address-family ipv4 labeled-unicast
14
route-policy pass in
15
route-policy pass out
16
!
17
!
18
!
SR 路由重分发案例
使用router-policy只重分发Loopback (/32 prefix)。
1
route-policy Loopback
2
if destination in (0.0.0.0/0 eq 32) then
3
pass
4
else
5
drop
6
endif
7
end-policy
8
9
address-family ipv4 unicast
10
redistribute xx 1 route-policy Loopback
ISIS
1
RP/0/0/CPU0:R1#show isis database R2.00-00 detail verbose
2
Tue Nov 12 12:26:08.786 UTC
3
4
IS-IS 1 (Level-2) Link State Database
5
LSPID LSP Seq Num LSP Checksum LSP Holdtime/Rcvd ATT/P/OL
6
R2.00-00 0x0000021a 0x9162 380 /1199 0/0/0
7
Area Address: 49
8
Metric: 10 IS-Extended R1.00
9
Interface IP Address: 10.1.12.2
10
Neighbor IP Address: 10.1.12.1
11
Link Maximum SID Depth:
12
Subtype: 1, Value: 10
13
ADJ-SID: F:0 B:0 V:1 L:1 S:0 P:0 weight:0 Adjacency-sid:24001
14
NLPID: 0xcc
15
IP Address: 10.1.2.2
16
Metric: 10 IP-Extended 10.1.2.2/32
17
Prefix-SID Index: 2, Algorithm:0, R:0 N:1 P:0 E:0 V:0 L:0
18
Prefix Attribute Flags: X:0 R:0 N:1
19
Metric: 0 IP-Extended 10.1.3.3/32
20
Prefix-SID Index: 3, Algorithm:0, R:1 N:0 P:1 E:0 V:0 L:0
21
Prefix Attribute Flags: X:1 R:0 N:0
22
Metric: 0 IP-Extended 10.1.4.4/32
23
Prefix-SID Index: 4, Algorithm:0, R:1 N:0 P:1 E:0 V:0 L:0
24
Prefix Attribute Flags: X:1 R:0 N:0
25
Metric: 10 IP-Extended 10.1.12.0/24
26
Prefix Attribute Flags: X:0 R:0 N:0
27
Metric: 0 IP-Extended 10.1.5.5/32
28
Prefix-SID Index: 5, Algorithm:0, R:1 N:0 P:1 E:0 V:0 L:0
29
Prefix Attribute Flags: X:1 R:0 N:0
30
Hostname: R2
31
Router Cap: 10.1.2.2, D:0, S:0
32
Segment Routing: I:1 V:0, SRGB Base: 16000 Range: 8000
33
SR Algorithm:
34
Algorithm: 0
35
Algorithm: 1
36
Node Maximum SID Depth:
37
Subtype: 1, Value: 10
OSPF
1
RP/0/0/CPU0:R2#show ospf database opaque-as 7.0.0.1
2
Tue Nov 12 12:32:53.108 UTC
3
4
5
OSPF Router with ID (10.1.2.2) (Process ID 1)
6
7
Type-11 Opaque Link AS Link States
8
9
LS age: 651
10
Options: (No TOS-capability, DC)
11
LS Type: Opaque AS Link
12
Link State ID: 7.0.0.1
13
Opaque Type: 7
14
Opaque ID: 1
15
Advertising Router: 10.1.2.2
16
LS Seq Number: 800000d0
17
Checksum: 0x9b12
18
Length: 44
19
20
Extended Prefix TLV: Length: 20
21
Route-type: 5
22
AF : 0
23
Flags : 0x0
24
Prefix : 10.1.1.1/32
25
26
SID sub-TLV: Length: 8
27
Flags : 0x40
28
MTID : 0
29
Algo : 0
30
SID Index : 1
31
32
LS age: 359
33
Options: (No TOS-capability, DC)
34
LS Type: Opaque AS Link
35
Link State ID: 7.0.0.1
36
Opaque Type: 7
37
Opaque ID: 1
38
Advertising Router: 10.1.4.4
39
LS Seq Number: 800000d0
40
Checksum: 0x5647
41
Length: 44
42
43
Extended Prefix TLV: Length: 20
44
Route-type: 5
45
AF : 0
46
Flags : 0x0
47
Prefix : 10.1.5.5/32
48
49
SID sub-TLV: Length: 8
50
Flags : 0x40
51
MTID : 0
52
Algo : 0
53
SID Index : 5
54
55
RP/0/0/CPU0:R2#
BGP
1
RP/0/0/CPU0:R5#show route 10.1.4.4/32
2
Tue Nov 12 12:24:39.372 UTC
3
4
Routing entry for 10.1.4.4/32
5
Known via "bgp 5", distance 20, metric 0, [ei]-bgp, labeled unicast (3107), labeled SR
6
Tag 4, type external
7
Installed Nov 7 16:44:44.757 for 4d19h
8
Routing Descriptor Blocks
9
10.1.45.4, from 10.1.45.4, BGP external
10
Route metric is 0
11
No advertising protos.
12
RP/0/0/CPU0:R5#show bgp ipv4 labeled-unicast 10.1.4.4/32
13
Tue Nov 12 12:25:15.710 UTC
14
BGP routing table entry for 10.1.4.4/32
15
Versions:
16
Process bRIB/RIB SendTblVer
17
Speaker 7 7
18
Local Label: 16004
19
Last Modified: Nov 7 16:44:44.269 for 4d19h
20
Paths: (1 available, best #1)
21
Not advertised to any peer
22
Path #1: Received by speaker 0
23
Not advertised to any peer
24
4
25
10.1.45.4 from 10.1.45.4 (10.1.4.4)
26
Received Label 3
27
Origin IGP, metric 0, localpref 100, valid, external, best, group-best, labeled-unicast
28
Received Path ID 0, Local Path ID 1, version 7
29
Origin-AS validity: (disabled)
30
Prefix SID Attribute Size: 7
31
Label Index: 4
This Blog From Xuxing's Blog;