Network Engineers are always looking for new ways to gain some low-cost network testing capabilities. Few companies sufficiently fund networking labs for their networking teams to learn on prior to deployment. Many have use Cisco IOS hypervisors on laptops using the Graphical Network Simulator (GNS3), Dynagen and Dynamips that allow experimentation and learning. While you wait for Cisco’s Virtual Internet Routing Lab (VIRL) to be released you can explore using a Raspberry Pi as a low-cost router for testing.

Getting the Raspberry Pi Going:

A few weeks ago I wrote about how you could create a low-cost remote network monitoring node using a Raspberry Pi. This blog contains the information required to get your Raspberry Pi ready and loaded with the Raspbian OS and working on a dual-protocol network. The article also talked about how you could place the Raspberry Pi on the border between two networks and set it up as a router. To do this requires several USB Ethernet interfaces in addition to the on-board Ethernet interface. This would likely mean purchasing a powered USB hub to provide power to those USB devices. This article dives in deeper into how to setup the Raspberry Pi as a dual-protocol router using OSPF.

Routing Configuration Steps:

The first thing that you need to do is load the router software onto the Raspberry Pi. The idea behind the Raspberry Pi is that is comes with a stripped down OS and then you add the specific functions you need. Since not every Raspberry Pi needs to behave like a router, the routing software is not pre-loaded. There are many open-source routing software packages available (Bird Internet routing daemon (Bird), eXtensible Open Router Platform (XORP), among others), However, for our purposes we have chosen Quagga.

The commands that you will need to execute to install the needed routing packages are as follows.

sudo apt-get install quagga
sudo apt-get install radvd

We may also need to install Routing Advertisement Daemon (RADVD) if we want to send specific ICMPv6 Router Advertisement (RA) packets or use RDNSS, MIPv6, NEMO, or 6to4 tunneling.

Once this software is installed (with their dependencies) it is time to start to configure the Raspberry Pi as a router. To more easily understand the configuration, here is a diagram of the network topology.

To configure the IPv4 and IPv6 addresses on the various interfaces we need to edit the /etc/network/interfaces configuration file using your favorite text editor. Below is an example of what that file looks like.

Once the addresses are statically assigned to the interface, we can reset the networking to apply this new configuration file using the following command.

sudo /etc/init.d/networking restart

Configuring OSPFv2 and OSPFv3:

Most all modern routers now support dual-protocol routing protocols. In a previous post I wrote about how you can configure a Cisco IOS router for use with OSPFv3. It is very easy to establish interoperability between a Raspberry Pi running Quagga and a Cisco IOS router.

The first thing we need to do is enable the Quagga daemons file.

sudo vi /etc/quagga/daemons

We want this file to have the following configuration lines set to “yes”.

zebra=yes
ospfd=yes
ospf6d=yes

Next we need to configure the basic Zebra (the routing package that Quagga is based on) configuration file.

sudo vi /etc/quagga/zebra.conf

We will modify this file to look like the following. This is the config files for the router named “Tuesday”.

If you are interfacing your Raspberry Pi with a Cisco router and trying to configure OSPFv3 IPsec Authentication Header (AH) authentication, then you should be aware of some limitations here. You can also run into OSPFv3 authentication limitations on Cisco 6500 switches.

Verifying Operation:

Now that Quagga is running OSPFv2 and OSPFv3 we need to verify the configuration. The way this is done with Quagga is to use telnet to connect to the console port of the router. The various Quagga routing processes have different TCP port numbers.