LDP Protocol in MPLS of HCIP

LDP protocol

LDP protocol --- label distribution protocol

        The work to be done on the MPLS control plane is mainly to assign labels and transfer labels . The premise of assigning labels is that there must be labels in the local routing table, and the premise of transmitting labels is that there must be a routing foundation first. Therefore, if LDP wants to work normally, it needs IGP as the basis.

The main tasks that the LDP protocol needs to complete are:

        1. Assign labels

        2. Pass tags

Notice:

        Because the LDP protocol needs to complete the above two tasks, we need to ensure that the IGP protocol is running in the MPLS domain to obtain information --- The IGP protocol is the basis of the LDP protocol

1. Assign labels

After LDP is activated, it is necessary to assign a label         to the FEC on the device . If the device is the outbound LSR of the FEC, LDP will actively assign a label to the FEC.

         Of course, in the process of forming the LSP reaching the target network segment, all intermediate LSRs need to assign labels to the corresponding FECs. Then other devices will passively assign labels only after receiving the mapping relationship between the label and the target network segment. Checks need to be completed before assigning labels, mainly checking whether the local routing table of the target network segment is reachable, and whether the next hop is the same as the advertiser. Labels can be assigned if the check is passed, and labels cannot be assigned if the check is not passed.

        For example, if R4 is the outbound LSR of network segment 4.0 , R4 will actively assign a label to network segment 4.0. However, R1, R2, and R3 are not outbound LSRs, so they will not actively assign labels. However, the label of the 4.0 network segment is also required when constructing an LSP. Therefore, when R4 transmits its own label information to R3, after receiving it, R3 will perform a circular check --- check whether there is routing information in the routing table to reach the 4.0 network segment, and whether the next hop in the routing table is the same as The notifier is the same, and if the check is successful, R3 will also assign a label to the 4.0 network segment. By analogy --- this label assignment method is called ordered mode --- Huawei equipment chooses ordered mode by default

The label allocation method of LDP:
         Orderly method---Huawei equipment chooses orderly method to assign tags by default
        Independent mode --- It does not need to confirm that it is an outbound LSR, and can also assign labels to routing entries in the routing table independently .

2. Pass tags

        The prerequisite for label transfer is that the devices must be in an LDP peer relationship , and the prerequisite for establishing a peer relationship is that an LDP session needs to be established first .

There are two types of LDP sessions:

        Local session --- LDP established between directly connected devices

        Remote session --- It is not necessarily directly connected to the device, and a remote LDP session can be created through manual designation . (LDP sessions can implement indirect neighbor establishment )

        When an LDP session establishes a local session, it does not need to specify a neighbor relationship , and it can also be established --- because the LDP protocol will first use multicast (224.0.0.2 local link multicast --- the local link multicast that all routers will listen to) address ) to send hello packets to discover neighbor relationships. --- The hello package will be encapsulated using UDP protocol , and the source project port is port 646

The process of establishing a local LDP session:

        1. After LDP is activated, the port of the LSR will first periodically send Hello packets (the default is 5s as the period, and the default keep-alive time is 3 times the period , 15s) to complete the peer discovery work

During the process of discovering neighbors, the hello packet will carry some parameters. There are mainly two parameters , one is the transmission address , and the other is the LDP ID.

        Transport address --- This transport address is the address that needs to be used to establish a TCP session later. This transport address uses the configured LSR-ID by default . Therefore, when we configure the LSR-ID of the device, we must use the IP address of the loopback interface and ensure that the address is reachable, because we need to use this address to establish a TCP session later.

        LDP ID --- If the master device activates the LDP protocol, it needs to have an LDP ID --- composed of 48 binary bits --- 32:16 --- the first 32 binary bits use the LSR-ID . The last 16 bits generally write 0

        2. After the two parties interact and complete the hello packet, they will obtain the transmission address of the other party , and then establish a TCP session based on this transmission address .

                Before establishing a TCP session, you also need to enter the inspection link --- check the reachability of the transport address

Notice:

        Both parties have received the transmission address of the other party, and both will initiate the establishment of a TCP session , which causes a waste of resources , because a two-way channel is established when one party initiates, so before LDP initiates a TCP session, it will first compare the transmission address. Whoever has the largest transmission address is the active party , and can initiate a TCP session request

        3. After the TCP session is completed, the LDP session will start to be established. The party with the larger transmission address will send the initialization message first , which will contain parameters that need to be negotiated to establish an LDP session. After the peer receives it, if it approves, it can send its own initialization message, and at the same time send a Keeplive message for confirmation

        The LDP protocol will also periodically send Keeplive to keep the session alive --- the cycle time is 15s , and the expiration time is 3 times the cycle time , the default is 45s

How the label is delivered

        Upstream and downstream relationship --- In label switching, we will distinguish the upstream and downstream relationship based on the direction of data flow. The data sending device is upstream and the receiving device is downstream . --- The direction of control traffic flow is opposite to the flow direction of the data layer , that is, from downstream to upstream. ---- The upstream needs to obtain the downstream label, but the downstream does not need to obtain the upstream label

DU mode (downstream autonomous mode)

        DU mode --- After the label is allocated, the device will actively transmit the label, because the device itself cannot distinguish the upstream and downstream relationship, so this label will be transmitted to its own upstream and downstream

DoD Mode (Downstream On-Demand Mode)

         DoD mode --- the downstream needs to obtain the data packet sent by the upstream before transmitting the label to the upstream, and then the label information can be transmitted

How to save tags

        Conservative mode --- only keep tags passed downstream

        Free Mode --- All tabs are saved

Huawei default --- DU mode and conservative mode

Data plane flow process

        During data transmission, both the inbound LSR and the outbound LSR will look at two tables (FIB and LFIB), which will lead to a decrease in transmission efficiency

        Optimization of inbound LSR --- record outbound labels in LFIB table in FIB table

        Optimization of outbound LSR --- PHP --- the last pop-up mechanism --- need to use a special tag value -- 3 (implicit empty tag) , when the outbound tag in an entry is 3 , then he The label will be popped --- when the outbound LSR allocates the label, it allocates the No. 3 label, and then passes it to the last hop. Afterwards, when the data is forwarded, the label will pop up on the last hop, and the outbound LSR only needs to check the FIB for routing and forwarding.

Huawei devices enable the PHP mechanism by default

LDP configuration

        1. Start the IGP protocol on all LSRs first to ensure the routing foundation

                Just configure the ospf protocol

        2. Configure MPLS LSR ID

[r1]mpls lsr-id 1.1.1.1

        3. Activate MPLS and LDP

                global activation

[r1]mpls 
Info: Mpls starting, please wait... OK!
[r1]mpls ldp

                interface activation

[r1-GigabitEthernet0/0/0]mpls 
[r1-GigabitEthernet0/0/0]mpls ldp
[r1]display mpls ldp peer --- 查看LDP对等体关系
[r1]display mpls ldp session --- 查看LDP会话
[r4]display mpls lsp --- 查看LFIB表
Notice:
        By default, Huawei devices only assign labels to 32-bit host routes, because MPLS is not mainly used in data transfer
As mentioned above, if there are too many routing entries in the routing table, too many LSPs will be generated and resources will be wasted .
[r4-mpls]lsp-trigger all -- 这个命令可以让设备给出来/32主机路由外的路由分配标签

MPLS solves routing black hole problem

[r2]route recursive-lookup tunnel --- 在进行路由递归查找的时候,如果有隧道则递归进隧道
[r2]display fib verbose --- 查看FIB表的细节信息

Guess you like

Origin blog.csdn.net/qq_57289939/article/details/130226051
ldp