Quagga

From DD-WRT Wiki

Jump to: navigation, search

Contents


[edit] Introduction

Quagga is the successor/fork of Zebra which was developed until 09/2005. It's a Routing software that provides support for the most important protocols OSPFv2, OSPFv3, RIP v1 and v2, RIPng, IS-IS and BGP-4 (MPLS support exists but it's not activly maintained). On DD-WRT, Quagga is delivered with builds for devices with >4MB flash. On devices with <=4MB flash we use the Bird routing daemon because of it's very small size.

Quagga is split into different daemons. Each routing Protocol has its own daemon. This provides flexibility so that each protocol can be managed separately.

  • zebra (core daemon. communication layer to the underlying Linux kernel and provides routing updates to the client daemons)
  • ospfd (implementing OSPFv2)
  • ospf6d (implementing OSPFv3 (IPv6))
  • ripd (implementing RIP v1 and V2)
  • ripngd (implementing RIPng (IPv6))
  • bgpd (implementing BGPv4+ (including address family support for multicast and IPv6))
  • mlps (basic mlps implementation via "mlps for linux")

Quagga provides cli interface for configuration called vtysh that has a Cisco style admin language. So any of you familar with IOS would prefer this for config.

[edit] Configuration

Quagga is a very powerfull routing tool and i wont discribe anything in detail here. I just show how to do a basic setup to get your link up and running. Any more detailed setup must be done by yourself. Some useful instructions can be found in the links.

As of this writing you have to do all of the configs into the config fields
One line one instruction.
"!" or "#" as 1st sign in line then the line is interpreted as comment line

[edit] Required DD-WRT settings

Do your setup as usual. Unbridge the interface you want to use with Quagga. Since Quagga (Zebra daemon) is able to do unnumbered links (you wont have to set the IP in the zebra.conf anymore) set the unbridged interface to the needed IP address.

[edit] Zebra

As mentioned above Zebra is the commication daemon between the kernel and the routing daemons. So it must be configured to tell his daemons what interfaces to use.

interface ath0

the interface you want to use

description ab cd

how u would call your link

bandwidth 5000

this is used for cost calculation and could be removed if unused

hostname zebra
log file /var/log/ospf

file where us wana log. the gui logging isnt working correctly atm

[edit] Zebra example

interface ath0
description AP A <-> AP B
bandwidth 45000
#
interface eth1
description Router A <-> Router C
bandwidth 100000
#
hostname zebra
log file /var/log/ospf

[edit] OSPF

We have 2 ways of configuring Quagga. The 1st is vtysh, the cli client with IOS admin style config and 2nd via DD-WRT Web-If where you can write config directly into the *.conf files stored in NV-RAM and executed from /tmp/
Since the vtysh language isn't that intuitive we will use it here only vor checking the daemon states.
-default link cost = 20

router ospf
ospf router-id 10.5.0.1
network 10.4.2.0/24 area 0
#
redistribute kernel
redistribute connected
redistribute static
default-information originate
passive-interface lo
passive-interface br0:0
#
log file /var/log/ospf
hostname Kindergarten_Wibo

[edit] OSPF tips

To see what routes we're actually originating, one must issue the following CLI command:

router# show ip ospf database self-orig

This will show all routes we announce to other neighbor(s)/areas.

To see all neighbors in a specific area, one must issue the following CLI command:

router# show ip ospf database

and seek for a part entitled "Router Link States (area a.b.c.d)".

To see directly connected neighbors in a specific area, do this:

router# show ip ospf neighbors

[edit] OSPF example

router ospf
 ospf router-id 10.2.0.1
#
network 10.1.2.0/24 area 0
network 10.2.4.0/24 area 0
#
redistribute kernel
redistribute connected
redistribute static
default-information originate
# 
passive-interface lo
passive-interface br0:0
#
log file /var/log/ospf
hostname ospf

[edit] Quaggawatchdog

Watchdog program to monitor status of quagga daemons and try to restart them if they are down or unresponsive. It determines whether a daemon is up based on whether it can connect to the daemon's vty unix stream socket. It then repeatedly sends echo commands over that socket to determine whether the daemon is responsive. If the daemon crashes, we will receive an EOF on the socket connection and know immediately that the daemon is down.

The daemons to be monitored should be listed on the command line.
This program can run in one of 5 modes:

0. Mode: %s.
Just monitor and report on status changes. Example:

%s -d zebra ospfd bgpd

1. Mode: %s.
Whenever any daemon hangs or crashes, use the given command to restart them all. Example:

