laitimes

The Ultra-Detailed MPLS Learning Guide takes you hand in hand to achieve seamless integration of IP and Layer 2 networks

author:Yan Hui, who loves to talk about network technology

Good evening everyone, I am a little tiger, today's article is a bit long, but it is all dry goods, patiently read it, will not let you down Oh!

The Ultra-Detailed MPLS Learning Guide takes you hand in hand to achieve seamless integration of IP and Layer 2 networks

With the development of ASIC technology, route lookup speed is no longer a bottleneck hindering the development of the network. This makes MPLS no longer have a clear advantage in terms of increasing forwarding speeds.

However, due to the combination of the powerful layer-3 routing function of THE IP network and the efficient forwarding mechanism of the traditional Layer-2 network, the connection-oriented mode is adopted in the forwarding plane, which is very similar to the existing Layer-2 network forwarding mode, which makes MPLS can easily realize the seamless integration of IP with THE LAYER-2 network such as ATM and Frame Relay, and provides traffic engineering (Traffic Engineering) and virtual private network VPN (Virtual Private). Network), quality of service QoS (Quality of Service) and other applications provide better solutions.

So today we will take a good small book to seriously understand MPLS multi-protocol tag exchange MPLS:

In the traditional IP forwarding mechanism, the router is based on CPU (soft forwarding) and fuzzy matching mode of data forwarding, forwarding efficiency is very low; MPLS is to replace the traditional IP forwarding mechanism; by adding tags in front of IP packets, the LFIB table is formed on the router, and the router forwards data based on ASIC exact matching tags, thereby greatly improving the forwarding efficiency of the three layers.

The Ultra-Detailed MPLS Learning Guide takes you hand in hand to achieve seamless integration of IP and Layer 2 networks

Note: With the development of ASIC technology, the hardware performance and speed of the current router are relatively high, and the advantages of MPLS are not very obvious; now the advantages of MPLS are mainly reflected in its extended applications, such as MPLS-VPN, MPLS-TE traffic engineering and quality of service QoS.

1

How it works

MPLS is a technology designed to increase the rate of IP packet forwarding in the network, which needs to be deployed as a whole in a transport network (carrier intranet).

For networks where MPLS is deployed, incoming traffic is classified on the router at the entrance to the network and then labeled for the different classes of traffic.

After the traffic enters the network, it is marked with different labels; when the router inside the network receives the traffic, it forwards the traffic according to the label and no longer looks up the IP routing table; the label is removed when the traffic is sent to the network.

Header and message encapsulation for MPLS:

Layer2/MPLS*x/IPv4/DATA/FCS, can include multiple tags

The Ultra-Detailed MPLS Learning Guide takes you hand in hand to achieve seamless integration of IP and Layer 2 networks
  • Label length: 20bits, take the value 0-1048575, 0-15 is a special label, other normal use.
  • EXP (test bit) length 3 bits for layer 2 QOS
  • S (marker bit) length 1 bit, used to indicate that it is an outer label/inner label.
  • TTL length 8bits

MPLS has two encapsulation modes: frame mode and cell mode (ATM).

Frame mode encapsulation is the addition of an MPLS tag header directly between the layer 2 header and the layer 3 header of the message, and Ethernet/PPP uses this encapsulation mode.

2

The router's switching mechanism

1. Process switching: The router needs to query layer 3 and layer 2 table items for each packet received, where the layer 3 table item query is to determine the outgoing interface and the next one, and the layer 2 table item query (ARP) is to obtain the destination MAC address to achieve layer 2 resealing; and it is based on cpu query, which is inefficient.

2. Fast switching: also known as network streaming switching (multiple exchanges at a time or multiple forwarding at a glance table).

Based on traffic forwarding, the router can perform traffic induction based on the seven-tuple of traffic (source IP address, source port number, protocol number, ToS field, the same inbound interface).

The packet that satisfies the same seven-tuple condition is formed into a stream, and the first packet of the stream is extracted when data forwarding is checked by the layer three table to determine the interface to determine the encapsulation information, and the outbound interface and encapsulation information used to forward the first packet are integrated to form a cache and cached in the ASIC chip, and the subsequent packets for this stream are no longer queried directly based on the CACHE of the ASIC cache.

3. Cisco Rapid Forwarding CEF: Cisco private forwarding mechanism, the router enables CEF, will form two tables, saved in the ASIC.

3

Forwarding feed FIB

It is a three-layer table, which is installed with optimized route entries, downloaded based on the route table, mainly optimized the next hop address, and integrates the non-direct next hop address of all routes into the next hop of the direct connection before downloading.

