# Patent

## Title
MPLS segment-routing

## Abstract

MPLS segment routing is disclosed. In one embodiment, a first core router generates a first data structure that maps first portcodes to respective identities of first neighbor routers or respective first links, wherein the first portcodes identify respective first ports of the first core router, and wherein the first ports are coupled to the first neighbor routers, respectively, via the first links, respectively. The first core router generates and transmits a first link-state packet, wherein the first link-state packet comprises an identity of the first core router and the first data structure.

## Background
RELATED APPLICATION
The present patent application is a continuation of U.S. patent application Ser. No. 13/760,155, filed on Feb. 6, 2013, now U.S. Pat. No. 9,049,233 issued on Jun. 2, 2015, entitled “MPLS Segment-Routing” which is incorporated by reference herein in its entirety and for all purposes as if completely and fully set forth herein and which claims domestic benefit under Title 35 of the United States Code §119(e) of U.S. Provisional Patent Application Ser. No. 61/710,121, entitled “Method For Using Chain Routing,” filed Oct. 5, 2012, and which names Daniel C. Frost, Stewart F. Bryant, and Clarence Filsfils as the inventors.


BACKGROUND
In computer networking, a packet is a formatted unit of data carried by a network. A packet typically consists of two kinds of data: control and payload. The control data provides information the network needs to deliver the packet, for example: source and destination addresses, error detection codes like checksums, and sequencing information. Typically, control data is found in packet headers and trailers, with payload data in between.
A router is a device that forwards packets within or between networks. A router can connect to two or more data lines from different networks. When a data packet arrives via one of the lines, the router can read address information in the packet to determine its ultimate destination. Then, using information in a routing table or routing policy, the router can direct the packet towards its destination.



BRIEF DESCRIPTION OF THE DRAWINGS
The present disclosure may be better understood, and its numerous objects, features, and advantages made apparent to those skilled in the art by referencing the accompanying drawings.
FIG. 1 is a block diagram illustrating an example network.
FIG. 2 is a block diagram illustrating an example router that can be employed in the network of FIG. 1.
FIG. 3 is a block diagram illustrating an example of another router that can be employed in the network of FIG. 1.
FIG. 4 illustrates an example set of paths calculated by the router of FIG. 3.
FIG. 5 is a flow chart illustrating certain aspects of a process implemented by a router such as that shown in FIG. 3.
FIG. 6 is a block diagram illustrating certain components of an example router that can be employed in the network of FIG. 1.



