Aller au contenu

Creating a Linux FRRouting Appliance

This document describe how to prepare a QEMU image running the latest version of FRR Routing and to use it inside GNS3.

Create a Linux VM

With the following characteristics:

  • 1vCPU
  • 512 MB RAM
  • 4 Network Interfaces, bridged
  • user root, password root
  • user user, password user
  • No GUI
  • Packages to install:
    • SSH Server
    • gnupg, curl, git
    • sudo

You can choose between a Debian or Ubuntu distribution:

Add dev packages

In order to get the latest version of tools and/or kernel, you can add the dev packages repository.

On Debian:

  • use the command apt edit-sources and add the following source:
    deb http://deb.debian.org/debian bullseye-backports main contrib non-free
    
  • Update APT’s cache to include the backports in the list of available packages:
    apt update
    

Special packages for SRv6

We need the latest version of the iproute2 tools:

apt -t bullseye-backports install iproute2

Kernel upgrade from 5.x

As of the writing of this document, it seem’s that kernel 5.19 is mostly fully supporting SRv6. Once the Debian Backports are available, install this kernel with:

apt -t bullseye-backports install linux-image-5.19.0-0.deb11.2-amd64
Then reboot.

If you would like to test with the latest kernel version (6.x), here are some links:

Network interfaces

Interface name

We prefer to work with old interface name, on Debian you can restore old interface name (ethx).

Don’t forget to add all the interfaces in your /etc/network/interfaces file:

allow-hotplug eth1
iface eth1 inet dhcp
...

Additional Loopback

For some network simulation we need additional Loopback interfaces. Linux allows us to create dummy interfaces. You need to edit the /etc/network/interfaces file and add for example four new interfaces:

auto lo1
iface lo1 inet manual
   pre-up ip link add $IFACE type dummy
   up ip link set dev $IFACE up

auto lo2
iface lo2 inet manual
   pre-up ip link add $IFACE type dummy
   up ip link set dev $IFACE up

auto lo3
iface lo3 inet manual
   pre-up ip link add $IFACE type dummy
   up ip link set dev $IFACE up

auto lo4
iface lo4 inet manual
   pre-up ip link add $IFACE type dummy
   up ip link set dev $IFACE up

VRF Creation

If you plan to use VRF in your simulation, you can add VRF instances to your Linux box. For exemple, to create the Client1 VRF, modify the file /etc/network/interfaces with:

auto Client1
iface Client1 inet manual
    pre-up ip link add $IFACE type vrf table 10
    up ip link set dev $IFACE up 
auto eth3
iface eth3 inet manual
    pre-up ip link set $IFACE master Client1

Kernel settings for SRv6:

This is necessary to allow IP forwarding and to activate some Segment Routing or MPLS features.

cat > /etc/sysctl.d/90-ip-forwarding.conf 
net.ipv4.conf.all.forwarding=1
net.ipv6.conf.all.forwarding=1

cat > /etc/modules-load.d/modules.conf 
mpls_router
mpls_gso
mpls_iptunnel
vrf

cat > /etc/sysctl.d/91-mpls.conf
net.mpls.conf.lo.input=1
net.mpls.conf.eth0.input=1
net.mpls.conf.eth1.input=1
net.mpls.conf.eth2.input=1
net.mpls.conf.eth3.input=1
net.mpls.platform_labels=1048575

cat > /etc/sysctl.d/95-srv6.conf
net.vrf.strict_mode = 1
net.ipv4.conf.all.rp_filter = 0
net.ipv6.seg6_flowlabel = 1
net.ipv6.conf.all.seg6_enabled = 1

If some of the variable are not set after a reboot, you can use this command to modify it’s value (for example):

sysctl -w net.vrf.strict_mode=1

Console access for GNS3:

Edit the file /etc/default/grub (i.e. vi, nano) as root or with a user with sudo rights. Configure the following parameters or create them:

GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"

Note

If you already have some commands in the GRUB_CMDLINE_LINUX, just append the above command. Don’t create a second line with this variable ;-)

Save the changes. Update the grub by running the following command as root:

update-grub2
Reboot, it’s ready !

FRR Installation

Base installation

Remarks: the prerequisites in terms of modules to compile from source code is the following:

sudo apt-get install git autoconf automake libtool make \
libreadline-dev texinfo libjson-c-dev pkg-config bison flex \
libc-ares-dev python3-dev python3-pytest python3-sphinx build-essential \
libsnmp-dev libcap-dev libelf-dev libunwind-dev libyang2-dev

We can let the default settings for the ./configure, make, etc.

Zebra Local users

This local user is for a direct login without password, and starting the FRR shell.

adduser zebra
usermod -aG sudo zebra
adduser zebra frr
adduser zebra frrvty

Direct access to the FRR console

  • Suppress the password by removing :x: for the zebrauser in the file /etc/passwd
  • Automatic starting of the FRR console :
    root # su - zebra
    user % vi ~/.profile
    
    Insert the following line at the end:
    vtysh
    

Auto-start FRR Daemons

Automatic start of FRR processes by editing the file /etc/frr/daemons:

...
bgpd=yes
ospfd=yes
ospf6d=yes
ripd=no
ripngd=yes
isisd=yes
pimd=no
ldpd=yes
nhrpd=no
eigrpd=yes
babeld=yes
sharpd=no
pbrd=no
bfdd=yes
fabricd=yes
vrrpd=no
pathd=no
...

Export VM

Once the VM is ready, export it in the OVA format.

Qemu image creation

Once you have copied the OVA image on the GNS-3 VM, you can create the Qemu image:

  • tar -xvf <image name>.ova
  • qemu-img convert -O qcow2 <image name>-disk1.vmdk frr841.qcow2

GNS-3 FRR Template creation

With the FRR Qemu image, you can now create a FRR Template directly on GNS-3.

Useful tools

References

  1. https://www.uni-koeln.de/~pbogusze/posts/Building_64bit_alpine_linux_GNS3_FRRouting_appliance.html

Dernière mise à jour: 3 October 2023