Thursday, August 31, 2023

MPLS Principle

 1. IP(Internet Protocol) VS MPLS(Multi Protocol Label Switching)
-IP is connectionless packet forwarding, hop by hop (router along the path looking to the routing table every time it received the packet in order to find the next hop). There is a delay of the packets when reach the destination.

-There is no QoS on the IP network. It's a best effort mechanism.


-MPLS is connection oriented packet switching, it is end to end connection. Packet forwarding based on the label. Label switching within MPLS domain while traditional routing on the edge between MPLS domain and IP.



-The Packet within IP network called IP packets, while the packets in the MPLS network called MPLS packetes.


  2. MPLS label


-MPLS label is stacked between the L2 header layer and L3 header layer


-The label is 20 bits, equal to 1048576 values.
-Label is local identifier. It is only in between the sending out port of upstream router and receiving port of downstream router. It's used to identify the specific FEC, and FEC is used to identify the MPLS packets.
-Bottom of stack(s bit) to identify if the next header is MPLS header(S=0) or IP header(S=1)
-Label stack: the MPLS header stacks on another in IP frame:


-The first MPLS header is regarded as the Top Label(or outer label) and the last MPLS header is considered as the Bottom Label(or inner label):




2-The MPLS domain or network and its element:




-LSR is the core router in MPLS network. It provides the function of label switching 
and label distribution.

-LER is the router at the MPLS edge. It distributes corresponding labels for the traffic to MPLS domain. It provides functions of traffic classification through FEC, label mapping and label removing.

-FEC is a group or set of data which have the same attributes. The FEC is characterized by 
by address, tunnel or Class of Service (CoS), QoS. The same labels are distributed to an FEC on a device. Packets belong to the same FEC is handling/treated as the same way in the MPLS network. Different MPLS labels belong to different FEC. 

 


-LSP is created by LSR in the MPLS domain by using LDP(Label Distribution Protocol)
-Ingress LSR: indicates the beginning of an LSP. Only one ingress exists on an LSP. The ingress pushes a new label to the packet and encapsulates the IP packet as an MPLS packet to forward.

-Egress LSR: indicates the end node of an LSP. Only one egress exists on an LSP. The egress mainly pops labels out of MPLS packets and forwards the packets that restore the IP packet.

-Transit LSR: indicates the middle node of an LSP. Multiple transit LSRs may exist on an LSP.

-When received the arrived packets, Ingress will classify the data into FEC and doing the PUSH operation (add the label into FEC), the transit LSR node will do the SWAP operation(replace the old label with the new label) and the Egress node will do the POP(remove the label from the packets) before the packets going out of the MPLS domain.
According to the direction of data transmission, LSRs are classified as follows:
-Upstream: Based on the specified LSR, in the direction of data flows, the LSRs that send MPLS packets to the local LSR are upstream LSRs.
-Downstream: Based on the specified LSR, in the direction of data flows, the next-hop LSRs that receive MPLS packets sent from the local LSR are downstream LSRs.
-LSRs know its downstream neighbors through IP routing protocol
-Next hop address is downstream neighbor


4. Label distribution and management


-Label is distributed by downstream LSR to upstream LSR. Downstream LSR distributed labels to specific FEC and downstream LSR informs upstream LSR through label advertisement protocol in order upstream LSR to create a label forwarding table and LSP.
-Forwarding of packets based on top label in stack, when the LSR received a packet it will check the top label and decides on the next hop.
-Based on routing protocol, all the nodes create the label information base(LIB) which is under control of LDP.
-Labels are assigned and exchanged between adjacent neighboring LSR, hop by hop.
-Label distribution is driven by several modes:

5. Label creation(establishment)

-LSP is a forwarding path, establishment refers to the binding FEC with label and then advertising  this binding to adjacent LSR on the LSP.
-Static LSP: It is set up by the administrator.
-Dynamic LSP: It is set up by the routing protocol and label distribution protocol.
-A static LSP is set up without label distribution protocols or exchanging control packets. Thus, the static LSP costs little and it is applicable to small-scale networks with simple and stable topology. The static LSP cannot vary with the network topology dynamically. The administrator needs to configure the static LSP.


-Dynamic LSPs are set up automatically by the label distribution protocol. The following label distribution protocols are applicable to an MPLS network.
-The establishment of an LSP in MPLS network contains three steps:
1.Routing table generation 
-Each node runs a dynamic routing protocol such as BGP, OSPF or Intermediate System-to-Intermediate System (IS-IS) to generate a routing table.
2. LIB generation 
-According to the routing table, each node establishes a Label Information Base (LIB) under the control of LDP.


-As an egress LSR to 47.1.0.0/16, RC distributes a label “40” and sends it to upstream neighbor RB. This information is recorded in LIB. When RC receives a message with label “40”, it knows that this message is to 47.1.0.0/16.
-When RB receives the binding information of 47.1.0.0/16 and label “40” from RC, it keeps the label information and the receiving interface in LIB. Meanwhile, RB distributes a label for 47.1.0.0/16 and sends this information to neighbors except the neighbor connecting to the receiving interface.
-Suppose that RB sends a label “50” to RA. Therefore, there is such a piece of information in LIB of RB, as shown below.

IntfIn       LabelIn         Dest          IntfOut   LabelOut
  1            50          47.1.0.0           2         40

-This information means when RB receives a message with label “50” from interface 1, it changes the label to “40” and sends the message from interface 2. RB does not look up routing information in its routing table.
When RA receives binding information, RA acts in the same way as RB does.
 
3-LSP Generation
 
-An LSP is established after “out” labels and “in” labels on ingress LSR, intermediate LSRs and egress LSR are mapped to each other. When LSRs forward messages, they forward them according to labels instead of looking up routing tables.
-When RA receives a message with destination address 47.1.1.1, it looks up its routing table first, and then it looks up label forwarding table. When it finds that the FEC 47.1.0.0/16 corresponds to the label “50”, RA adds the label to the header of the message and sends it from interface 2.
-When RB receives the message with label “50” from interface 1, it looks up the label forwarding table, and then RB changes the label to “40” and sends the message from interface 2.
-When RC receives the message with label “40” from interface 1, it looks up the label forwarding table. RC finds that the destination of the message is a network segment connecting to itself directly. Therefore, RC pops out the label and sends the IP message.


No comments:

Post a Comment

5G Core Signaling Comics_Huawei

  5G Core Signaling Comics 5G Core Signaling Comics - Issue 1, please click here 5G Core Signaling Comics - Issue 2, please click here 5G Co...