Unveiling the mystery of MPLS, do you know all this?

Unveiling the mystery of MPLS, do you know all this?

Before formally learning MPLS, let us review the IP forwarding principles that we have repeatedly learned in NA and NP.

In the above figure, during the process of PC-A and PC-B accessing each other:

  • All Layer 3 network devices form routing entries for source and destination
  • PC-A sends a message, source-IP is A, destination-IP is B
  • After receiving the message, R1 checks its routing table according to the destination IP, obtains the outbound interface, and sends the data packet out from the outbound interface.
  • R2 and R3 do the same, and keep passing the data packet to PC-B
  • PC-B responds by sending a reply packet and transmits data in the opposite direction

The ARP query of the Layer 2 MAC address and the content of the rewritten data frame are omitted.

In short: during the transmission of IP datagrams, the routing table is queried according to the destination IP address, and the outbound interface is obtained to send the data. The source and destination IP addresses remain unchanged, and the MAC address is rewritten hop by hop.

The above is the IP forwarding principle that we are familiar with.

For ease of understanding, we have hidden the real scene in the forwarding process, that is, when the router receives an IP packet, it actually queries the forwarding table (LIB) rather than the routing table (RIB).

We need to review the working principle of exchange discussed in the NP exchange part.

In the early days, the switching method used by switches when exchanging data frames was called process switching. All messages needed to be queried and processed by the CPU during switching, which resulted in the inability to improve switching efficiency. Subsequently, a new generation of switching methods emerged, which adopted the data flow switching method. We call the traffic with the same source and destination IP, source and destination MAC, source and destination port, and inbound interface the same data flow. When processing this data, the switch only needs to use the CPU to query the first message, and all subsequent messages are processed according to the switching method of the first message, which greatly improves the switching efficiency.

Cisco has launched its own unique switching method based on the data flow switching method. In process switching, there is a problem, that is, the corresponding switching cache will only be generated after traffic is triggered. If a large number of different data flows are processed, the switching efficiency is actually as slow as process switching. In order to solve this problem, Cisco has optimized and improved it, using the idle resources of the switch to calculate the forwarding information of the data flow that may be received in advance and load it into the cache. When the data flow is received, the pre-cached forwarding information is directly used to process the message, realizing a true hardware-based switching method. Cisco calls this method Cisco Express Forwarding (CEF).

Due to the high efficiency of CEF, Cisco has also transplanted this function into its new routing products, so now all Cisco devices that everyone can access have the CEF function.

What we call the forwarding table is actually the CEF table. CEF means it is generated based on the routing table. Unlike the routing table, it does not have a large amount of recursive content. The CEF table shows which interface a data packet should be sent from next if it is matched. It is simple and efficient.

For example, the following routing table (RIB):

Routing will require recursive queries.

And let's take a look at the CEF table (FIB):

When the router is idle, it will calculate the forwarding information in advance based on the information in the routing table, and directly send the data packet destined for 4.4.4.4 from the outbound interface F0/0.

  • We call this table FIB: Forwarding Information Base.
  • The FIB is generated based on the routing table, which we call RIB: Routing Information Base
  • When a device receives an IP packet, it actually queries the FIB instead of the RIB. If the CEF function is disabled, the device will query the RIB, i.e. the routing table.

The above is what we learned about the IP forwarding principles in NA and NP, and here are some supplements.

Next, we begin to unveil the mystery of MPLS and take a look at its inner workings.

MPLS (Multiprotocol Label Switch) was originally a protocol proposed to improve the forwarding speed of routers. However, with the development of technology, the forwarding performance of equipment has become stronger and stronger, and its advantage of accelerating forwarding speed has gradually weakened. The design of nested multi-layer MPLS headers has become its most outstanding feature.

Currently, it is mainly used in solving BGP routing black hole problems and MPLS VPN data forwarding.

First of all, we need to have a general understanding of MPLS. When MPLS transmits messages, it inserts the MPLS header between the layer 2 frame header and the layer 3 header, so many people call it layer 2.5.

Its message structure is much simpler than the IP header and much smaller, only 4 bytes (32 bits).

The structure is as follows:

  • The first 20 bits are label bits, used to indicate the current label
  • Not defined in the EXP protocol, generally used as COS
  • S is the bottom bit of the stack, used to indicate whether the MPLS header is the last MPLS header.