When the routing table entry is changed, the FIB table will also be adaptively changed, and after the interface is determined, there is also a resource linkage adjacency table in the FIB, which can determine the layer two encapsulation information.

Adjacency TableAdjaceny Table:

It is a two-layer table, which contains the optimized second-layer information for data encapsulation

Note: On Cisco devices, if you want to enable MPLS, you must first enable CEF, the router needs to run MPLS for label insertion, and the router's IP routing table does not support label insertion, only FIB supports label insertion, and there will be a FIB table after cef is enabled.

Forwarding equivalent class FEC:

MPLS is a data-level classification forwarding technology, it will have the same forwarding processing method (preferably the same destination address, the same outbound interface, the same VPN destination address, the same QOS) grouping into a category labeled, this category is called FEC forwarding equivalent class.

Routers can distribute tags based on route entries, and traffic belonging to a FEC has the same forwarding method, forwarding path, and forwarding treatment.

However, not all messages with the same label belong to a FEC, because the EXP values of these messages may not be the same, the execution method may be different, so they may belong to different FECs.

Note: After the MPLS is done, you cannot do route summarization or aggregation in the MPLS domain, because the route entries on different routers will cause black holes at the data level; also pay attention to the OSPF loopback masking problem.

4

MPLS schema

  • Control plane: Use static or dynamic routing protocols to generate routes, forming a FIB routing table.
  • Control plane: Tagging distribution protocol TDP (Cisco Private/Predecessor), Label Distribution Protocol LDP (Public), MP-BGP, Resource Reservation Protocol RSVP.
  • Label distribution, based on the route entries in the FIB routing table, label creation and join the FIB routing table.
  • Label distribution has only this meaning, two routers can distribute different labels for the same route entry.

The router needs to advertise the locally generated label about a route entry to the neighbor to achieve label sharing;

When a neighbor receives a label from a neighbor about the corresponding tag of a route entry, a LIB topology table is formed;

After the label sharing between the neighbors is completed, an LFIB table is formed locally for subsequent label data forwarding.

Data level: Forward messages with MPLS tags and ordinary IPv4 messages according to the LFIB table.

The Ultra-Detailed MPLS Learning Guide takes you hand in hand to achieve seamless integration of IP and Layer 2 networks

5

The working process of MPLS

Label press-in: Add a label to the packet; the boundary label-switching router receives an IPv4 packet through an external interface, and the router looks up the FIB table and finds that in order to forward this packet, it needs to be sent away through the interface connected to MPLS and pressed into the neighbor-distributed label according to the FIB table (Cisco optimization mechanism can look up the table once).

Label switching: Routers in the MPLS domain receive a packet with a tag and no longer look at the destination IP address of the Layer 3 header; the router adds tags and forwards them according to the tags distributed to the route by the next hop neighbor in the tag forwarding repository LFIB.

Label pop-up: Deletes the outermost label; Tag Removal: Deletes all labels in the stack

Boundary tag switching router R1 receives traffic from the inside out, the router receives a message with a tag can only query LFIB, the router looks up LFIB can not confirm the forwarding information, the router lookup table fails and then tries to remove the tag according to the IP address of the three-layer header query FIB for forwarding.

Cisco router in order to optimize the LSR tag removal, developed PHP (penultimate hop label pop-up or second hop tag pop-up), the router will judge whether it is a penultimate router based on the route, the penultimate router receives a route entry sent by the last router The label is 3, and the penultimate router will remove the label when sending the message to the last hop router.

LFIB: Tag Forwarding Feed, Tag-Based Routing Table; contains the following contents, route entry/locally distributed tag/neighbor-distributed tag/outbound interface/next hop

FIB: Tag Repository/Topology Table about what tags are distributed locally for a route entry and what tags are distributed by neighbors. 、

  • FIB: Forwarding repository, enables IPv4-based routing tables generated by CEF.
  • Tag-switched path LSP: The path that traffic passes through when it is forwarded within the MPLS domain, this path has been determined and established by the control plane protocol before forwarding traffic, and the traffic will be passed on a specific LSP; due to the existence of PHP mechanisms, LSPs may not be consistent end-to-end.
  • In Tag: The tag carried by the received route, which is a locally generated tag
  • Out Label: The label that is routed to the neighbor and the label generated for the neighbor
  • Local Label: About a route entry, a locally distributed label
  • Remote Label: About a route entry, a label distributed by neighbors
  • Upstream and downstream of MPLS: According to the data plane routing flow direction, the router that is closer to the routing source is the downstream router, the router that is closer to the data sender is the upstream router, and the downstream router jumps and jumps to pass the route upstream, while the upstream router passes the label to the downstream.

6

MPLS loop detection and handling

