Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The principle and configuration idea of MPLS

2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Abandon the tedious route lookup and change it to simple and fast label switching.

Change the routing table with global significance to a label table with local significance

MPLS header: usually has 32bit

20bit used as a label

3 exp of bit, not specified in the agreement, usually used as COS

S of 1 bit, used to identify whether the stack is low, indicating that the tags of the MPLS can be nested

8 TTL for bit

The exp of 3bit usually corresponds to the tos of ip protocol

S position 1: the mark is followed by the IP header.

Label label:

Is a relatively short, fixed length only has a local meaning.

Forward equivalent class FEC:

Is a set of data packets that are processed in an equivalent manner during forwarding. If the processing action is the same, it can be understood to be the same FEC (one route corresponds to one FEC)

Label switching channel LSP:

A FEC data stream is assigned certain labels at different nodes, and the data is forwarded according to these tags. The path of data flow is LSP.

LSR, the core switch of MPLS's network:

Provide label switching and label distribution functions

Border switch LER for MPLS's network:

At the network edge of the MPLS, the traffic entering the MPLS network is divided into different FEC by the LER and the corresponding label is requested for these FEC. It provides traffic classification and label mapping, label removal function.

Tag PUSH, pop-up tag POP

The label forwarding of MPLS establishes a label forwarding channel LSP for the message through the pre-assigned tag, which only needs to be searched once at each device through which the channel passes.

The subtleties of FEC:

IP packets with different destination addresses (belonging to the same network segment) are divided into the same FEC at ingress and have the same label, so that at LSR, you only need to exchange quickly according to the label. If the cache function is enabled, the tag corresponds to FEC, which may be a network segment, so that very few entries match a large number of messages.

Fatal flaw in FEC:

For a FEC, all devices along the way must have the same route (the prefix and mask must be exactly the same) to build a LSP. On all devices along the way that use MPLS forwarding, no aggregation can be done for routes to be forwarded using labels.

The label near the layer 2 header is the stack top label, and the label near the ip message is always based on the stack top label when performing label exchange for the stack low label,lsr.

Ethernet: 0X8847 (unicast) and 0X8848 (Multicast) to identify the carrying MPLS messages.

In PPP: 0X8281 to identify that the bearer is MPLSCP

Tag generator LDP (label distribution protocol). Very similar to RIP. BGP and RSVP can also distribute tags

Several elements:

1, message (message)

2, automatic neighbor discovery and maintenance mechanism

3, a set of algorithms used to calculate the final result based on the information collected

LDP message:

Discovery message DISCOVERY: used to advertise and maintain the presence of LSR in the network

Session message SESSION: used to establish, maintain, and end session connections between LDP peers

Notification message ADVERTISEMENT: used to create, change, and delete specific FEC- tag bindings

Notification message NOTIFICATION message: used to provide message notification and error notification

Neighbor discovers: send hello messages (UDP:PORT646/IP:224.0.0.2) to each other

Establish a TCP connection: initiated by the party with a large address (TCP:PORT646) (large transport address)

Session initialization: an initialization message is sent by MASTER with negotiation parameters

The SLAVE checks whether the parameters are acceptable, and if so, sends an initialization message with negotiation parameters. And then send a keepalive message

Master checks whether the parameters are acceptable, and if so, sends a keepalive message

Receive keepalive messages to each other and establish the session

Close the session and disconnect the TCP connection if you receive any error messages during the period

State transition diagram for LDP session establishment:

NON EXISTENT: the session has not been established yet. Send hello messages to each other and negotiate with the active and passive parties at this stage. Change to initialized status after receiving the trigger of a successful tcp connection establishment event

INITIALIZED: the session connection was established successfully. The active party sends the initialization message, turns to the opensent state, and waits for the initialization message of the passive party.

OPENSENT: the active party sends an init message and enters the opensent state

OPENREC: enter the openrec state after receiving an acceptable init message

OPERATIONAL: all enter operational status after receiving keepalive messages

Tag distribution method:

