Trying to figure out how one can use iproute2 to manage static label-switched MPLS routes in Linux kernel 4.1.
I am aware iproute2 support for MPLS might be incomplete right now [2].
Can anyone please shed some light on what iproute2-4.1.1 is currently able to do?
This is what I have found so far:
/proc/sys/net/mpls/platform_labels /proc/sys/net/mpls/conf//input
sudo modprobe mpls_router
sysctl -a --pattern mpls
net.mpls.conf.eth0.input = 0
net.mpls.conf.eth1.input = 0
net.mpls.conf.lo.input = 0
net.mpls.platform_labels = 0
sudo sysctl -w net.mpls.conf.eth0.input=1
sudo sysctl -w net.mpls.conf.eth1.input=1
sudo sysctl -w net.mpls.platform_labels=1000
sudo ip route add 1.1.1.1/32 via mpls 100/200/300 dev eth0
sudo ip -f mpls route add 10 via mpls 100/200/300 dev eth0
???
???
Can someone help me out . Thanks in Advance.
A little bit too late, but hope it helps somebody. You can find them here:
Routing 10.10.10.10/32 to 192.168.1.2 with label 100:
ip route add 10.10.10.10/32 encap mpls 100 via inet 192.168.1.2
Label swapping 100 for 200 and sent to 192.168.2.2:
ip -f mpls route add 100 as 200 via inet 192.168.2.2
Decapsulating label 300 and delivering locally:
ip -f mpls route add 300 dev lo
To show MPLS routes you can do:
ip -f mpls route show
If your iproute2 version doesn't support those commands, you can get it from here:
https://www.kernel.org/pub/linux/utils/net/iproute2/iproute2-4.6.0.tar.gz
And then
./configure && make && make install