How to compile linux to create a DiffServ over MPLS router in lab?

Appendix A

( Modified from [19], for HTB support for linux kernels 2.4.19 and lesser)

1. Preparation:

1.1 Installation of the Linux kernel

The default Linux kernel location is folder /usr/src/linux-2.4.18

(Specifically use kernel 2.4.18. Kernels 2.4.19, 2.4.20, 2.4.21 were tried and were found to give “kernel panic” on boot.)

– A copy of compressed kernel (linux-2.4.18.tar.bz2) has to be copied

to folder /usr/src/. This is the default kernel location, and the

intended start point for all further operations.

– This directory may contain a symbolic link linux to the old kernel

folder. If so this has to be removed.

– Decompress the kernel by:

~ /usr/src> tar -xvjf linux-2.4.19.tar.bz2

Now create the architecture dependant links:

~ make xconfig (or make menuconfig or make oldconfig)

and exit immediately

1.2 Software List

– Components of the RSVP-TE software can be downloaded separately from

site These comprise:

KERNEL_2.4.19_MPLS172.patch, iptables-1.2.4-0.2-dscp.tgz, DSMPLS+IP.patch, iproute2-current.tar.gz and rsvpd.0.70-rc2.tgz.


2. Uncompress iproute2 package into ~rsvp/

3. HTB patch

Uncompress htb patch (from into /usr/src and then:

>patch –p1 < ../htb_*.diff


4. MPLS Patch

– Move KERNEL_2.4.19_MPLS172.patch into the folder /usr/src and

type the command:

~ /usr/src/linux-2.4.19> patch -p1 < ../KERNEL_2.4.19_MPLS172.patch

5. DSMPLS+IP.patch

~ /usr/src/linux-2.4.19> patch -p0 < ../DSMPLS+IP.patch

5.Uncompress iptables into ~rsvp/

6.Change the makefile for the Kernel path

7. go to ~rsvp/iptables/ and do “make patch-o-matic”

8. then “make” then “make install”

9. Go back to Linux kernel /usr/src/linux-2.4.18 and do: make menuconfig

Compile the kernel with at least the following networking options

(enable “Prompt for development and/or incomplete code/drivers”)

1)Network packet filtering

2) TCP/IP networking

1.advanced router

1.IP: policy routing

1.IP: use netfilter MARK value as routing key

3) MPLS support

4) IP: Netfilter Configuration

1.IP tables support (enable all suboptions unless you know what you are

doing, make sure “DSCP match” and “MPLS target” support is available.

5) QoS and/or fair queuing

(enable all suboptions unless you know what you are doing)

6) Network device options

10. the compile: make dep && make clean && make bzImage && make modules && make modules_install

11. In the boot directory: cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.18

12. cp /boot/

13. Now change the grub and reboot

14. Go to iproute2 directory, and turn diffserv on inside config file: Diffserv=y

15. Change the makefile for the kernel path

16. Then: patch –p1 < ../IPROUTE2-rsvpd0.60

17. cp /usr/src/linux/tc/q_htb.c ~rsvp/iproute2/tc/

18. make clean; make

19. cp ip/ip /sbin; cp tc/tc /usr/local/bin

20. Installation of rsvp-te

RSVP-TE Installation


~cd /usr/include/

~mv linux linux.old

~ln -s /usr/src/linux/include/linux linux

check that:

#ls -ld /usr/include/linux

lrwxrwxrwx 1 root root 28 Nov 21 18:14 /usr/include/linux-> /usr/src/linux-2.4.19/include/linux



Note: this method seems to be necessary for RedHat systems Open a file manager window and show subfolders of /usr/src/linux/include .

Right-click on subfolder linux and choose copy. Then, select folder /usr/include, right-click and paste, choosing option ‘Overwrite All’, when requested. This is because RedHat7.1 doesn’t refresh that folder with new kernel data at reboot. For the same reason, in folder /usr/include a symbolic link should be created to folder /usr/src/linux/include/asm-i386.



– Put the downloaded file rsvpd.0.70-rc2.tgz in /home and execute the


~ /home> tar -zxvf rsvpd.0.70-rc2.tgz

This will produce a folder /rsvpd containing all the requested

subfolders and files.

~ /home/rsvp>cd rsvpd

– Now you can compile:

~ /home/rsvp/rsvpd>make clean

~ /home/rsvp/rsvpd>make


The daemon is now compiled and can be found in folder /home/rsvp/rsvpd/rsvpd. Tools are in folder /home/rsvp/rsvpd/labeltest.

Copy the mplsadm executable from /home/rsvp/rsvpd/labeltest to /usr/local/bin.

~ cp labeltest/mplsadm /usr/local/bin

Before running the daemon some configuration files must be set:

~ /home/rsvp/rsvpd>vim label.conf

Check that interfaces name correspond to active devices and change where it is necessary. Save to /etc/label.conf.

~ /home/rsvp/rsvpd>edit ds_config

Check interface names in line

IFACES=’xxx yyy’

~ /home/rsvp>./ds_config