Segment Routing Implementation
Basic Concepts
Segment routing domain: is a set of SR nodes.
Segment ID (SID): uniquely identifies a segment. A SID is mapped to an MPLS label on the forwarding plane.
SRGB: A segment routing global block (SRGB) is a set of local labels reserved for segment routing of users.
Segment Category
Label |
Generation Mode |
Function |
---|---|---|
Prefix segment |
Manually configured. |
A prefix segment identifies the prefix of a destination address. An IGP floods a prefix segment to the other network elements. The prefix segment is visible globally and takes effect globally. A prefix segment is identified by the prefix SID. A prefix SID is an offset within the SRGB range and advertised by a source node. The receive end uses the local SRGB to compute label values to generate MPLS forwarding entries. The node segment, a special prefix segment, identifies a specific node. When an IP address is configured for a loopback interface of a node, the prefix SID is the node SID. |
Adjacency segment |
Allocated by the ingress node using a dynamic protocol. |
An adjacency segment identifies an adjacency on a network. An IGP floods an adjacency segment to the other network elements. The adjacency segment is visible globally and takes effect locally. An adjacency segment is identified by the adjacency SID. The adjacency SID is a local SID out of the SRGB range. |
In simple words, a prefix segment indicates a destination address, and an adjacency segment indicates a link over which data packets travel. The prefix and adjacency segments are similar to the destination IP address and outbound interface, respectively, in conventional IP forwarding. In an IGP domain, an NE floods the node SID and adjacency SID of itself by using an extended IGP message, so that any NE can obtain information of other network elements.
Combining prefix (node) SIDs and adjacency SIDs in sequence can construct any network path. Every hop on a path identifies a next hop based on the segment information on the top of the label stack. The segment information is stacked in sequence at the top of the data header. If segment information at the stack top contains the identifier of another node, the receive end forwards a data packet to the next hop using ECMP. If segment information at the stack top identifies the local node, the receive end removes the top segment and proceeds with the follow-up procedure.
In actual application, the prefix segment, adjacency segment, and node segment can be used independently or in combinations. The following three main cases are involved.
Prefix Segment
If multiple paths have the same cost, they perform ECMP. If they have different costs, they perform link backup. Therefore, prefix segment-based forwarding path is not a fixed path, and the ingress node cannot control the entire packet forwarding path.
Adjacency Segment
Adjacency Segment + Node Segment
SR Forwarding Mechanism
SR can be used directly in the MPLS architecture, where the forwarding mechanism remains unchanged. SIDs are encoded as MPLS labels. The segment list is encoded as a label stack. The segment to be processed is at the stack top. Once a segment is processed, its label is removed from a label stack.
Label Conflicts and Handling Rules
Prefix segments are manually configured. These settings on different devices may conflict with one another. Label conflicts are divided as follows:
Prefix conflict: The same prefix is associated with two different SIDs.
SID conflict: The same SID is associated with different prefixes.
- A prefix with a larger mask is preferred.
- The prefix of a smaller value is preferred.
- A smaller SID is preferred.
- a. 1.1.1.1/32 1
- b. 1.1.1.1/32 2
- c. 2.2.2.2/32 3
- d. 3.3.3.3/32 1
- Prefix conflicts are handled first. Routes a and b lead to a prefix conflict. Route a has a smaller SID than route b, so route a is preferred. After the conflict is handled, the following three routes are selected:
- a. 1.1.1.1/32 1
- c. 2.2.2.2/32 3
- d. 3.3.3.3/32 1
- SID conflicts are handled then. Routes a and d lead to a SID conflict. Route a has a smaller prefix than route d, so route a is preferred. After the conflict is handled, the following two routes are selected:
- a. 1.1.1.1/32 1
- c. 2.2.2.2/32 3