Install and configure Quagga in Ubuntu

Quagga is a network routing software available in most GNU/Linux, Solaris, FreeBSD, and NetBSD. It provides the implementation of OSPF (Open Shortest Path First), RIP (Routing Information Protocol), BGP (Border Gateway Protocol) and IS-IS. It is distributed under GNU GPL license.


This tutorial shows you how to install and then configure Quagga in Ubuntu Linux. I am using the latest version of Ubuntu 13.10 however it should be applicable for the version prior to 13.10.

1. Install quagga using apt-get

$ sudo apt-get install quagga

The Quagga files and configurations will be stored in /etc/quagga. You can enable or disable daemons routing in the /etc/quagga/daemons file. The sample config files can be found in /usr/share/doc/quagga/examples/.

Please note that, when activate a daemon for the first time, a config file, even if it is empty, must be present and be owned by the user and group ‘quagga’. Otherwise the daemon will not be started. The permission should be u(user)=rw, g(group)=r, and o(other)=nothing.

2. Create an empty config file (zebra.conf for example) and set the permissions

$ sudo touch /etc/quagga/zebra.conf
$ sudo chown quagga.quagga /etc/quagga/zebra.conf
$ sudo chmod 640 /etc/quagga/zebra.conf

If you are configuring via telnet, at least the password must be set, else you will get error messages telling you that the Vty password is not set as below:

$ telnet localhost zebra
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Vty password is not set.
Connection closed by foreign host.

So lets set the password first.

$ sudo echo "password typeyourpasswordhere" >> /etc/quagga/zebra.conf

3. Activate the daemon in /etc/quagga/daemons file by changing the value to ‘yes’. Before activating the daemon, make sure that you have created the config files for each daemon, else the daemon will not be started.

4. Start the quagga.

Simply run the following command to start the Quagga

$ sudo /etc/init.d/quagga start
Loading capability module if not yet done.
Starting Quagga daemons (prio:10): zebra.
Starting Quagga monitor daemon: watchquagga.

5. Now try to telnet the localhost with zebra port

You should be able to telnet to localhost to the running daemon name / port. Type the password to login, then type ‘enable’ to get the full privileges.

$ telnet localhost zebra
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

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


User Access Verification

Password: 
ubuntu> enable
ubuntu# 

