Mpls basics скорее для себя чем для кого то еще
MPLS Header
|-Label(20)-|-EXP(3)-|-BoS(1)-|-TTL(8)-| = total length 32 bits
label - it is a label itself
EXP - for QoS purposes
BoS - Bottom of Stack (BoS) bit. It is 0, unless this is the bottom label in the stack. If so, the BoS bit is set to 1(по сути указатель на нижнюю метку в стеке, единичка выставляется у самой нижней метки в стеке)
TTL - the same meaning as the IP(уменьшаем на единичку на каждом LSR, если достигает 0 - дропаем пакет)
Encoding of MPLS
|--L2 Header--||--MPLS Stack--||--Transport Protocol--|
MPLS Protocol Identifier Values for Layer 2 Encapsulation Types
Layer 2 Encapsulation Type
Layer 2 Protocol Identifier Name
Value (hex)
PPP
PPP Protocol field
0281
Ethernet/802.3 LLC/SNAP encapsulation
Ethertype value
8847
HDLC
Protocol
8847
Frame Relay
NLPID (Network Level Protocol ID)
80
LSR
* Ingress LSRs-Ingress LSRs receive a packet that is not labeled yet, insert a label (stack) in front of the packet, and send it on a data link.
* Egress LSRs-Egress LSRs receive labeled packets, remove the label(s), and send them on a data link. Ingress and egress LSRs are edge LSRs.
* Intermediate LSRs-Intermediate LSRs receive an incoming labeled packet, perform an operation on it, switch the packet, and send the packet on the correct data link.
Label Switched Path
A label switched path (LSP) is a sequence of LSRs that switch a labeled packet through an MPLS network or part of an MPLS network.
Basically, the LSP is the path through the MPLS network or a part of it that packets take. The first LSR of an LSP is the ingress LSR for that LSP, whereas the last LSR of the LSP is the egress LSR.
All the LSRs in between the ingress and egress LSRs are the intermediate LSRs.
LSP
----------------------------------------->
______ _____________ ______ ______ _____________ _____
|_CE _|-----|_Ingress LSR _|---|_LSR_|---|_LSR_|---|_Egresss LSR_|---|_CE_|
Forwarding Equivalence Class
A Forwarding Equivalence Class (FEC) is a group or flow of packets that are forwarded along the same path and are treated the same with regard to the forwarding treatment. All packets belonging
to the same FEC have the same label. However, not all packets that have the same label belong to the same FEC, because their EXP values might differ; the forwarding treatment could be different, and they could belong to a different FEC. The router that decides which packets belong to which FEC is the ingress LSR. This is logical because the ingress LSR classifies and labels the packets. Following are some examples of FECs:
Packets with Layer 3 destination IP addresses matching a certain prefix
■ Multicast packets belonging to a certain group
■ Packets with the same forwarding treatment, based on the precedence or IP DiffServ Code Point (DSCP) field
■ Layer 2 frames carried across an MPLS network received on one VC or (sub)interface on the ingress LSR and transmitted on one VC or (sub)interface on the egress LSR
■ Packets with Layer 3 destination IP addresses that belong to a set of Border Gateway Protocol (BGP) prefixes, all with the same BGP next hop
LDP
label binding
ISR label assigned 19 <- LSR1 label assigned 18 <- LSR2 label assigned 17 <- ELSR label assigned 3 /FEC(igp prefix) 1.1.1.1/32
|_Ingress LSR _|---|_LSR1_|---|_LSR2_|---|_Egresss LSR_|
ILSR LB 19 ILSR OB 18 -> LSR1 IB 18 OB 17 -> LSR2 IB 17 OB POP(penultimate pop hopping) -> ELSR IP Packet
traffic flow
|_Ingress LSR _|---|_LSR1_|---|_LSR2_|---|_Egresss LSR_|
ipv4 packet ->ILSR push label 18 forward to LSR1 -> LSR1 swap label 18 to label 17 froward to LSR2 -> LSR2 POP label 17 forward ipv4 packet to ELSR -> ELSR route ipv4 packet to destination
MPLS Label Spaces
Per-Interface Label Space
If per-interface label space is used, the packet is not forwarded solely based on the label, but based on both the incoming interface and the label.(Applied only for ATM MPLS in cisco, called MPLS cell mode Label Switching Controlled-ATM)
Per-Platform Label Space
The other possibility is that the label is not unique per interface, but over the LSR assigning the label. This is called per-platform label space.(для разных FEC назначаются разные метки, для одного и того же FEC могут назначаться одинаковые метки)
Different MPLS Modes
■ Label distribution mode
■ Label retention mode
■ LSP control mode
Label Distribution Modes
■ Downstream-on-Demand (DoD) label distribution mode
In the DoD mode, each LSR requests its next-hop (that is, downstream) LSR on an LSP, a label binding for that FEC.
Each LSR receives one binding per FEC only from its downstream LSR on that FEC. The downstream LSR is the next-hop router indicated by the IP routing table.
■ Unsolicited Downstream (UD) label distribution mode
In the UD mode, each LSR distributes a binding to its adjacent LSRs, without those LSRs requesting a label.
In the UD mode, an LSR receives a remote label binding from each adjacent LSR.
…
In the case of DoD, the LIB shows only one remote binding, whereas in the case of UD, you are likely to see more than one.
The label distribution mode used depends on the interface and the implementation. In Cisco IOS, all interfaces-except LC-ATM interfaces-use the UD label distribution mode.
All LC-ATM interfaces use the DoD label distribution mode.
Label Retention Modes
■ Liberal Label Retention (LLR) mode
In LLR mode, an LSR keeps all received remote bindings in the LIB. One of these bindings is the remote binding received from the downstream or next hop for that FEC. The label from that remote binding is used in the LFIB, but none of the labels from the other remote bindings are put in the
LFIB; therefore, not all are used to forward packets. Храним все потомучто опираемся на IGP протокол а это штука динамичная и в любой момент топология может измениться тогда next-hop для какого либо из FEC может измениться и в это же время метка для этого изменившегося next-hop'а будет уже в LIB и в LFIB быстро изменится запись на новую outgoing метку.
■ Conservative Label Retention (CLR) mode
The second label retention mode is CLR mode. An LSR that is running this mode does not store all remote bindings in the LIB, but it stores only the remote binding that is associated with the next-hop LSR for a particular FEC.
...
In short, the LLR mode gives you quicker adaptation to routing changes, whereas CLR mode gives you fewer labels to store and a better usage of the available memory on the router. In Cisco IOS, the retention mode for LC-ATM interfaces is the CLR mode. It is the LLR mode for all other types of interfaces.
LSP Control Modes
■ Independent LSP Control mode
The LSR can create a local binding for a FEC independently from the other LSRs.
This is called Independent LSP Control mode.
In this control mode, each LSR creates a local binding for a particular FEC as soon as it recognizes the FEC. Usually, this means that the prefix for the FEC is in its routing table.
■ Ordered LSP Control mode
In Ordered LSP Control mode, an LSR only creates a local binding for a FEC if it recognizes that it is the egress LSR for the FEC
or if the LSR has received a label binding from the next hop for this FEC.
...
The disadvantage of Independent LSP Control is that some LSRs begin to label switch packets before the complete LSP is set up end to end; therefore, the packet is not forwarded in the manner it should be. If the LSP is not completely set up, the packet might not receive the correct forwarding treatment everywhere or it might even be dropped. As an example for both control methods, you can look at LDP as the distribution method for label bindings of IGP prefixes. If the LSR were running in Independent LSP Control mode, it would assign a local binding for each IGP prefix in the routing table. If the LSR were running in Ordered LSP Control mode, this LSR would only assign a local label binding for the IGP prefixes that are marked as connected in its routing table and also for the IGP prefixes for which it has already received a label binding from the next- hop router (as noted in the routing table). Cisco IOS uses Independent LSP Control mode. ATM switches that are running Cisco IOS use Ordered LSP Control mode by default.