DETAILED DESCRIPTION
Overview
MPLS segment routing is disclosed. In one embodiment, a first core router generates a first data structure that maps first portcodes to identities of respective first neighbor routers or respective first links. The first portcodes identify respective first ports of the first core router, and the first ports are coupled to the first neighbor routers, respectively, via the first links, respectively. The first core router generates and transmits a first link-state packet that comprises an identity of the first core router and the first data structure.
Routing
Routing is a process for forwarding network traffic (e.g., packets) to destinations. Routing is performed in many kinds of networks. In Multiprotocol Label Switching (MPLS) networks, packet routing usually follows one of two basic paradigms: routing based on a destination Internet Protocol (IP) address using information in an IP routing or forwarding table, or routing based on following an explicit path through the network that was constructed, for example, via traffic engineering extensions to the Resource Reservation Protocol (RSVP-TE).
This disclosure describes a method for directing a packet along a specific path in an MPLS enabled network, it being understood the claims below should not be limited to use in MPLS enabled networks. Further, the method described in this disclosure can direct a packet along a specific path without requiring a RSVP-TE created, pre-existing traffic-engineered path.
The method may provide a variety of advantages. For example, the method described herein may be advantageous when used in conjunction with Operations, Administration, and Maintenance (OAM) operations in MPLS enabled networks that are subject to Equal Cost Multipath (ECMP) load balancing. ECMP is a routing strategy where next-hop packet forwarding to a single destination can occur over multiple “best paths” which tie for top place in routing metric calculations. In an MPLS enabled network, which is subject to behavior in which traffic transmitted between node A and node B may traverse multiple paths between A and B due to ECMP load-balancing, implementation of OAM operations may be challenging. OAM operations, which are designed to monitor or measure path variables such as packet loss or transmission delay, may be frustrated by ECMP since there may be no way to specify a path that an OAM packet follows without creating a traffic-engineered tunnel for the OAM packet.
Routing Tables
Routing tables can be used in MPLS enabled networks to forward packets. Routing tables may be stored in network nodes such as routers, and list the routes to particular destinations, and in some cases, metrics (e.g., distances) associated with those routes. For purposes of explanation only, network nodes are described herein primarily as routers. However, a network node may include any suitable combination of one or more routers, one or more bridges, one or more switches, and any other suitable communications processing devices.
The construction of routing tables is one of the primary goals of routing protocols. There are many types of routing protocols. Interior gateway protocol (IGP) is a routing protocol that exchanges routing information within an autonomous system for the purpose of creating routing tables. In contrast, the exterior gateway protocol (EGP) is used for determining network reachability between autonomous systems, but makes use of IGP. An autonomous system is a single routing domain, such as a network, controlled by one individual or organization.
IGP can be divided into several categories, one of which is the link-state routing protocol. The basic concept behind the link-state routing protocol, such as the intermediate system to intermediate system (IS-IS), is that every router constructs a topological map of network connectivity in the form of a graph, showing which routers are connected to which other routers. Each router can use its map to independently calculate the best logical path from it to every possible destination in the network. The collection of best paths will then form the routing table.
Construction of a routing table may be achieved through several steps. First, each router identifies its neighbor routers, or the routers that are directly connected to it over fully functioning communication links. A router may accomplish this using a simple reachability protocol that it runs separately with each of its directly connected neighbor routers. Next, each router periodically and in case of connectivity changes, creates a short message called a link-state packet that identifies the router and all other routers to which it is directly connected. The link-state packet may also include a sequence number, which increases every time the router generates a new version of a link-state packet. Once created, the link-state packet is flooded throughout the network.
Each router in the network may remember, for every other router in the network, the sequence number of the last link-state packet the router receives. When a link-state packet is received, the router looks up the sequence number the router has stored for the advertising router (i.e., the router that originally created the link-state packet, the identity of which is contained in the link-state packet). If this link-state packet is newer than what is saved, a copy is forwarded to each of that router's neighbors. This procedure rapidly gets a copy of the latest version of each router's link-state packet to every router in the network.
With a complete set of link-state packets, a router can produce a map of the network. The algorithm for this process simply iterates over information contained in the collection of link-state packets; for each one, the algorithm makes links on the map of the network, from the router that sent that link-state packet, to all the routers the packet indicates are directly coupled neighbors. Once each router knows about all the other routers and the links connecting them, it can run a Dijkstra Shortest Path First algorithm to determine and record the shortest path from itself to all the other routers. This process may also include producing a routing table.
MPLS
In contrast to IP, which forwards packets based on network addresses and routing tables, MPLS forwards packets from one router to the next based on short path-labels (hereinafter labels). It is noted that MPLS enabled routers can receive and transmit an IP packet (non-MPLS) using routing tables.
MPLS networks can transmit packets via a label switched path (LSP). Packets can enter an MPLS network via an ingress label switch router (LSR), travel along an LSP of one or more core LSRs, and exit via an egress LSR. In general, ingress LSRs of MPLS networks assign labels to incoming data packets. When assigning a label to an incoming packet, the ingress LSR may look at information (e.g., the source and/or group address) of the packet's IP header and also some other information such as the interface at which the packet arrived, to determine the appropriate label to assign. Ingress LSRs may classify each packet potentially using a range of attributes, not just the packet's destination address, to determine which LSP to use. Labeled packets are forwarded downstream along an LSP that may include several core LSRs, each of which decides which way to forward a packet based on the label attached to the packet it receives. More particularly, LSRs can use label information base (LIB) tables to map the label of the packet it receives to an outgoing label and an outgoing interface. This may allow the use of very fast and simple forwarding engines, which are often implemented in hardware. The LSR swaps the label of the packet with the mapped outgoing label, which tells the next-hop LSR in the LSP how to forward the packet. The packet is transmitted to the next-hop LSR via the outgoing interface that is also identified in the LIB. The LSRs forward the packet in a hop-by-hop fashion until the packet reaches an egress LSR. In this fashion, LSRs make forwarding decisions based on a label. Since MPLS uses the label to forward packets, it is protocol-independent, hence the term “Multi-Protocol” in MPLS. MPLS may be used to carry any content (not only packets).
There are two major standardized control protocols for managing MPLS paths: Label Distribution Protocol (LDP) and RSVP-TE, an extension of the resource reservation protocol (RSVP) for traffic engineering. Unfortunately, creation of LSPs through an MPLS network using LDP or RSVP-TE can be computationally expensive.
LDP is a protocol defined by the IETF (RFC 5036) for the purpose of distributing labels in an MPLS environment. In LDP, two routers with an established session are called LDP peers, and they exchange information including locally relevant MPLS labels. LDP relies on the underlying routing tables provided by IGP. Unlike TE paths, which use constraints and explicit routes to establish end-to-end LSPs, LDP is used for signaling best effort LSPs. While the path created using LDP or RSVP-TE can be employed to move packets through an MPLS network, the entire path through the network is not necessarily known by the ingress LSR when the ingress LSR receives a packet for forwarding. Rather, the ingress LSR may simply know that the packet it receives will reach a destination egress LSR if the appropriate label is attached to it.
Segment Routing
Segment routing specifies a path that a packet will take through a network using a stack of portcodes. In one embodiment of segment routing, a packet is encapsulated with a header that includes a stack of portcodes. The packet and header can be forwarded through a network by popping off the top most portcode from the stack at each hop, and forwarding the packet with header to the next hop via the exit port of the router that is mapped to the popped portcode. The following describes how portcode stacks may be created and used in greater detail.
FIG. 1 illustrates in block diagram form relevant components of an example MPLS enabled network 102 that can transmit packets using segment routing. For purposes of explanation, each router in network 102 employs MPLS and IGP or modified versions thereof. For ease of illustration, each router in FIG. 1 is referred to as an LSR. It should be understood that the term network should not be limited to that shown within FIG. 1. Networks may be significantly more complex than the example shown in FIG. 1.
Each of the LSRs of network 102 is assigned an identity (e.g., an IP address). Core LSRs in FIG. 1 are identified as A-D, while edge LSRs are identified as X and Y. Each router has a plurality of interfaces or ports that are coupled to communication links. Each of the ports is associated with a portcode. For example, core LSR A includes at least three ports associated with portcodes “1,” “3,” and “7.” Two ports of core LSR A are coupled to core LSR C via separate communication links and assigned portcodes “1” and “3.” In one embodiment, the portcodes may take form in 20-bit MPLS labels generated within the routers.
As shown in FIG. 1, edge LSRs X and Y are in data communication with routers 104 and 106, respectively, which are external to network 102. In this configuration, edge LSR X can receive data packets from a source S (e.g., a server) via router 104. These packets are ultimately destined for receiver R (e.g., a desktop computer) via router 106. Edge LSR X can transmit these data packets it receives to edge LSR Y via a path selected by edge LSR X that goes through two or more core LSRs. This path may be predetermined, or the path may be calculated on the fly, i.e., when edge LSR X receives the packet. Edge LSR X may also be capable of generating OAM packets for transmission to other LSRs in network 102 including edge LSR Y, for example, in order to measure or monitor specific paths within network 102. LSR X can attach a stack of portcodes to the packets that corresponds to the selected path. The portcode stack may be predetermined or the portcode stack may be calculated on the fly, i.e., when LSR X receives the packet. As will be more fully described, the stack of portcodes tells the LSRs in the path how to route the packet to the destination LSR.
FIG. 2 illustrates in block diagram form certain components of an example core LSR 200 within network 102. Core LSR 200 includes a plurality of ports 202 that are coupled to neighbor LSRs via functioning communication links. Each port 202 is identified by a respective portcode. In the embodiment shown, core LSR 200 also includes an IGP manager 204 in data communication with a packet forwarding engine 206. Each of IGP manager 204 and packet forwarding engine 206 may be implemented using a suitable combination of hardware, firmware, and software. In one embodiment, each of IGP manager 204 and packet forwarding engine 206 may be implemented using instructions executing on one or more processors of core LSR 200. It is note that core LSR 200 may include additional components, such as a network topology generator.
IGP manager 204 may be configured to generate link-state packets similar to the link state packets described above. These link-state packets can be used to flood the network 102 with core LSR 200 related information, including a table or other data object that maps portcodes to neighbor LSR identities (e.g., IP addresses or other identities) or the communication links therebetween. For purposes of explanation only, it will be presumed that the portcodes are mapped to neighbor LSRs or to the links to neighbor LSRs, it being understood that the claims below should not be limited thereto. LSRs in network 102 can use the mappings between portcodes and neighbor LSR identities to create portcode stacks as will be more fully described below.
IGP manager 204 may be capable of implementing a reachability protocol to identify neighbor LSRs (i.e., LSRs directly coupled by a functioning communication link via a respective port 202). Once the neighbor LSRs are identified, IGP manager 204 maps the neighbor LSRs' identities (e.g., IP addresses) to portcodes, respectively, for the ports 202, respectively, through which the respective neighbor LSRs can be reached. Thereafter, IGP manager 204 may create a link-state packet that contains a table or other object that maps the identities of the neighbor LSRs to respective portcodes. This link-state packet should also include the identity (e.g., IP address) of core LSR 200. Additional information may be contained in the link state packet. For example, the link state packet may contain a sequence number that is incremented each time IGP manager 204 generates a link-state packet. Additionally, the link-state packet may also contain a separate list of identities for the reachable neighbor LSRs, which may be used to create a topology map. Eventually, IGP manager 204 may flood network 102 with the link-state packet. In one embodiment, the link-state packet can be flooded via the forwarding engine 206.
FIG. 3 illustrates certain components of the example edge LSR X shown within FIG. 1. The LSR shown in FIG. 3 is just one example of edge LSRs that can be employed in a network. LSR X includes an IGP manager 304, which may be implemented using any suitable combination of hardware, firmware, and software. For example, LSR X may be implemented using software instructions executing on one or more processors. The IGP manager 304 may operate according to many of the principles of IGP described above. IGP manager 304 is capable of receiving link-state packets from other LSRs of network 102 via ports 302. These received link-state packets may be similar to the link-state packet examples described with reference to FIG. 2. Each link-state packet identifies the advertising LSR (i.e., the LSR from which the link-state packet originated) and all neighbor LSRs to which the advertising router is directly connected. Additionally, the link-state packet may include a table or other object that maps the identities of the neighbor LSRs and respective portcodes that identify the ports of the advertising router coupled to the neighbor LSRs. The link-state packets may contain additional information such as a sequence number. IGP manager 304 stores information from the link-state packets in link-state and policy memory 306 (hereinafter link-state memory 306).
For each link-state packet it receives, IGP manager 304 may store in link-state memory 306 the identity of the LSR that advertised the link-state packet and the identities of LSRs that are neighbors to the advertising LSR. IGP manager 304 may also store the table that maps LSR or link identities to portcodes. FIG. 3 illustrates example tables stored by LSR X in link-state memory 306 for routers identified as A-D and Y in response to receiving corresponding link-state packets. As shown, each table is stored with and identified by the LSR that advertised the table. The tables can be used to create portcode stacks as will be more fully described below. Link-state memory 306 may also store additional information such as policy considerations used by LSR X when forwarding packets.
When IGP manager 304 receives a complete set of link-state packets for the network 102, topology map generator 310 can process information of the link-state packets stored in link-state memory 306 and generate a network map for storage in network map memory 312. The algorithm employed by map generator 310 for this process may iterate over information in link-state memory 306. For example, for each table and LSR identity, map generator 310 may make links on the map of network 102, from the identified LSR to all the LSRs the table indicates are directly coupled neighbors. Topology map generator 310 may be implemented using any suitable combination of hardware, firmware, and software. In certain embodiments, topology map generator 310 may be implemented using instructions executing on one or more processors.
A path or route generator 320 can calculate paths to other LSRs within network 102 based upon the topological map contained within network map memory 312. Route generator 320 may calculate paths to a destination LSR before the router receives a packet to be delivered to that destination LSR, or route generator 320 may calculate paths to a destination LSR when the router receives a packet to be delivered to that destination LSR. Each path may be calculated as a sequence of hops between LSR X and a destination LSR (e.g., edge LSR Y). The sequence can be expressed in the identities of LSRs or communication links in the path. For purposes of explanation, the paths generated will be expressed as a sequence of LSR identities it being understood the claims below should not be limited thereto. The paths can optionally omit the identity of LSR X. The paths to each destination LSR can be stored in path/stack memory 318. FIG. 4 illustrates an example set of paths calculated by generator 320 from LSR X to LSR Y, each of which is defined by a sequence of LSR identities. Path or route generator 320 may be implemented using any suitable combination of hardware, firmware, and software. In certain embodiments, path or route generator 320 may be implemented using instructions executing on one or more processors.
Segment generator 316 can calculate at least one portcode stack for each path in path/stack memory 318. Segment generator 316 can pre-calculate portcode stacks for the paths, or segment generator 316 can calculate a portcode stack when it is needed. In one embodiment, segment generator 316 uses the tables in link-state memory 306 that map LSR identities to portcodes during this process. Segment generator 316 may be implemented using any suitable combination of hardware, firmware, and software. In certain embodiments, segment generator 316 may be implemented using instructions executing on one or more processors.
FIG. 5 illustrates a flow chart that describes certain aspects of an example method of creating a portcode stack. In particular as shown in FIG. 5, the method starts when segment generator 316 selects a particular path in path/stack memory 318. At 504, segment generator 316 selects the first LSR identified in the path and tags it as the “current” LSR. For example, in the path from LSR X to LSR Y that consists of LSR hops X-B-D-Y, X, the first LSR is selected as the initial “current” LSR. In step 506 generator 316 selects the next hop LSR according to the selected path and tags it as the “next hop” LSR. In step 510, the identity of the LSR designated “current” is then used to access the corresponding LSR identity/portcode table in link-state memory 306. In step 512, the portcode mapped to the identity of the LSR designated “next hop” is read from the accessed table. This portcode is added to the stack as shown in step 514. Generator 316 then determines whether another hop is contained within the selected path. If so, generator 316 in step 520 retags the LSR designated as “next hop” to “current.” Thereafter, steps 506-516 may be repeated. Ultimately, when the last portcode is added to the stack in step 514, or in other words, when the last hop LSR in the path is identified, the process ends, and generator 316 maps the portcode stack to the path in path/stack memory 306 in step 522. FIG. 4 illustrates example portcode stacks created by generator 316 that are mapped to paths in path/stack memory 318.
Once a portcode stack is created, LSR X can use it to transmit a packet through network 102. With continuing reference to FIGS. 1 and 3, packet forwarding engine 314 may be connected to each of the ports 302. Forwarding engine 314 may be implemented using any suitable combination of hardware, firmware, and software. In certain embodiments, forwarding engine 314 may be implemented using instructions executing on one or more processors of LSR X.
Forwarding engine 314 may receive a packet, such as a data packet, from one of the ports 302 connected to router 104, or packet forwarding engine 314 may receive an OAM packet from OAM manager 322. Packet forwarding engine 314 uses information contained within the received packet, such as the source and/or destination address to select one of several paths in path/stack memory 318 that can reach an LSR for which the packet is destined if the paths preexist in path/stack memory 318. For example, forwarding engine 314 may receive a data packet from router 104 that is ultimately destined for receiver R. The forwarding engine 314 can use information contained in the packet to determine that edge LSR Y shown in FIG. 1 is the destination within network 102 where the packet should be sent in order to reach receiver R, the final destination.
There are many paths that can be selected to forward the received packet to edge router Y. FIG. 4 illustrates example preexisting paths in path/stack memory 318 that can be selected. In the embodiment where paths and/or portcode stacks are created on the fly, path/stack memory 318 may not store the paths of interest at the time the packet is received, and in this embodiment route generator 320 may use information in the received packet to calculate one or more paths for storage in path/stack memory 318. The forwarding engine can use policy information in link-state memory 306 to select an appropriate path of the paths in path/stack memory 318. For example, the forwarding engine 314 could select a path that has fewest number of hops to edge LSR Y. In an attempt to load balance, forwarding engine 314 may select a path to edge LSR Y that does not contain the fewest number of hops. Regardless, forwarding engine 314 selects one of the paths in accordance with policies stored in link-state memory 306 or any of several selection algorithms. Thereafter, forwarding engine 314 reads the portcode stack mapped to the selected path in path/stack memory 318 if the portcode stack preexists in path/stack memory 318. In the embodiment where paths and/or portcode stacks are created on the fly, path/stack memory 318 may not store the portcode stack of interest at the time the packet is received, and in this embodiment the portcode stack can be calculated for the path by segment generator 316 and mapped to the path in path/stack memory 318. Once the path is selected or calculated on the fly, the corresponding portcode stack is added to the MPLS header that encapsulates the packet, and the packet with header is subsequently forwarded out of the port 302 identified by the portcode on top of the stack. In one embodiment, the portcode on top of the stack is popped off before the packet with header is forwarded to the next hop LSR within network 102.
With continuing reference to FIGS. 1-3, when a core LSR, such as core LSR 200 shown in FIG. 2, receives a packet with a portcode stack, the forwarding engine 314 of the core LSR pops off the portcode from the top of the stack and forwards the packet along with the portcode stack to the next hop LSR via the port identified by the popped portcode. This process may be continued in the downstream hops until the data packet reaches its destination (e.g., edge router Y). If the core router is the penultimate hop in the path to the destination LSR, the portcode stack will contain no further portcodes in one embodiment.
FIGS. 2 and 3 above illustrate relevant components of example LSRs employed in network 102. FIG. 6 is a block diagram illustrating certain additional and/or alternative components of LSRs that can be employed in network 102. In this depiction, LSR 600 includes a number of line cards (line cards 602(1)-(N)) that are communicatively coupled to a forwarding engine or packet forwarder 610 and a processor 620 via a data bus 630 and a result bus 640. Line cards 602(1)-(N) include a number of port processors 650(1,1)-(N,N) which are controlled by port processor controllers 660(1)-(N). It will also be noted that forwarding engine 610 and processor 620 are not only coupled to one another via data bus 630 and result bus 640, but are also communicatively coupled to one another by a communications link 670.
The processors 650 and 660 of each line card 602 may be mounted on a single printed circuit board. When a packet is received, the packet may be identified and analyzed by router 600 in the following manner. Upon receipt, a packet (or some or all of its control information) is sent from the one of port processors 650(1,1)-(N,N) at which the packet was received to one or more of those devices coupled to data bus 630 (e.g., others of port processors 650(1,1)-(N,N), forwarding engine 610 and/or processor 620). Handling of the packet can be determined, for example, by forwarding engine 610. For example, forwarding engine 610 may determine that the packet should be forwarded to one or more of port processors 650(1,1)-(N,N). This can be accomplished by indicating to corresponding one(s) of port processor controllers 660(1)-(N) that the copy of the packet held in the given one(s) of port processors 650(1,1)-(N,N) should be forwarded to the appropriate one of port processors 650(1,1)-(N,N). In addition, or alternatively, once a packet has been identified for processing, forwarding engine 610, processor 620 or the like can be used to process the packet in some manner or add packet security information, in order to secure the packet. On a node sourcing such a packet, this processing can include, for example, encryption of some or all of the packet's information, the addition of a digital signature or some other information or processing capable of securing the packet. On a node receiving such a processed packet, the corresponding process is performed to recover or validate the packet's information that has been thusly protected.
Although the present disclosure has been described in connection with several embodiments, the disclosure is not intended to be limited to the specific forms set forth herein. On the contrary, it is intended to cover such alternatives, modifications, and equivalents as can be reasonably included in the scope of the disclosure as defined by the appended claims.