You are ready to set the IP address via zebra. Repeat the step-by-step above on configuring BGP (bgpd.conf), OSPF (ospfd.conf) and more.
Note that quagga is Cisco-like command so you should have familiarity with the Cisco command.

  • Kamarul Ariffin A. Zukhi

    it is possible to install Quagga on Raspbian OS?

  • sammy

    hi, i m trying to understand and use quagga. i have installed quagga and next i wanna connect it to a controller but i am confused as to how to do that, if anyone can help it will be really useful. Thanks in advance.

    • Hi, What do you mean with controller? Is it a Cisco / Juniper router running BGP / OSPF routing?

  • tahir abbas

    hello , i am installing quagga on linux and wants to communicate quagga with cisco router , can u plz help me with the whole procedure , i.e. step by step , it will helps me alot , thnx

    • Hi tahir abbaz, very sorry for the late reply. To communicate Quagga with Cisco router, you can directly connected it trough a cable or install a switch in between. You can assign IP address on both Linux/Quagga and Cisco on physical or VLAN interface. It should be easy to do that if you have basic knowledge about networking. Hopefully it will help.

  • Hi, nice post. But have you try to install the Quagga through the configure source code ? I cannot pass the configure

    • Can you post the error message when it said failed to configure? Thanks

      • I have solved this problem already, thankyou also

        • Fabio Zaccantte

          Hi vinllen, can you help me, I cannot pass the configure when i try to install the Quagga through the configure source code. If i use “sudo apt-get install quagga”, i won´t have the source code.

          • Hi Fabio, Can you post the error messages when you install it from source code or apt-get tool? Thanks

          • Fabio Zaccantte

            hi, i am doing
            http://www.nongnu.org/quagga/
            http://download.savannah.gnu.org/releases/quagga/

            download –> quagga-0.99.24.tar.gz 03-Mar-2015 00:07
            tar -xvf quagga-0.99.24.tar.gz
            cd quagga-0.99.24
            ./configure

            The message error is :
            configure: error: cannot find install-sh, install.sh, or shtool in “.” “./..” “./../..”

            I am using Ubuntu 14 linux, Quagga will be only in the Freebsd or any operational system?

            sudo apt-get install quagga, done, but i want source code to study.

            Someone can help me with a doc.

          • Hi, there is missing ‘install-sh’ script on this version. Download the ‘quagga-0.99.24.1.tar.gz’ instead. You may need to install compilers to be able to compile from sources. ‘sudo apt-get install build-essential autoconf automake’ will do the job

          • Fabio Zaccantte

            Hi, thank you very much for your tips, i did ./configure

            Quagga configuration
            ——————–
            quagga version : 0.99.24.1
            host operating 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
            linker flags : -rdynamic -lcrypt -lrt -lm
            state file directory : /var/run
            config file directory : /usr/local/etc
            example directory : /usr/local/etc
            user to run as : quagga
            group to run as : quagga
            group for vty sockets :
            config file mask : 0600
            log file mask : 0600

            but when a try make, the error occurs:

            make[3]: Entering directory `/home/zaccantte/tools/quagga-0.99.24.1/isisd’
            CC isis_main.o
            isis_main.c: In function ‘main’:
            isis_main.c:249:3: warning: ignoring return value of ‘getcwd’, declared with attribute warn_unused_result [-Wunused-result]
            getcwd (_cwd, sizeof (_cwd));
            ^
            isis_main.c:352:5: warning: ignoring return value of ‘daemon’, declared with attribute warn_unused_result [-Wunused-result]
            daemon (0, 0);
            ^
            CCLD isisd
            make[3]: Leaving directory `/home/zaccantte/tools/quagga-0.99.24.1/isisd’
            make[2]: Leaving directory `/home/zaccantte/tools/quagga-0.99.24.1/isisd’
            Making all in watchquagga
            make[2]: Entering directory `/home/zaccantte/tools/quagga-0.99.24.1/watchquagga’
            CC watchquagga.o
            watchquagga.c: In function ‘run_background’:
            watchquagga.c:349:18: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual]
            execv(“/bin/sh”,(char *const *)argv);
            ^
            CCLD watchquagga
            make[2]: Leaving directory `/home/zaccantte/tools/quagga-0.99.24.1/watchquagga’
            Making all in ospfclient
            make[2]: Entering directory `/home/zaccantte/tools/quagga-0.99.24.1/ospfclient’
            CC ospf_apiclient.lo
            CCLD libospfapiclient.la
            CCLD ospfclient
            make[2]: Leaving directory `/home/zaccantte/tools/quagga-0.99.24.1/ospfclient’
            Making all in doc
            make[2]: Entering directory `/home/zaccantte/tools/quagga-0.99.24.1/doc’
            make all-am
            make[3]: Entering directory `/home/zaccantte/tools/quagga-0.99.24.1/doc’
            MAKEINFO quagga.info
            make[3]: Leaving directory `/home/zaccantte/tools/quagga-0.99.24.1/doc’
            make[2]: Leaving directory `/home/zaccantte/tools/quagga-0.99.24.1/doc’
            Making all in m4
            make[2]: Entering directory `/home/zaccantte/tools/quagga-0.99.24.1/m4′
            make[2]: Nothing to be done for `all’.
            make[2]: Leaving directory `/home/zaccantte/tools/quagga-0.99.24.1/m4′
            Making all in redhat
            make[2]: Entering directory `/home/zaccantte/tools/quagga-0.99.24.1/redhat’
            make[2]: Nothing to be done for `all’.
            make[2]: Leaving directory `/home/zaccantte/tools/quagga-0.99.24.1/redhat’
            Making all in tests
            make[2]: Entering directory `/home/zaccantte/tools/quagga-0.99.24.1/tests’
            make all-recursive
            make[3]: Entering directory `/home/zaccantte/tools/quagga-0.99.24.1/tests’
            Making all in bgpd.tests
            make[4]: Entering directory `/home/zaccantte/tools/quagga-0.99.24.1/tests/bgpd.tests’
            make[4]: Nothing to be done for `all’.
            make[4]: Leaving directory `/home/zaccantte/tools/quagga-0.99.24.1/tests/bgpd.tests’
            Making all in libzebra.tests
            make[4]: Entering directory `/home/zaccantte/tools/quagga-0.99.24.1/tests/libzebra.tests’
            make[4]: Nothing to be done for `all’.
            make[4]: Leaving directory `/home/zaccantte/tools/quagga-0.99.24.1/tests/libzebra.tests’
            make[4]: Entering directory `/home/zaccantte/tools/quagga-0.99.24.1/tests’
            make[4]: Nothing to be done for `all-am’.
            make[4]: Leaving directory `/home/zaccantte/tools/quagga-0.99.24.1/tests’
            make[3]: Leaving directory `/home/zaccantte/tools/quagga-0.99.24.1/tests’
            make[2]: Leaving directory `/home/zaccantte/tools/quagga-0.99.24.1/tests’
            make[2]: Entering directory `/home/zaccantte/tools/quagga-0.99.24.1′
            make[2]: Leaving directory `/home/zaccantte/tools/quagga-0.99.24.1′
            make[1]: Leaving directory `/home/zaccantte/tools/quagga-0.99.24.1′
            root@farzacsystem:/home/zaccantte/tools/quagga-0.99.24.1#

            will be the correct output?

          • Fabio Zaccantte

            Hi, i able to installing of quagga,
            I did, ./configure, make and sudo make install

            But now, how running the quagga?

          • If you installed it using apt-get tool, simply type “sudo /etc/init.d/quagga start” to start it. If built from source, type “sudo quagga -d”
            You may need to specify the config files / directory and make sure that ‘quagga’ is already in your system PATH.

          • Fabio Zaccantte

            Hi, done.
            Thank you very much.

          • Hi, Glad to hear that it is working and running.

          • You can download the source code from the website: http://download.savannah.gnu.org/releases/quagga/

  • pi

    Can i use these steps on rasberry pi ?

    • If the RasPi uses the same Linux, you should be able to use the above steps on it.

      • pi

        how can i know that?