IP forwarding principle:
The routing table (static\RIP\OSPF, etc.) is used to generate the routing table and forward it according
to the destination IP address. During the IP packet forwarding process, the destination IP address remains
unchanged. Two tables are used:
RIB (Routing Table): A routing information base that obtains routing information through various routing protocols.
FIB (CEF table): Forwards the information base, which is generated based on the RIB and is used to guide the
forwarding of IP packets.
The router receives the data packet, looks at the destination IP address (IP header) of the data packet,
looks up the CEF table, and forwards the data according to the CEF table.
MPLS forwarding principle:
An MPLS header can be inserted between the Layer 2 header and the Layer 3 header to insert multiple MPLS headers.
The router receives the packet, looks at the label of the packet (MPLS header), looks up the label forwarding table, and
forwards the data according to the label forwarding table.
The label forwarding table is generated through the LDP protocol.
The IP header length is 20 bytes, and the MPLS packet header length is 4 bytes. The efficiency based on MPLS forwarding
is higher than that based on IP forwarding.
The IP network forwards data hop by hop, receives the data packet,
and finds the routing table and sends it to the next hop.
It does not care who the next hop router will send the packet to. In an MPLS network, labels are
pre-assigned and LSPs are generated.
IP hop-by-hop forwarding. At each hop that passes, the longest matching lookup of the routing table must be performed
(possibly multiple times), and the speed is slow. MPLS label forwarding, through a pre-assigned label,
establishes a label forwarding channel (LSP) for the packet. At each device passing through the channel,
only fast label switching is required (one search).
Why do you say that MPLS belongs to layer 2.5 because it is between the ip layer and the data link layer.