## Claims

1. A method of routing a packet using a portcode stack, the method comprising:
generating, at an edge router in a network, a portcode stack comprising a first-router portcode, wherein the generating comprises
determining a first router on a first path within the network, and
determining the first-router portcode, as a portcode associated with the first router;

encapsulating the portcode stack in a header of a packet; and
forwarding the packet to a core router along the first path, wherein
the first path is a specific path to be taken by the packet through the network, and
the portcode stack specifies the first path.

2. The method of claim 1, wherein
the determining the first-router portcode comprises accessing a data structure that maps first portcodes to respective identities of first neighbor routers or respective first links to the first router,
the first portcodes identify respective first ports of the first router, and
the first ports are coupled to the first neighbor routers via the first links.

3. The method of claim 1, wherein the generating the portcode stack is performed in response to receiving the packet.

4. The method of claim 1, further comprising:
selecting the first path from a plurality of paths identified in a path memory, wherein all paths of the plurality of paths end at a first destination within the network, and the selecting is performed based on a selection algorithm.

5. The method of claim 4, wherein
the selecting comprises determining whether the packet comprises an operations, administration, and maintenance (OAM) packet.

6. The method of claim 1,
wherein the header comprises a Multiprotocol Label Switching (MPLS).

7. The method of claim 1, wherein the portcode stack further includes a second portcode, and further comprising:
determining a second router, wherein
the second router is a router on the first path; and