I believe TTL does not need to be explained

I believe you will be able to remember such a simple interface after seeing it once. Similarly, the device will be more efficient in processing MPLS packets than IP packets.

There are some professional terms that must be understood in MPLS.

  • FEC: Forwarding Equivalence Class, FEC (forwarding equivalence class), is a group of data packets processed in an equivalent manner during the forwarding process. FEC can be created by identifying addresses, tunnels, COS, etc. Currently, in MPLS, only one route corresponds to one FEC. Usually, on one device, the same label is assigned to one FEC.
  • Label: It is a relatively short, fixed-length identifier that usually has only local significance (similar to a MAC address). These labels are usually located between the data link layer encapsulation header and the layer 3 data packet. The label is mapped to the FEC through the binding process, that is, one FEC corresponds to one label.
  • LSP: Label Switching Path. A data flow of an FEC is assigned certain labels at different nodes, and data forwarding is performed according to these labels. The path taken by the data flow is the LSP.
  • LSR: Label Switching Router, LSR is the core switch of the MPLS network, which provides label switching and label distribution functions.
  • LER: Label Switching Edge Router, at the edge of the MPLS network, the traffic entering the MPLS network is divided into different FECs by LER, and the corresponding labels are requested for these FECs. It provides traffic classification and label mapping, and label removal functions.

Now that we know the above terms, let's look at how data is transmitted through MPLS and what the differences are between MPLS and IP:

In the above picture, we need to solve several problems:

  • How are tags generated?
  • How do IP packets become MPLS packets?
  • How are messages delivered from source to destination?

(1) How are labels generated?

  • Generate a unique label for each route (local label, also called in label)
  • Pass these labels to the MPLS neighbor (remote label, also called out label)

(2) How do IP packets become MPLS packets?

On the LER, push the label (the label of the route corresponding to the destination IP address of the IP message)

(3) How are messages transmitted from source to destination?

  • A sends an IP packet. R1 receives it and queries the FIB to find out that a label needs to be pushed in.
  • R1 forwards the message to R2. R2 receives the MPLS message, queries the in label in the LFIB table, and replaces the original label with the out label value corresponding to the in label.
  • After reaching R3, the in label is queried and the corresponding out label is found to be pop, so the top label is popped out, the packet is restored to an IP packet, and forwarded to R4.
  • After receiving the IP message, R4 queries the FIB table and forwards the message to B

There are several actions involved:

  • Push: Add an MPLS header to the message
  • swap: replace the label with the value of the out label based on the result of the in label query
  • pop Pop: remove the top-level MPLS header
  • untag pop: remove all MPLS headers
  • PHP mechanism: The penultimate hop is popped up to reduce the number of table lookups for the last device.

If there is no penultimate hop popping mechanism, and the label is popped on the last device, the LFIB table needs to be queried on the last device first to find out that the label needs to be popped. After the label is popped, it becomes an IP packet and the FIB table needs to be queried again, a total of two queries are required. However, after the label is popped on the penultimate hop device and becomes an IP packet, the last device only needs to query the FIB table once.

These are the principles of MPLS. Next time we will continue to study the MPLS protocol.

<<:  "Resonance" Connecting Everything Ruijie Networks 2019 Internet Technology Summit Opens

>>:  Network streaming media protocol - RTSP protocol

Recommend

How to make the audit of data center assets more efficient?

Everyone has their responsibilities, but what to ...

Detailed explanation of HTTP protocol security-related headers

HTTP security headers are a fundamental part of w...

How will operators charge in the 5G era? IT leaders say...

2019 is the first year of 5G commercialization. S...

Starlink increases download speed target from 1Gbps to 10Gbps

Starlink will provide 10Gbps network speeds in th...

A complete set of DNS related tests in IPv6 environment

[[271457]] Dong Tao, senior operation and mainten...

It took two years for 5G messaging to be officially commercialized. Is that it?

With the development of science and technology, t...

Pride and Prejudice in Data Centers About Software

When it comes to data centers, most people will f...

RackNerd adds new Seattle data center, 1GB memory package costs $11.95 per year

In the middle of last month, we shared the news t...

5G message is coming, please check!

What is 5G messaging? Is it an upgraded version o...

5 Service Level Agreement Best Practices for a Unified Communications Strategy

Organizations need strong SLAs to meet their UCaa...