- First the router build routing table for IGP routing in MPLS domain and put it to FIB in CEF
- Every LSR assign a local label for each route learned
- Every LSR assign implicit null label for its local connected interface networks.
- Every LSR will share its label with its direct neighbors using LDP
- Every LSR will build from FIB the LFIB – when there is two path to destination the MPLS has just one best way because it is build from the routing FIB!
MPLS packet flow
As we said every router maintain its MPLS forwarding table (#show mpls forwarding-table) containing information where to send specific IP packet – which interface and what remote label it should use. LSR also maintains ldp binding table. You can list that table with command #show mpls ldp bindings. In this table you can list all label bindings for specific network, i. e. what label local and remote routers are using for that network.
And now, when the IP packet enters SP edge router, the router will lookup for the destination IP address in MPLS forwarding table. It will find destination and encapsulate (push label) IP packet with outgoing label (local label of remote router) and send it to the outgoing interface also listed in the MPLS forwarding table.
Remote router receive the mpls packet look into its forwarding table and find out the label is his local label. That local label is binded to outgoing label and outgoing interface. The router will swap the label for the outgoing label and send it through the outgoing interface.
Then it goes and goes till it reach the router containing POP information for the outgoing label in MPLS forwarding table. This router is called penultimate router. This means that the next hop router is directly connected for destination network. So the router will remove the label (POP) from the packet and tag the packet with pop information. When the remote router receive the packet, it will route the packet based on its routing table not mpls forwarding table, because the destination network is directly connected. (this behaviour is seen when PHP function is turned ON)
How the router knows that he should POP the label? LSRs exchanges its label information via LDP protocol. When router receives implicit null label from its neighbor, he knows the network is directly connected to that neighbor router and he should POP it when he receive MPLS packet towards that destination. This POP information is also listed in MPLS forwarding table of penultimate router