Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

SimonCZW's ldpd test setup

SimonCZW edited this page Sep 15, 2016 · 1 revision

#MPLS LDPD LINUX EXPERIMENT

##Introduction This page is a basic experiment for forwarding packet with mpls tag in Linux. Show you how to config a Linux to support MPLS stack and manage mpls tag through LDPD. And the Linux experimental environment is as following:

##Build a linux environment supporting mpls ,quagga and ldpd ###1) upgrade kernel

It need linux kernel support mpls stack.Such kernel 4.6

  1. wget
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.6-yakkety/linux-headers-4.6.0-040600_4.6.0-040600.201606100558_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.6-yakkety/linux-headers-4.6.0-040600-generic_4.6.0-040600.201606100558_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.6-yakkety/linux-image-4.6.0-040600-generic_4.6.0-040600.201606100558_amd64.deb
  1. install dpkg -i *.deb

  2. update grub and reboot update-grub reboot

###2) Enable MPLS in kernel

modprobe mpls_router
modprobe mpls_gso
modprobe mpls_iptunnel
sysctl -w net.mpls.conf.eth0.input=1
sysctl -w net.mpls.conf.lo.input=1
sysctl -w net.mpls.platform_labels=1048575

You'll need to set net.mpls.conf.[interface-name].input=1 for any other interfaces that you plan to receive MPLS packets on, otherwise the MPLS route table won't accept your routes

###3) Install quagga-ldp

  1. git clone git clone https://github.com/rwestphal/quagga-ldpd.git
  2. apt-get apt-get install autoconf automake texinfo libtool
  3. create Makefile cd quagga-ldpd ./bootstrap.sh #autoreconf -i
  4. ./configure ./configure --enable-tcp-zebra --enable-mpls --enable-ldpd --sysconfdir=/etc/quagga --localstatedir=/var/run
  5. make & make install make make install
  6. ldconfig ldconfig /usr/local/lib

ERROR:

  1. AWK \1 Error apt-get install gawk
  2. configure: error: vtysh needs libreadline but was not found and usable on your system. apt-get install libreadline-dev

###4) Start quagga

  1. user useradd quagga
  2. set permission chown -R quagga.quagga /etc/quagga
  3. create pid information touch /var/run/zebra.pid chmod 755 /var/run/zebra.pid chown quagga.quagga /var/run/zebra.pid touch /var/run/ldpd.pid chmod 755 /var/run/ldpd.pid chown quagga.quagga /var/run/ldpd.pid
  4. create ldpd vty file touch /var/run/ldpd.vty chmod 755 /var/run/ldpd.vty chown quagga.quagga /var/run/ldpd.vty chmod 777 /var/run
  5. config cp /etc/quagga/zebra.conf.sample /etc/quagga/zebra.conf cp /etc/quagga/ldpd.conf.sample /etc/quagga/ldpd.conf
  6. start zebra -d -f /etc/quagga/zebra.conf ldpd -d -f /etc/quagga/ldpd.conf

##ldpd experiment

###1)environment

10.63.26.1x is Debian Linux IP for ssh to manage.And 4.4.4.4 / 9.9.9.9 / 6.6.6.6 is loopback IP for experiment. We can make it through such command:

ip link add name lo1 type dummy
ip link set dev lo1 up
ip addr add 4.4.4.4/32 dev lo1

###2)set static route we need to create a step by step environment ,so that we can catch the mpls tag changement .Rather than a next hop tag "3".

In 10.63.26.14 , config in zebra through : ip route 6.6.6.6/32 10.63.26.19 ip route 9.9.9.9/32 10.63.26.19

10.63.26.19: ip route 6.6.6.6/32 10.63.26.16 ip route 4.4.4.4/32 10.63.26.14

And 10.63.26.19: ip route 9.9.9.9/32 10.63.26.19 ip route 4.4.4.4/32 10.63.26.19

Now, every Linux can reach the others loopback IP step by step.

###3)Config ldpd

In 10.63.26.14 config...

mpls ldp
 router-id 4.4.4.4
 dual-stack transport-connection prefer ipv4
 dual-stack cisco-interop
 neighbor 9.9.9.9 password testmpls
 !
 address-family ipv4
  discovery transport-address 4.4.4.4
  !
  interface eth0
  !
 !
!

In 10.63.26.19 config...

mpls ldp
 router-id 9.9.9.9
 dual-stack transport-connection prefer ipv4
 dual-stack cisco-interop
 neighbor 4.4.4.4 password testmpls
 neighbor 6.6.6.6 password testmpls
 !
 address-family ipv4
  discovery transport-address 9.9.9.9
  !
  interface eth0
  !
 !
!

In 10.63.26.16 config...

mpls ldp
 router-id 6.6.6.6
 dual-stack transport-connection prefer ipv4
 dual-stack cisco-interop
 neighbor 9.9.9.9 password testmpls
 !
 address-family ipv4
  discovery transport-address 6.6.6.6
  !
  interface eth0
  !
 !
!

After that,we can show mpls ldp neighbor

##Test

In 10.63.26.14: ping -I 4.4.4.4 6.6.6.6

And we can catch packet in 10.63.26.19: tcpdump -ni eth0 mpls and icmp

Done!

Clone this wiki locally