Routes and paths
ip -f mpls route
The ip MPLS command shows and changes the label table: which label comes in, which goes out, and to which neighbour.
Each line is one incoming label: 100 as to 200 via inet 10.0.23.3 swaps 100 for 200 and sends it on;
without as the label is popped; dev lo hands the bare packet back to IP routing. Labels are pushed by an
IP route: ip route add PREFIX encap mpls LABEL via GATEWAY. A card accepts labelled packets only with
net.mpls.conf.CARD.input = 1; entries LDP made say proto ldp.
ip -f mpls route command usage
ip -f mpls route [show] ip -f mpls route add|replace|del LABEL [as NEWLABEL] via inet GATEWAY ip route add PREFIX encap mpls LABEL via GATEWAY
Options
-
-f mpls - the MPLS family: the label table instead of IPv4 routes
-
as 200 - swap the incoming label for 200
-
via inet 10.0.23.3 - the next hop, an IPv4 address
-
dev lo - pop the label and route the packet by its address
-
encap mpls 100 - on an IP route: push label 100
ip -f mpls route examples
-
ip -f mpls route - Prints the label table: one line per incoming label.
-
ip -f mpls route add 100 as 200 via inet 10.0.23.3 - Swaps label 100 for 200 and sends the packet to 10.0.23.3.
-
ip -f mpls route add 200 dev lo - Pops label 200 and routes the packet inside by its address.
-
ip route add 10.0.4.10/32 encap mpls 100 via 10.0.12.3 - Pushes label 100 on packets for 10.0.4.10 and sends them to 10.0.12.3.
Pitfalls
- A labelled packet whose label has no entry is dropped: the router never falls back to the address inside.
tcpdump 'mpls or icmp'misses plain ICMP: aftermpls, the rest of a filter is read inside the label. Writeicmp or mpls.