When networks are getting deeper and deeper into our everyday work life, they have become more and more complex. Opposed to traditional networks, their functionalities are wider and wider, which challenge the principles existed. Today’s networks demand better performance, scalability, flexibility, better operational cost efficiency and maximize link capacities. All the requirements force the network to have certain automation and can be managed by a centralized controller. This idea of managing the network is call software-defined-network (SDN). Among many SDN solutions, Segment Routing (SR) is a part that can be easily integrated into current systems.
SR shares a lot of characteristics with MPLS. To understand SR, we need to first understand the traditional IP routing and then MPLS. In IP routing, routing protocols find the best path between a pair of the source and the destination, such protocols as OSPF, ISIS, RIP, BGP etc. The best is defined as a path with the minimal cost, which can be hops in RIP, calculated metrics in OSPF and ISIS, and combined criteria in BGP.
For example, in the following network, where numbers represent costs of links. When a package sent from R1 to R7, routing protocols will choose the path consisted of R1-R5-R3-R4-R7, whose total cost is 14.
The result of the best path is consistent although each router has only a partial knowledge of the network and there are differences between how the protocols work. This eventually leads to some issues in the network:
Multiprotocol Label Switching (MPLS) is created to fix up the issues, which has inherited a number of concepts from ATM technologies. As its name suggested, its a forwarding mechanism based on labels. Labels are numbers created and managed by routers to determine outgoing interfaces. When a label arrives a router, it is swapped by an outgoing label and a packet is forwarded to the next device. There are two types of routers in an MPLS environment, which is different from IP routing: Label Edge Router (LER) and Label Switching Router (LSR). In an MPLS-enabled environment, edge routers are LERs, where MPLS begins and ends, and all other intermediates are LSRs. In a MPLS-VPN environment, LERs are also called PEs which perform IP routing lookups, while LSRs are called Ps which only perform label lookups for labeled packets in and out: When A packet arrives, LER looks up its label forwarding table, where a label is bound to the destination network. Then the label is attached to the packet and is forwarded to the next hop. When the labeled packet arrives at an LSR, the LSR searches its Label forwarding table to determine which label should be swapped with and which interface is its outgoing interface. This process repeats until the packet reaches an LER, where the label is removed and is forwarded to the destination. The path set up in this way is called Label Switching Path (LSP), which is usually determined by LDP and IGP. This is similar to IP routing, but there’s the other way to define the path.
RSVP-TE can help If there’s a need to change the default paths generated by IGPs and LDPs, we typically call this Traffic Engineering (TE). The ability to implement TE is one of the biggest advantages of using MPLS. Let’s use the example topology to demonstrate it.
As mentioned before, the default path from R1 to R7 is R1-R5-R3-R4-R7 (shown as the black arrow), this is also true when MPLS is enabled on all devices. If there is a congestion from R5 to R3 (shown as red dots), we can assign alternative paths with RSVP-TE, like R1-R2-R3-R4-R7 (green path) and R1-R5-R6-R7 (blue path), which ensures there are enough resources along the path and distributes labels. MPLS solved the problem of controlling forwarding paths in a pure IP network, but the cost of maintaining control planes in complex MPLS networks is high. This cost makes TE impractical in some cases if we don’t have a better solution.
A better way is to connect all devices to a centralized control plane with a common protocol, which makes the infrastructure more programmable and scalable. Here comes the segment routing architecture, which may be more scalable, flexible, and less complex than IP or MPLS networks. In an SR-enabled network, packet forwarding is done by segments, which are exactly path packets should follow in a network. Taking the topology as the example, each router has a nodal ID and adjacency IDs are also established between routers. These IDs are used to determine the outgoing interface for the next hop. After exchanging IDs through IGPs, each router knows all the IDs in the network. When a packet arrives at R1, the ingress node appends an SR header to it, which is a stack of labels (segments). This stack indicates how the package should be forwarded to its destination.
As shown in the above topology, each router and link is assigned with a tag. When a packet with a stack of tags shown in the bottom-left, it follows a path that shown in the order of tags from top to bottom. Unlike RSVP and LDP, SR requires no MPLS control plane signaling and imposes no changes to the MPLS data plane. SR requires only ingress label edge routers to keep state. State management requirements from the midpoint (label switch routers) and tail end (egress label edge routers) are removed. This allows SR to scale significantly better than RSVP-TE while providing most of the same functions: IGP-based MPLS tunnels for services, fast-reroute with a pre-computed path and ability to use a combination of loose/strict route control.