Configuring Segment Routing
Configuring Segment Routing
Before you begin
Confirm that the following conditions are met before configuring segment routing.
-
The install feature-set mpls , feature-set mpls and feature mpls segment-routing commands should be present before configuring the segment-routing command.
-
If the global block is configured, the specified range is used. Otherwise, the default 16000 – 23999 range is used.
-
BGP now uses both set label-index <value> configuration and the new connected-prefix-sid-map CLI. In case of a conflict, the configuration in SR-APP is preferred.
Procedure
Command or Action | Purpose | |
---|---|---|
Step 1 |
configure terminal Example:
|
Enters global configuration mode. |
Step 2 |
segment-routing Example:
|
Enables the MPLS segment routing functionality. The no form of this command disables the MPLS segment routing feature. |
Step 3 |
connected-prefix-sid-map Example:
|
Configures the connected prefix segment identifier mappings. |
Step 4 |
global-block <min> <max> Example:
|
Specifies the global block range for the segment routing bindings. |
Step 5 |
connected-prefix-sid-map Example:
|
Configures the connected prefix segment identifier mappings. |
Step 6 |
address-family ipv4 Example:
|
Configures the IPv4 address family. |
Step 7 |
<prefix>/<masklen> [index|absolute ] <label> Example:
|
The optional keywords index or absolute indicate whether the label value entered should be interpreted as an index into the SRGB or as an absolute value. |
Example
See the following configuration examples of the show commands:
switch# show segment-routing mpls
Segment-Routing Global info
Service Name: segment-routing
State: Enabled
Process Id: 29123
Configured SRGB: 17000 – 24999
SRGB Allocation status: Alloc-Successful
Current SRGB: 17000 – 24999
Cleanup Interval: 60
Retry Interval: 180
The following CLI displays the clients that are registered with SR-APP. It lists the VRFs, for which the clients have registered interest.
switch# show segment-routing mpls clients
Segment-Routing Mpls Client Info
Client: isis-1
PIB index: 1 UUID: 0x41000118 PID: 29463 MTS SAP: 412
TIBs registered:
VRF: default Table: base
Client: bgp-1
PIB index: 2 UUID: 0x11b PID: 18546 MTS SAP: 62252
TIBs registered:
VRF: default Table: base
Total Clients: 2
In the show segment-routing mpls ipv4 connected-prefix-sid-map CLI command example, SRGB indicates whether the prefix SID is within the configured SRGB. The Indx field indicates that the configured label is an index into the global block. The Abs field indicates that the configured label is an absolute value.
If the SRGB field displays N, it means that the configured prefix SID is not within the SRGB range and it is not provided to the SR-APP clients. Only the prefix SIDs that fall into the SRGB range are given to the SR-APP clients.
switch# show segment-routing mpls ipv4 connected-prefix-sid-map
Segment-Routing Prefix-SID Mappings
Prefix-SID mappings for VRF default Table base
Prefix SID Type Range SRGB
13.11.2.0/24 713 Indx 1 Y
30.7.7.7/32 730 Indx 1 Y
59.3.24.0/30 759 Indx 1 Y
150.101.1.0/24 801 Indx 1 Y
150.101.1.1/32 802 Indx 1 Y
150.101.2.0/24 803 Indx 1 Y
1.1.1.1/32 16013 Abs 1 Y
The following CLI displays the show running-config segment-routing output.
switch# show running-config segment-routing ?
> Redirect it to a file
>> Redirect it to a file in append mode
all Show running config with defaults
| Pipe command output to filter
switch# show running-config segment-routing
switch# show running-config segment-routing
!Command: show running-config segment-routing
!Running configuration last done at: Thu Dec 12 19:39:52 2019
!Time: Thu Dec 12 20:06:07 2019
version 9.3(3) Bios:version 05.39
segment-routing
mpls
connected-prefix-sid-map
address-family ipv4
2.1.1.1/32 absolute 100100
switch#
Enabling MPLS on an Interface
You can enable MPLS on an interface for use with segment routing.
Before you begin
You must install and enable the MPLS feature set using the install feature-set mpls and feature-set mpls commands.
Procedure
Command or Action | Purpose | |
---|---|---|
Step 1 |
configure terminal Example:
|
Enters global configuration mode. |
Step 2 |
interface type slot/port Example:
|
Enters the interface configuration mode for the specified interface. |
Step 3 |
[no] mpls ip forwarding Example:
|
Enables MPLS on the specified interface. The no form of this command disables MPLS on the specified interface. |
Step 4 |
(Optional) copy running-config startup-config Example:
|
(Optional)
Copies the running configuration to the startup configuration. |
Configuring the Segment Routing Global Block
You can configure the beginning and ending MPLS labels in the segment routing global block (SRGB).
Before you begin
You must install and enable the MPLS feature set using the install feature-set mpls and feature-set mpls commands.
You must enable the MPLS segment routing feature.
Procedure
Command or Action | Purpose | |||
---|---|---|---|---|
Step 1 |
configure terminal Example:
|
Enters global configuration mode. |
||
Step 2 |
[no] segment-routing Example:
|
Enters the segment routing configuration mode and enables the default SRGB of 16000 to 23999. The no form of this command unallocates that block of labels. If the configured dynamic range cannot hold the default SRGB, an error message appears, and the default SRGB will not be allocated. If desired, you can configure a different SRGB in the next step. |
||
Step 3 |
[no] global-block beginning-label ending-label Example:
|
Specifies the MPLS label range for the SRGB. Use this command if you want to change the default SRGB label range that is configured with the segment-routing command. The permissive values for the beginning MPLS label and the ending MPLS label are from 16000 to 471804. The mpls label range command permits 16 as the minimum label, but the SRGB can start only from 16000.
|
||
Step 4 |
(Optional) show mpls label range Example:
|
(Optional)
Displays the SRGB, only if the SRGB allocation is successful. |
||
Step 5 |
show segment-routing |
Displays the configured SRGB. |
||
Step 6 |
show segment-routing mpls Example:
|
Displays the configured SRGB. |
||
Step 7 |
(Optional) copy running-config startup-config Example:
|
(Optional)
Copies the running configuration to the startup configuration. |
Configuring the Label Index
You can set the label index for routes that match the network command. Doing so causes the BGP prefix SID to be advertised for local prefixes that are configured with a route map that includes the set label-index command, provided the route map is specified in the network command that specifies the local prefix. (For more information on the network command, see the "Configuring Basic BGP" chapter in the Cisco Nexus 9000 Series NX-OS Unicast Routing Configuration Guide.)
Note |
Segment Routing Application (SR-APP) module is used to configure the segment routing functionality. BGP now uses both set label-index <value> configuration under route-map and the new connected-prefix-sid-map CLI for prefix SID configuration. In case of a conflict, the configuration in SR-APP is preferred. |
Note |
Route-map label indexes are ignored when the route map is specified in a context other than the network command. Also, labels are allocated for prefixes with a route-map label index independent of whether the prefix has been configured by the allocate-label route-map route-map-name command. |
Procedure
Command or Action | Purpose | |
---|---|---|
Step 1 |
configure terminal Example:
|
Enters global configuration mode. |
Step 2 |
route-map map-name Example:
|
Creates a route map or enters route-map configuration mode for an existing route map. |
Step 3 |
[no] set label-index index Example:
|
Sets the label index for routes that match the network command. The range is from 0 to 471788. By default, a label index is not added to the route. |
Step 4 |
exit Example:
|
Exits route-map configuration mode. |
Step 5 |
router bgp autonomous-system-number Example:
|
Enables BGP and assigns the AS number to the local BGP speaker. The AS number can be a 16-bit integer or a 32-bit integer in the form of a higher 16-bit decimal number and a lower 16-bit decimal number in xx.xx format. |
Step 6 |
address-family ipv4 unicast Example:
|
Enters global address family configuration mode for the IPv4 address family. |
Step 7 |
network ip-prefix [route-map map-name] Example:
|
Specifies a network as local to this autonomous system and adds it to the BGP routing table. |
Step 8 |
(Optional) show route-map [map-name] Example:
|
(Optional)
Displays information about route maps, including the label index. |
Step 9 |
(Optional) copy running-config startup-config Example:
|
(Optional)
Copies the running configuration to the startup configuration. |
Configuration Examples for Segment Routing
The examples in this section show a common BGP prefix SID configuration between two routers.
This example shows how to advertise a BGP speaker configuration of 10.10.10.10/32 and 20.20.20.20/32 with a label index of 10 and 20, respectively. It uses the default segment routing global block (SRGB) range of 16000 to 23999.
hostname s1
install feature-set mpls
feature-set mpls
feature telnet
feature bash-shell
feature scp-server
feature bgp
feature mpls segment-routing
segment-routing
mpls
vlan 1
segment-routing
mpls
connected-prefix-sid-map
address-family ipv4
2.1.1.1/32 absolute 100100
route-map label-index-10 permit 10
set label-index 10
route-map label-index-20 permit 10
set label-index 20
vrf context management
ip route 0.0.0.0/0 10.30.108.1
interface Ethernet1/1
no switchport
ip address 10.1.1.1/24
no shutdown
interface mgmt0
ip address dhcp
vrf member management
interface loopback1
ip address 10.10.10.10/32
interface loopback2
ip address 20.20.20.20/32
line console
line vty
router bgp 1
address-family ipv4 unicast
network 10.10.10.10/32 route-map label-index-10
network 20.20.20.20/32 route-map label-index-20
allocate-label all
neighbor 10.1.1.2 remote-as 2
address-family ipv4 labeled-unicast
This example shows how to receive the configuration from a BGP speaker.
hostname s2
install feature-set mpls
feature-set mpls
feature telnet
feature bash-shell
feature scp-server
feature bgp
feature mpls segment-routing
segment-routing mpls
vlan 1
vrf context management
ip route 0.0.0.0/0 10.30.97.1
ip route 0.0.0.0/0 10.30.108.1
interface Ethernet1/1
no switchport
ip address 10.1.1.2/24
ipv6 address 10:1:1::2/64
no shutdown
interface mgmt0
ip address dhcp
vrf member management
interface loopback1
ip address 2.2.2.2/32
line console
line vty
router bgp 2
address-family ipv4 unicast
allocate-label all
neighbor 10.1.1.1 remote-as 1
address-family ipv4 labeled-unicast
This example shows how to display the configuration from a BGP speaker. The show command in this example displays the prefix 10.10.10.10 with label index 10 mapping to label 16010 in the SRGB range of 16000 to 23999.
switch# show bgp ipv4 labeled-unicast 10.10.10.10/32
BGP routing table information for VRF default, address family IPv4 Label Unicast
BGP routing table entry for 10.10.10.10/32, version 7
Paths: (1 available, best #1)
Flags: (0x20c001a) on xmit-list, is in urib, is best urib route, is in HW, , has label
label af: version 8, (0x100002) on xmit-list
local label: 16010
Advertised path-id 1, Label AF advertised path-id 1
Path type: external, path is valid, is best path, no labeled nexthop, in rib
AS-Path: 1 , path sourced external to AS
10.1.1.1 (metric 0) from 10.1.1.1 (10.10.10.10)
Origin IGP, MED not set, localpref 100, weight 0
Received label 0
Prefix-SID Attribute: Length: 10
Label Index TLV: Length 7, Flags 0x0 Label Index 10
Path-id 1 not advertised to any peer
Label AF advertisement
Path-id 1 not advertised to any peer
This example shows how to configure egress peer engineering on a BGP speaker.
hostname epe-as-1
install feature-set mpls
feature-set mpls
feature telnet
feature bash-shell
feature scp-server
feature bgp
feature mpls segment-routing
segment-routing mpls
vlan 1
vrf context management
ip route 0.0.0.0/0 10.30.97.1
ip route 0.0.0.0/0 10.30.108.1
interface Ethernet1/1
no switchport
ip address 10.1.1.1/24
no shutdown
interface Ethernet1/2
no switchport
ip address 11.1.1.1/24
no shutdown
interface Ethernet1/3
no switchport
ip address 12.1.1.1/24
no shutdown
interface Ethernet1/4
no switchport
ip address 13.1.1.1/24
no shutdown
interface Ethernet1/5
no switchport
ip address 14.1.1.1/24
no shutdown
The following is an example of show ip route vrf 2 command.
show ip route vrf 2
IP Route Table for VRF "2"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%<string>' in via output denotes VRF <string>
41.11.2.0/24, ubest/mbest: 1/0
*via 1.1.1.9%default, [20/0], 13:26:48, bgp-2, external, tag 11 (mpls-vpn)
42.11.2.0/24, ubest/mbest: 1/0, attached
*via 42.11.2.1, Vlan2, [0/0], 13:40:52, direct
42.11.2.1/32, ubest/mbest: 1/0, attached
*via 42.11.2.1, Vlan2, [0/0], 13:40:52, local
The following is an example of show forwarding route vrf 2 command.
slot 1
=======
IPv4 routes for table 2/base
------------------+-----------------------------------------+----------------------+-----------------+-----------------
Prefix | Next-hop | Interface | Labels | Partial Install
------------------+-----------------------------------------+----------------------+-----------------+-----------------
0.0.0.0/32 Drop Null0
127.0.0.0/8 Drop Null0
255.255.255.255/32 Receive sup-eth1
*41.11.2.0/24 27.1.31.4 Ethernet1/3 PUSH 30002 492529
27.1.32.4 Ethernet1/21 PUSH 30002 492529
27.1.33.4 port-channel23 PUSH 30002 492529
27.11.31.4 Ethernet1/3.11 PUSH 30002 492529
27.11.33.4 port-channel23.11 PUSH 30002 492529
37.1.53.4 Ethernet1/53/1 PUSH 29002 492529
37.1.54.4 Ethernet1/54/1 PUSH 29002 492529
37.2.53.4 Ethernet1/53/2 PUSH 29002 492529
37.2.54.4 Ethernet1/54/2 PUSH 29002 492529
80.211.11.1 Vlan801 PUSH 30002 492529
The following is an example of show bgp l2vpn evpn summary command.
show bgp l2vpn evpn summary
BGP summary information for VRF default, address family L2VPN EVPN
BGP router identifier 2.2.2.3, local AS number 2
BGP table version is 17370542, L2VPN EVPN config peers 4, capable peers 1
1428 network entries and 1428 paths using 268464 bytes of memory
BGP attribute entries [476/76160], BGP AS path entries [1/6]
BGP community entries [0/0], BGP clusterlist entries [0/0]
476 received paths for inbound soft reconfiguration
476 identical, 0 modified, 0 filtered received paths using 0 bytes
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
1.1.1.1 4 11 0 0 0 0 0 23:01:53 Shut (Admin)
1.1.1.9 4 11 4637 1836 17370542 0 0 23:01:40 476
1.1.1.10 4 11 0 0 0 0 0 23:01:53 Shut (Admin)
1.1.1.11 4 11 0 0 0 0 0 23:01:52 Shut (Admin)
The following is an example of show bgp l2vpn evpn command.
show bgp l2vpn evpn 41.11.2.0
BGP routing table information for VRF default, address family L2VPN EVPN
Route Distinguisher: 14.1.4.1:115
BGP routing table entry for [5]:[0]:[0]:[24]:[41.11.2.0]:[0.0.0.0]/224, version 17369591
Paths: (1 available, best #1)
Flags: (0x000002) on xmit-list, is not in l2rib/evpn, is not in HW
Advertised path-id 1
Path type: external, path is valid, received and used, is best path
Imported to 2 destination(s)
AS-Path: 11 , path sourced external to AS
1.1.1.9 (metric 0) from 1.1.1.9 (14.1.4.1)
Origin incomplete, MED 0, localpref 100, weight 0
Received label 492529
Extcommunity: RT:2:20
Path-id 1 not advertised to any peer
Route Distinguisher: 2.2.2.3:113
BGP routing table entry for [5]:[0]:[0]:[24]:[41.11.2.0]:[0.0.0.0]/224, version 17369595
Paths: (1 available, best #1)
Flags: (0x000002) on xmit-list, is not in l2rib/evpn, is not in HW
Advertised path-id 1
Path type: external, path is valid, is best path
Imported from 14.1.4.1:115:[5]:[0]:[0]:[24]:[41.11.2.0]:[0.0.0.0]/224
AS-Path: 11 , path sourced external to AS
1.1.1.9 (metric 0) from 1.1.1.9 (14.1.4.1)