DOD: downstream on-demand tag distribution

DU: downstream autonomous tag distribution

Tag control mode:

Ordered mode label control

Independent mode label control

Label retention method:

Conservative mode

Free way

Upstream and downstream: on a LSP, the adjacent LSR is called upstream LSR and downstream LSR, respectively, along the direction of packet transmission. Downstream is the originator (announcer) of the route

DU mode:

The downstream actively sends a tag mapping message to the upstream. Horizontal segmentation also exists in label allocation.

The label is randomly and automatically generated by the device, and less than 16 is reserved for the system

The DOD method is rarely used:

The upstream sends a tag mapping request message to the downstream. After receiving the message, the downstream allocates tag resources from the tag resource pool according to the requested FEC.

Free way:

Keep all tags sent from neighbors

Advantages: reduced lsp convergence time when the IP route converges and the next hop changes

Disadvantages: need more memory and label space

Conservative approach:

Keep only tags from next-hop neighbors and discard all tags sent by non-next-hop neighbors

Advantages: save memory and label space

Disadvantages: lsp converges slowly when the IP route converges and the next hop changes

Use more freely

Ordered mode: unless the LSR is the originating node of the route, the LSR must wait for the next hop's tag map to be received before it can send the tag map upstream

Stand-alone: LSR can send tag mapping upstream without having to wait for a tag mapping message from the next hop of LSR

What is more popular is the orderly way.

DU+ free + ordered mode:

1. A label will be sent when you find that you have a directly connected port route.

2. A label is sent when a label is received downstream to a route and the route is in effect (that is, the route already exists locally and the next hop of the route is the same as the next hop of the label)

3, there will be a large number of unselected tags in the tag table

Labels are generated only for directly connected routes of devices running MPLS, but not for routes originating from other devices (IP domain).

Frame mode: independent control + autonomous distribution DOD+ free reservation

Cell mode: ordered control + on-demand distribution DU+ conservative reservation

Label removal method:

Label release:

The upstream actively sends a tag release message to inform the downstream to release a tag. The tag is no longer used to send data, and the label release message does not require a confirmation message.

Tag undo:

When the downstream sends a label withdrawal message to the upstream notifying the upstream to stop using a tag, the upstream router needs to send a label release message to confirm

The IN and OUT in the tag forwarding table are the IN and OUT assigned to the tag, not to the label forwarding.

Mental formula: I gave the label to others, and the label was sent to me.

The tag I assigned is for others, and I won't add it to the message.

In tags cannot be duplicated. Out tags can be duplicated.

Global label space:

All entry labels must be different.

For the same route (same next hop), the label must be the same

For different routes (same next hop), the label must be different

For different routes (and different next hops), the label may be the same

For the same route, the incoming and outgoing labels may be the same

Interface label space:

The penultimate hop pops up PHP:

Make a special note when assigning a label to it on the penultimate hop (assign a special label 3)

When the egress lsr receives the MPLS label from the penultimate hop, it directly forwards the IP route. The penultimate hop pops up all labels

Show empty 0 label: for QOS

Router alarm 1 label: software Forwardin

Prevention of routing loops:

The establishment of LSP depends on IP routing. Loop prevention is left to IP.

Labels will only be sent from downstream devices to upstream devices

Detection of routing loops:

TTL minus one for each MPLS forwarding

In the process of label forwarding, the TTL in the MPLS header is reduced by one, and the TTL in the IP message is not reduced by one. Because in the forwarding process, layer 3 de-encapsulation will not be involved.

TDP:TAG DISTRIBUTION PROTOCOL . Cisco proprietary standard

Discover neighbor: the source destination port number is all UDP:711

Establish neighbors: the destination port is TCP:711 and the source port is random

There are TCP behind it.

LDP is the same as TDP, the knowledge port can be changed to 646.

MPLS must first enable CEF, because tags can only be inserted in the fib table of cef

Users' border gateways are usually marked as CE

The border gateway of SP is usually labeled PE, and the internal router is labeled P.

