Sunday, January 15, 2017

configure mpls between linux host and mikrotik

*** setup information

linux ip : 192.168.56.24
       router-id: 1.1.1.2

mikrotik: 192.168.56.6
       router-id: 1.1.1.1


*** 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 https://github.com/rwestphal/quagga-ldpd.git
$ 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

/etc/quagga/ospfd.conf
 

-log file /var/log/quagga/ospfd.log
router ospf
 network 1.1.1.2/32 area 0.0.0.0
 network 192.168.56.0/24 area 0.0.0.0
!


- /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
 router-id 1.1.1.2
 !
 address-family ipv4
  discovery transport-address 1.1.1.2
  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 1.1.1.2/32 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=192.168.56.6/24 disabled=no interface=ether1
add address=1.1.1.1/32 disabled=no interface=lo


/routing ospf network
add area=backbone disabled=no network=1.1.1.0/24
add area=backbone disabled=no network=192.168.56.0/24 


/mpls
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=1.1.1.1 path-vector-limit=255 transport-address=1.1.1.1 use-explicit-null=no

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



*** 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   1.1.1.2         1.1.1.1         1.1.1.2:0                  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     192.168.56.6         3

No comments:

Post a Comment