IGP loop detection mechanism and processing

TTL loop detection

TTL is used in MPLS for frame mode

There is no TTL in MPLS in cell mode

LDP loop detection mechanism

Distance vector method: By detecting whether the TLV contains its own Router ID, if so, discarded

Max Hop Method: Set the maximum hop count of LSP by detecting the TLV

How MPLS handles TTL: Default usage mode 1

Method 1: Implement a network structure that does not hide the MPLS domain from the outside

The Ultra-Detailed MPLS Learning Guide takes you hand in hand to achieve seamless integration of IP and Layer 2 networks

Method 2: Realize the network structure in the MPLS domain that is hidden from the outside

The Ultra-Detailed MPLS Learning Guide takes you hand in hand to achieve seamless integration of IP and Layer 2 networks

The principle of MPLS solving BGP data plane black holes:

R4--R2--R1--R3--R5

When a router uses a BGP route to forward packets from outside to inside, it will query the corresponding IGP route for the next hop address of this BGP route, encapsulate data according to the remote label of the IGP route, and R2 will carry a label about 3.3.3.0 when sending to R1, because R1 is the penultimate second-hop router, R1 will pop up the label when sending data to R3, and R3 will forward data according to the EBGP route.

Label Distribution Protocol LDP:

The port number uses TCP and UDP 646 to build neighbors through UDP, and updates and other various messages are sent through TCP after the neighbor is established; authentication is supported.

LDP header/message encapsulation: Layer2/IPv4/TCP or UDP/LDP/FCS

The Ultra-Detailed MPLS Learning Guide takes you hand in hand to achieve seamless integration of IP and Layer 2 networks

LDP Header:

Version: Version, the current version number is 1.

PDU Length: Length, which represents the total length of parts other than Version and PDU Length.

LDP Identifier: The first 4 bits represent Router ID, and the last 2 bits indicate whether the label space of LSR is router space or interface space (router space has only one label for a route entry, less label, and occupies less resources; interface space about an outbound interface of a route entry is assigned a label, and the interface space occupies more resources, but improves security).

LDP message:

U:Unknown Message bit。 When the LSR receives an unrecognized message, the U=0 of the message, LSR returns an advertisement to the producer of the message, ignoring the unrecognized message.

Type: Indicates a specific message type, currently, LDP definition of common messages are Notification, Hello, Initialization, KeepAlive, Address, Address Withdraw, Label Mapping, Label Request, Label Abort Request, Label Withdraw, Label Release。

Message Length: The total length of M ID, M Parameters, and Optiona.

Message ID: Used to uniquely identify a message.

Mandatory Parameters and Optional Parameters are mandatory and optional parameters for the message of variable length, respectively.

LDP message type:

1. Discover message: Notifies itself that it exists and automatically builds a neighbor, multicast address 224.0.0.

2.Session message: Establish a TCP connection, negotiate parameters, etc., and establish or remove the connection

3.Advertisement message: Generate, notify, and delete tags

4. Notification message: Notifies alarms and error messages

The Ultra-Detailed MPLS Learning Guide takes you hand in hand to achieve seamless integration of IP and Layer 2 networks

LDP State Machine:

The Ultra-Detailed MPLS Learning Guide takes you hand in hand to achieve seamless integration of IP and Layer 2 networks

▶ Routers running LDP also need to elect a RID, which uses the maximum address of the loopback port by default, and if there is no loopback port, uses the maximum address of the physical interface, which is generally specified manually.

The transport address of the router to send LDP hello messages is not the IP address of the physical interface, but the Router ID; therefore, the Router ID value used by the router when establishing the LDP neighbor must be reachable (direct connection to build the neighbor).

In the router's LDP neighbor table, the router's tag information about the neighbor is based on the router's loopback address.

In the FIB table, all forwarding information is based on the next hop address of the direct connection port. In order to associate the loopback port with the next hop address of the direct connection port, the router will send the IP addresses of all other local interfaces to the neighbor after establishing a neighbor through LDP, except for the other addresses of the loopback port, which are hidden by default.

After the router enables MPLS, the LDP protocol is automatically enabled; periodic hello is sent to establish LDP neighbors;

Label distribution: For each IGP route entry in the FIB table, each LSR running the LDP protocol will automatically distribute local labels;

● Standalone Independent: Receive an IGP route, and distribute the local label regardless of whether the label sent by the downstream router is received or not.

Ordered Ordered: Receiving IGP routes, only labels sent by downstream routers can be distributed locally.

Label Advertisement: LSR distributes the assigned label to all LSR neighbors, these received labels are converted into remote labels, and then the neighbor stores the remote label and local label in the label repository LIB;

