Sunday, January 15, 2017

configure mpls between linux host and mikrotik

*** setup information

linux ip :


*** on linux
1- install quagga-ldpd and prerequisite
$ sudo apt-get install gcc
$ sudo  apt-get install libtool make autoconf gawk libreadline-dev texinfo
if your kernel is <4.2, upgrade your kernel
$ sudo install linux-headers-4.2.0-18 linux-headers-4.2.0-18-generic linux-image-4.2.0-18-generic

$ git clone
$ cd quagga-ldpd
$ autoreconf -i
$ ./configure --enable-mpls --enable-ldpd --sysconfdir=/etc/quagga --localstatedir=/var/run/quagga
$ make
$ sudo make install

2- create user and directory
$ sudo useradd -m quagga
$ sudo mkdir /var/run/quagga
$ sudo chown quagga:quagga /var/run/quagga

3- create the following configuration
- /etc/quagga/zebra.conf
hostname Router
password zebra
enable password zebra


-log file /var/log/quagga/ospfd.log
router ospf
 network area
 network area

- /etc/quagga/ldpd.conf
debug mpls ldp messages recv
debug mpls ldp messages sent
debug mpls ldp zebra
log file /var/log/quagga/ldpd.log
mpls ldp
 address-family ipv4
  discovery transport-address
  label local advertise explicit-null
  interface eth0

4- setup the host to enable mpls routering
$ sudo sysctl -w net.ipv4.ip_forward=1
$ sudo modprobe mpls-router
$ sudo python -c "import os;os.system("echo 100000 > /proc/sys/net/mpls/platform_labels")
$ sudo python -c "import os;os.system("echo 0 > /proc/sys/net/mpls/conf/eth1/input")

$ sudo ip link add name lo1 type dummy
$ ifconfig lo1 up

5- run the folllow daemon
$ sudo zebra -d
$ sudo ospfd -d
$ sudo ldpd -d

**** mikrotik part
/interface bridge
add name=lo

/ip address
add address= disabled=no interface=ether1
add address= disabled=no interface=lo

/routing ospf network
add area=backbone disabled=no network=
add area=backbone disabled=no network= 

set dynamic-label-range=16-1048575 propagate-ttl=yes

/mpls ldp
set distribute-for-default-route=no enabled=yes hop-limit=255 loop-detect=no lsr-id= path-vector-limit=255 transport-address= use-explicit-null=no

/mpls ldp interface
add accept-dynamic-neighbors=yes disabled=no hello-interval=5s hold-time=15s interface=ether1 transport-address=

*** show command
- on mikrotik,
[admin@MikroTik] > /mpls ldp neighbor print
Flags: X - disabled, D - dynamic, O - operational, T - sending-targeted-hello,
V - vpls
 #      TRANSPORT       LOCAL-TRANSPORT PEER                       SEN
 0 DO                  no 

- on linux host, telnet to localhost port 2601 password zebra
$ telnet localhost 2601
Router# show mpls table
 Inbound                            Outbound
   Label     Type          Nexthop     Label
--------  -------  ---------------  --------
      16      LDP         3

No comments:

Post a Comment