determining the second portcode, wherein
the second portcode is associated with the second router.

8. A system comprising:
an edge router adapted for routing a packet in a network using a portcode stack, the edge router comprising
a first circuit configured to generate a portcode stack comprising a first-router portcode, wherein generating the portcode stack comprises
determining a first router on a first path within the network, and
determining the first-router portcode, as a portcode associated with the first routed;

a second circuit configured to encapsulate the portcode stack in a header of a packet; and
a third circuit configured to forward the packet to a core router along the first path, wherein
the first path is a specific path to be taken by the packet through the network, and
the portcode stack specifies the first path.

9. The system of claim 8, wherein
the determining the first-router portcode comprises accessing a data structure that maps first portcodes to respective identities of first neighbor routers or respective first links to the first router,
the first portcodes identify respective first ports of the first router, and
the first ports are coupled to the first neighbor routers via the first links.

10. The system of claim 8, wherein
generating the portcode stack is performed in response to receiving the packet.

11. The system of claim 8, further comprising:
a fourth circuit configured to select the first path from a plurality of paths identified in a path memory, wherein
all paths of the plurality of paths end at a first destination within the network, and
selecting the first path is performed based on a selection algorithm.

12. The system of claim 11, wherein
selecting the first path comprises determining whether the packet comprises an operations, administration, and maintenance (OAM) packet.