%s -dz -R '/sbin/service zebra restart; /sbin/service ospfd restart' zebra ospfd

2. Mode: %s. When any single daemon hangs or crashes, restart only the daemon that's in trouble using the supplied restart command. Example:

%s -dz -r '/sbin/service %%s restart' zebra ospfd bgpd

3. Mode: %s. The same as the previous mode, except that there is special treatment when the zebra daemon is in trouble. In that case, a phased restart approach is used: 1. stop all other daemons; 2. restart zebra; 3. start the other daemons. Example:

%s -adz -r '/sbin/service %%s restart'

-s '/sbin/service %%s start'
-k '/sbin/service %%s stop' zebra ospfd bgpd
4. Mode: %s.
This is the same as the previous mode, except that the phased restart procedure is used whenever any of the daemons hangs or crashes. Example:

%s -Adz -r '/sbin/service %%s restart'

-s '/sbin/service %%s start'
-k '/sbin/service %%s stop' zebra ospfd bgpd
As of this writing, it is believed that mode 2 [%s] is not safe, and mode 3 [%s] may not be safe with some of the routing daemons. In order to avoid attempting to restart the daemons in a fast loop, the -m and -M options allow you to control the minimum delay between restart commands. The minimum restart delay is recalculated each time a restart is attempted: if the time since the last restart attempt exceeds twice the -M value, then the restart delay is set to the -m value. Otherwise, the interval is doubled (but capped at the -M value).

Options:

-d, --daemon    Run in daemon mode.  In this mode, error messages are sent  
                to syslog instead of stdout.  
-S, --statedir  Set the vty socket directory (default is %s)  
-e, --no-echo   Do not ping the daemons to test responsiveness (this\  
                option is necessary if the daemons do not support the echo command)  
-l, --loglevel  Set the logging level (default is %d).  
                The value should range from %d (LOG_EMERG) to %d (LOG_DEBUG),  
                but it can be set higher than %d if extra-verbose debugging  
                messages are desired.  
-m, --min-restart-interval  
                Set the minimum seconds to wait between invocations of daemon  
                restart commands (default is %d).  
-M, --max-restart-interval  
                Set the maximum seconds to wait between invocations of daemon  
                restart commands (default is %d).  
-i, --interval  Set the status polling interval in seconds (default is %d)  
-t, --timeout   Set the unresponsiveness timeout in seconds (default is %d)  
-T, --restart-timeout  
                Set the restart (kill) timeout in seconds (default is %d).  
                If any background jobs are still running after this much  
                time has elapsed, they will be killed.  
-r, --restart   Supply a Bourne shell command to use to restart a single  
                daemon.  The command string should include '%%s' where the  
                name of the daemon should be substituted.  
                Note that -r and -R are incompatible.  
-s, --start-command  
                Supply a Bourne shell to command to use to start a single  
                daemon.  The command string should include '%%s' where the  
                name of the daemon should be substituted.  
-k, --kill-command  
                Supply a Bourne shell to command to use to stop a single  
                daemon.  The command string should include '%%s' where the  
                name of the daemon should be substituted.  
-R, --restart-all  
                When one or more daemons is down, try to restart everything  
                using the Bourne shell command supplied as the argument.  
                Note that -r and -R are incompatible.  
-z, --unresponsive-restart  
                When a daemon is unresponsive, treat it as being down for  
                restart purposes.  
-a, --all-restart  
                When zebra hangs or crashes, restart all daemons using  
                this phased approach: 1. stop all other daemons; 2. restart  
                zebra; 3. start other daemons.  Requires -r, -s, and -k.  
-A, --always-all-restart  
                When any daemon (not just zebra) hangs or crashes, use the  
                same phased restart mechanism described above for -a.  
                Requires -r, -s, and -k.  
-p, --pid-file  Set process identifier file name  
                (default is %s).  
-b, --blank-string  
                When the supplied argument string is found in any of the  
                various shell command arguments (-r, -s, -k, or -R), replace  
                it with a space.  This is an ugly hack to circumvent problems  
                passing command-line arguments with embedded spaces.  
-v, --version   Print program version  
-h, --help      Display this help and exit 

[edit] Glossary

BGP: Border Gateway Protocol
ISIS: Intermediate System to Intermediate System Protocol
OSPF: Open Shortest Path First
RIP: Routing Information Protocol

[edit] Links

http://www.runet.edu/~rwtibbs/zebra-stuff/zebra_toc.html#SEC_Contents
http://www.de.quagga.net/docs.php
https://sourceforge.net/projects/mpls-linux/files/