On-demand notification DU: Regardless of whether a label request from a neighbor is received or not, a tag map is formed and sent to the neighbor.

Request Notification DoD: Does not actively send a label mapping to the neighbor, and the corresponding label information is sent to the neighbor according to the request mapping sent by the neighbor after receiving the label notification request request sent by the neighbor.

Label keeping: Usually an LDP router will have multiple LDP neighbors, then these neighbors will assign labels to the route and then pass these labels to themselves, of all the remote labels that bind a specific prefix, LSR only uses one of the remote labels to determine the outbound label of the prefix.

While LSR selects the tag in the FIB table from the remote tag received by the downstream neighbor to reach the next hop of the prefix, LSR uses this information to create its own tag forwarding repository, LFIB.

Conservative: Only labels sent by downstream neighbors about the next hop route will be received, and labels for other routes will not be received.

Free Libral: Tags sent by neighbors are received, and only tags about routing the next hop are added to LFIB

Features of LDP:

The Layer 2 Type field describes the unicast 0x8847 of the MPLS protocol; the MPLS protocol multicast 0x8848

A router cannot distribute the same label for different routes, and each route entry corresponds to a locally unique label, but the 0-15 label is retained;

  • Tag 0 - Explicitly empty tag, receive the route sent by the neighbor, remove the tag yourself;
  • Label 1 - Router Alarm Label;
  • Label 3 - Implicit empty label, the label is removed when the neighbor sends the route;

When establishing an LDP to establish a neighbor, the active send destination port number 646 on the side of the transmission address is given to the peer

LDP Basic Discovery Mechanism: DiscoverSL neighbors that are directly connected to the same link.

LDP Extended Discovery Mechanism: If you find non-directly connected LSR neighbors, you can only use unicast to build neighbors.

LDP can distribute labels to direct routes, static routes, and dynamic routes learned through the IGP routing protocol.

The labels for BGP routes are distributed by BGP itself, which distributes labels only for VPNv4 routes and VPNv6 routes.

Instead of a prefix distribution label based on a BGP route, the IGP distribution label corresponds to the next hop of the BGP route.

RSVPs can both reserve resources and distribute tags; in MPLS TE, tags can be based on Qos.

MPLS-VPN:

The MPLS technology is used to build an enterprise IP private network on the operator's broadband IP network, realize cross-regional, secure, high-speed, reliable data, voice, image multi-service communication, and combine differential services, traffic engineering and other related technologies to combine the reliable performance, good scalability, and rich functions of the public network with the security, flexibility and efficiency of the private network to provide users with high-quality services.

MPLS-VPN network is mainly composed of 3 parts such as CE router, PE router and P router;

1. PE router: the operator's edge router device is directly connected to the user's CE router, responsible for VPN service access, handling VPNv4 routing, and is the main implementer of MPLS Layer 3 VPN;

2, CE router: the user network border router device, directly connected to the operator network, it "perceives" the existence of the VPN;

3. P router: The operator's core router device is responsible for fast forwarding data and is not directly connected to CE.

Control Plane:

Virtual Routing Forwarding VRF:

In order to solve the problem that different customers use the same private address, PE routers create a separate VRF routing table for each customer.

VRF route table supports naming, VRF name only has a local meaning, when the PE router connects the interface connected to ce and VRF association, the control plane and data level are based on the VRF route table for data forwarding (VRF can only be associated with the interface connected to the CE router).

In order to send VRF routing to the PEER PE router, the PE router needs to use MP-BGP for data forwarding.

First of all, the VPNv4 neighbor is established between the two PE routers, and when the PE router uses MP-BGP for data forwarding, the VRF route is first converted into a VPNv4 route (x:y route entry) and added to the VPNv4 BGP table.

A router can have multiple VRF tables but only one VPNv4 BGP table, which may cause duplicate routes, and in order to avoid duplicate routes, the route needs to add RD before joining the BGP route table.

  • Route Distinguishers: Identifies a VRF route entry in the VPNv4 BGP table
  • Route Targets: This is the extended community attribute in BGP, so that when the peer PE router receives the VPNv4 route transmitted by the internet, it can know which VRF route to add the route to.

Export: The RT value that PE carries when adding VRF routes to the VPNv4 BGP table

Import: After the PE receives the VPNv4 route, it adds the route with the RT value to the local corresponding VRF route table

  • VPNv4 routing: IPv4 private network routes that carry RT and RD attributes and are then passed through BGP
  • BGP uses MP-BGP for VPNv4 routing and then label distribution

The IGP route label for layer2/VPNv4 routing next hop addresses | VPNv4 tag/IPv4/DATA/FCS