The border router assigns a label to each ICG route entry, but not to BGP route entries. Uniformly use the label of the update source for BGP entries

LIB: the corresponding table of route entries and assigned labels

FLIB: the corresponding table for each tag, the next hop and the next tag, is the tag conversion table show mpls ip binding

LFIB: the conversion table show mpls forwarding-table for tags

The router will also put the label given by others in the LIB table.

LDP PDU header:

Version number: 16bit, the current version number is always 1

PDU length: 16bit. The value is the length of the data portion after the LDP PDU header, excluding the LDP PDU header

LDP ID:48bit, the front 32bit is LSR-ID, the back 16bit is the tag space flag, the global space is 0, the local interface space is 1

LDP message format:

U: this one is always 0, which represents an identifiable message. 1 represents an unrecognized message

Type domain: the protocol identifies different messages based on this domain

Length field: indicates the length of the data portion after the length field

Message ID: used to uniquely identify the message.

Type of message:

Neighbor Discovery message: sends this message periodically on an interface that enables the LDP protocol

Hello message

Session establishment and maintenance messages: used to establish and maintain LDP sessions

Initialization message

Keepalive message

Tag distribution messages: used to request, advertise, and unbind tag bindings

Address message

Address withdraw message

Label request message

Label mapping message Distribution label

Label withdraw message

Label release message

Label abort request message

Error notification message: used to prompt the LDP peer for important events during the session

Notification message

Establish neighbors: hello time and hold time are 5 seconds and 15 seconds respectively. Hello packets cannot cross network segments.

LDP session: hello and hold time are 60 seconds and 180 seconds, respectively

Modify discovery neighbor hello time: mpls ldp discovery hello interval 3

Modify session hold time: mpls ldp hold time 150

Data flows downstream and distributes label upstream

MPLS PING/TRACEROUTE is implemented using IPV4/IPV6 's UDP protocol. The basic idea of LSP PING/TRACEROUTE is to use packets of specific FEC forwarding classes to verify the integrity of the LSP corresponding to the FEC.

The udp port of echo request is 3503

Restrictions on routing entry labels:

You can receive a label of 6.6.6.6

Access-list 6 permit 6.6.6.6

Mpls ldp neighbor 12.12.12.2 labels accept 6

Control the specific restrictions on sending labels on routers:

Control R3 to send only the 6.6.6.6 tag to R2

Access-list 2 permit 2.2.2.2 (this address must be the other party's RID)

Access-list 6 permit 6.6.6.6 (this is a specific routing entry)

No mpls ldp advertise-labels

Mpls ldp advertise-labels for 6 to 2

Certification of LDP:

Mpls ldp neighbor 12.12.12.2 password 0 cisco

If the LDP is directly connected to a neighbor, the session is called LDP sessions

LDP remote neighbor, then the session is called the targeted session,hello packet and the LDP Targeted hello

A remote session is generally configured on the standby link to prevent the session from failing due to the disconnection of the primary link

LDP session protection: dual-connection backup between two directly connected LSR

Do both sides of mpls ldp session protection, or use the following command

Mpls ldp neighbor 1.1.1.1 targeted ldp does not specify ldp, default is tdp

You can also specify neighbors and times through acl:

Access 1 per 1.1.1.1

Mpls ldp session protection for 1 duration 90s

Manually configure the remote session:

1,mpls ldp neighbor 2.2.2.2 targeted ldp

ICG and LDP synchronization: traffic can be forwarded only if both IGP and LDP agree that a link is UP. In some cases, when the LDP neighbor is not established or the neighbor is lost and does not send a label for the route, if the IGP neighbor has established and learned the routing entry, the IP exchange will start, and later when the LDP is normal, packet loss may occur

Currently, it can only be synchronized with OSPF, and can only be used if mpls ip is configured under the interface. The maximum time ospf waits for ldp neighbor establishment is holddown

Router ospf 12

Mpls ldp sync enables synchronization

Mpls ldp igp sync holddown 1000 set holddown time

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report