Installing and running Quagga

From CT3

Jump to: navigation, search

By Ivan Pepelnjak

Quagga is an open-source suite of routing protocol daemons. It includes support for OSPF (v2 and v3), BGP (including IPv6 and 4-byte AS support) and RIP (v2 and RIPng). It’s a perfect tool to supplement your router labs, as it gives you simple means of adding extra route sources/sinks in your network. This document describes Quagga installation on Fedora 8.

Contents

Download and compile Quagga

Download the latest sources from the Quagga web site. Expand it into a local directory (for example, /usr/local/src/quagga):

[root@fedora ~]# cd /usr/local/src
[root@fedora src]# tar xfz /tmp/quagga-0.99.11.tar.gz

If you want to run Quagga daemons as non-root user (highly recommended), create a new user and an empty a directory owned by that user. This directory will be used to store configuration files and local state files:

[root@fedora ~]# adduser quagga
[root@fedora ~]# mkdir /usr/local/quagga
[root@fedora ~]# chown quagga:quagga /usr/local/quagga

Configure Quagga with the configure script in the main quagga directory. If you decided to use a quagga-specific user, specify the directory you’ve created in the previous step with the --sysconfdir and --localstatedir parameters. You can exclude individual routing protocols; I’ve decided to exclude all daemons but the BGP daemon.

[root@fedora ~]# cd /usr/local/src/quagga-0.99.11/
[root@fedora quagga-0.99.11]# ./configure --disable-zebra --disable-ripd \
>   --disable-ripngd --disable-ospfd --disable-ospf6d \
>   --sysconfdir=/usr/local/quagga --localstatedir=/usr/local/quagga

The configure script generates a lot of information output as it progresses, finishing with a summary of the configuration it has generated:

Quagga configuration
--------------------
quagga version          : 0.99.11
host operationg system  : linux-gnu
source code location    : .
compiler                : gcc
compiler flags          : -Os -fno-omit-frame-pointer -g -std=gnu99 -Wall 
  -Wsign-compare -Wpointer-arith -Wbad-function-cast -Wwrite-strings 
  -Wmissing-prototypes -Wmissing-declarations -Wchar-subscripts -Wcast-qual
make                    : make
includes                :
linker flags            :  -lcrypt   -lcap  -lm
state file directory    : /usr/local/quagga
config file directory   : /usr/local/quagga
example directory       : /usr/local/quagga
user to run as          : quagga
group to run as         : quagga
group for vty sockets   :
config file mask        : 0600
log file mask           : 0600

The above user and group must have read/write access to the state file
directory and to the config files in the config file directory.

Compile the C sources with make. Install Quagga with make install.

Initial configuratiom

Create initial configuration files for each Quagga daemon in the system configuration directory (/usr/local/quagga in our case). In most cases, it’s enough to include the VTY password in the initial configuration; you can configure the rest through a VTY telnet session (or you could supply a complete IOS-like configuration file):

[root@fedora ~]# cd /usr/local/quagga
[root@fedora quagga]# echo 'password test' >bgpd.conf

Daemon startup

You should start individual daemons as root user.

[root@fedora quagga]# bgpd &
[1] 673

The daemons immediately change their effective user to the quagga user (or the user specified in the arguments to the configure script); you can verify that with the ps command:

[root@fedora quagga]# ps -f -p 673
UID        PID  PPID  C STIME TTY          TIME CMD
quagga     673 18431  0 17:28 pts/3    00:00:00 bgpd

The process ID (PID) of the quagga daemons is stored in the local state directory:

[root@fedora quagga]# ls /usr/local/quagga
bgpd.conf  bgpd.pid
[root@fedora quagga]# cat /usr/local/quagga/bgpd.pid
673

You should use the -d flag to start an individual Quagga routing process as a daemon (disconnected from the current tty session):

[root@fedora quagga]# bgpd –d

The state of the daemon can be verified with the ps command:

[root@fedora quagga]# ps -f -p `cat /usr/local/quagga/bgpd.pid`
UID        PID  PPID  C STIME TTY          TIME CMD
quagga     823     1  0 17:48 ?        00:00:00 bgpd -d

Configuring Quagga daemons

To configure an individual Quagga daemon, connect to the virtual terminal port associated with the daemon. Quagga installation script inserts symbolic names for all quagga daemons into the /etc/services file, making it easier to select the correct TCP port number. For example, to connect to the BGP daemon, use telnet localhost bgpd.

Quagga daemons use CLI that is almost identical to Cisco IOS CLI, with a few minor fixes (for example, you can specify an IP subnet mask as a prefix). With the initial bgpd.conf file created in the previous section containing just the VTY password, the host name displayed by the BGP daemon is identical to the Linux host name (but of course you can change that with the hostname global configuration command). A simple VTY session including configuration and show commands is shown in the following printout:

[root@fedora quagga]# telnet localhost bgpd
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

Hello, this is Quagga (version 0.99.11).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

User Access Verification

Password:
fedora.nil.si> enable
fedora.nil.si# conf t
fedora.nil.si(config)# hostname R1
R1(config)# router bgp 65000
R1(config-router)# network 10.1.2.0/24
R1(config-router)# ^Z
R1# wr
Configuration saved to /usr/local/quagga/bgpd.conf
R1# show ip bgp
BGP table version is 0, local router ID is 0.0.0.0
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 10.1.2.0/24      0.0.0.0                  0         32768 i

Total number of prefixes 1
R1# exit
Connection closed by foreign host.
Each Quagga daemon uses its own configuration file, which can contain global configuration commands. If you change one of the global settings (for example, hostname) when configuring one of the daemons, the change is not propagated automatically to other daemons.

Stopping Quagga daemons

The process IDs of individual Quagga daemons are stored in the local state directory. To kill an individual daemon, use the PID from the corresponding *.pid file. For example, you can use the following command to kill the BGP daemon:

[root@fedora ~]# kill `cat /usr/local/quagga/bgpd.pid`
Personal tools

CT3

Main menu