13. The system of claim 8,
wherein the header comprises a Multiprotocol Label Switching (MPLS) header.

14. An apparatus comprising:
an edge router adapted for routing a packet in a network using a portcode stack, the edge router comprising
processing means configured to
generate a portcode stack comprising a first-router portcode, wherein
generating the portcode stack comprises
determining a first router on a first path within the network, and
determining the first-router portcode, as a portcode associated with the first router,
encapsulate the portcode stack in a header of a packet; and

forward the packet to a core router along the first path, wherein
the first path is a specific path to be taken by the packet through the network, and
the portcode stack specifies the first path.

15. The apparatus of claim 14, wherein
the determining the first-router portcode comprises accessing a data structure that maps first portcodes to respective identities of first neighbor routers or respective first links to the first router,
the first portcodes identify respective first ports of the first router, and
the first ports are coupled to the first neighbor routers via the first links.

16. The apparatus of claim 14, wherein
generating the portcode stack is performed in response to receiving the packet.

17. The apparatus of claim 14, wherein the processing means is further configured to:
select the first path from a plurality of paths identified in a path memory, wherein all paths of the plurality of paths end at a first destination within the network, and selecting the first path is performed based on a selection algorithm.

18. The apparatus of claim 17, wherein
selecting the first path comprises determining whether the packet comprises an operations, administration, and maintenance (OAM) packet.

19. The apparatus of claim 14, wherein
the header comprises a Multiprotocol Label Switching (MPLS) header.

20. The method of claim 8, wherein the second router is a next hop router, with respect to the first router, on the first path.