How to install Quagga on Centos 6.5

centosNamed after an extinct sub-species of the African zebra, Quagga is a fork of the GNU Zebra project routing software package,  which was discontinued in 2005, providing implementations of OSPF, RIP, BGP, and ISIS for *nix based systems.

Quagga can be used to turn your *nix system into a software based router, however it is more typically used as route server in an eBGP peering environment or as a route reflector in iBGP implementations that are not fully meshed.

Components of Quagga.

Quagga consists of multiple daemons, one for each routing protocol, called Zserv clients and a  core Zebra daemon. The core Zebra daemon is an abstraction layer to the underlying *nix kernel.

The Zserv clients typically implement the routing protocol and communicate routing updates to the zebra daemon.  The zebra daemon then updates the kernel routing table and caters for redistribution of routes between the Zserv clients.

The current supported Zserv clients are:

  • ospfd, implementing Open Shortest Path First (OSPFv2).
  • isisd, implementing Intermediate System to Intermediate System (ISIS).
  • ripd, implementing Routing Information Protocol (RIP) version 1 and 2.
    ospf6d, implementing Open Shortest Path First (OSPFv3) for IPv6.
  • ripngd, implementing Routing Information Protocol (RIPng) for IPv6.
  • bgpd, implementing Border Gateway Protocol (BGPv4+), including address family support for IP multicast and IPv6.

This multi process architecture has the advantage of being modular however it also means that there is a different configuration file and terminal for each routing protocol being run. To get round this Quagga provides an integrated user shell called vtysh which connects to each daemon through a Unix-domain socket and then acts as a proxy for user input.

Installation

In this guide we will be installing the latest version, which at the time of writing is version 0.99.24, from source.

If you have not already installed the Development tool package group you should install it using the following:

Next download the latest version of Quagga from http://download.savannah.gnu.org/releases/quagga/:

Next extract the downloaded tar file and change into the Quagga directory:

Now that we have extracted the package there are basically three steps to be completed when installing Quagga from source:

  • Configure
  • Compile
  • Install
Configure

Quagga uses a configuration script which automatically detects most of the host configurations as well as providing additional options to disable the compilation of certain daemons.

In this case I will be disabling the compilation of ripd, ripngd, ospfd, and ospf6d using the following options:

  • –disable-ripd
  • –disable-ripngd
  • –disable-ospfd
  • –disable-ospf6d

By default, the executables are placed in /usr/local/sbin and the configuration files in /usr/local/etc.

The /usr/local/ installation prefix and other directories may be changed using the following options to the configuration script.

  • –prefix=prefix Install architecture-independent files in prefix.
  • –sysconfdir=dir Look for configuration files in dir [prefix/etc]. Note that sample configuration files will be installed here.
  • –localstatedir=dir Configure zebra to use dir for local state files, such as pid files and unix sockets.

I will be using the default install locations so the following configure command is running to compile the package:

Sample output:

If you get the following error when trying to run the configuration script:

Run the following command to build the required autoconf files:

Build the software

After configuring the software, you will need to compile it for your system. Simply issue the command make in the root of the source directory and the software will be compiled.

Sample output:

Setup

In order to use Quagga you first need to set the permissions on the configuration files so that Quagga can read and write to the files. First you need to create a user and group called Quagga:

Sample output:

Once you have created the user accounts you need assign read and write permissions for the user and group to the directories holding the Quagga configuration files, if you used the default locations during the compilation then the configuration files will be in /usr/local/etc and the process id will be stored in /var/run/bgpd.pid:

First we change the user and the group for the Quagga directories:

We also need to ensure that the correct permissions are in place to start the bgp daemon:

Next create the file in /var/run that will hold the pid information for the bgpd process, we also need to ensure the correct permissions have been assigned to the file:

Next we need to create a configuration file for each of the daemons that we will be using, in this case we will create the base configuration for the bgpd daemon:

Once we have copied the sample config we can start the bgpd daemon so that we can use vty to finish of the configuration.

You ruse the following command to start the bgpd daemon:

Sample output:

Confirm that the bgpd daemon is running correctly:

Sample output:

Once we have confirmed that the bgpd daemon is running we can telnet into the vty session for the bgpd daemon to finish the remainder of the configuration, by default the password is “zebra”:

Once you have a vty session into the bgpd daemon the command syntax is almost exactly the same as the Cisco IOS command syntax.

Example

In the following example we will test the Quagga server by setting up an eBGP session to a Cisco router. The network diagram is as follows:

Selection_008

As this is a simple example to test the Quagga bgpd daemon we will not be using any route-maps or prefix filters. There are simply three /24 prefixes on each AS that have been inserted into the routing table via nailed down routes. The sessions are then configured using the network commands under the bgp router process.

Cisco router Config:

Quagga Config:

As you can see to advertise the prefixes out Quagga you only need to add the network command to the BGP router process, these prefixes would normal be learned via an iBGP session or another eBGP session and i added them purely to show that the Cisco router received the advertised prefixes:

From the Quagga bgpd daemon we can also see that the session has established and we are learning the routes from the Cisco router:

References: 

http://www.nongnu.org/quagga/

http://wiki.nil.com/Installing_and_running_Quagga

https://opensourcecentre.wordpress.com/article/install-quagga-as-linux-router/

http://xmodulo.com/turn-centos-box-into-ospf-router-quagga.html

FacebookTwitterGoogle+Share

One thought on “How to install Quagga on Centos 6.5”

Leave a Reply