Overview
Quagga is an open-source routing software suite that implements major routing protocols including OSPF (Open Shortest Path First), BGP (Border Gateway Protocol), RIP (Routing Information Protocol), and IS-IS. Originally forked from GNU Zebra, Quagga turns a standard Linux or Unix machine into a capable multi-protocol router. It uses a modular architecture where each protocol runs as a separate daemon, all coordinated by the central zebra daemon which manages the kernel routing table and provides a unified interface.
Quagga’s configuration syntax closely mirrors Cisco IOS, making it accessible to network engineers familiar with enterprise routing equipment. Each protocol daemon exposes a VTY (Virtual TeleTYpe) shell accessible via telnet on distinct ports, allowing independent configuration and monitoring. Quagga is widely used in network labs, ISP edge deployments, route servers at Internet Exchange Points (IXPs), and academic research environments where commercial router hardware is cost-prohibitive.
Installation
Debian/Ubuntu
sudo apt update
sudo apt install quagga quagga-doc
# Enable IP forwarding
sudo sysctl -w net.ipv4.ip_forward=1
echo "net.ipv4.ip_forward=1" | sudo tee -a /etc/sysctl.conf
# Create config files from samples
sudo cp /usr/share/doc/quagga/examples/zebra.conf.sample /etc/quagga/zebra.conf
sudo cp /usr/share/doc/quagga/examples/ospfd.conf.sample /etc/quagga/ospfd.conf
sudo cp /usr/share/doc/quagga/examples/bgpd.conf.sample /etc/quagga/bgpd.conf
# Set ownership
sudo chown quagga:quagga /etc/quagga/*.conf
sudo chmod 640 /etc/quagga/*.conf
CentOS/RHEL
sudo yum install quagga
sudo sysctl -w net.ipv4.ip_forward=1
# Disable SELinux for quagga or set appropriate booleans
sudo setsebool -P zebra_write_config 1
From Source
git clone https://git.savannah.gnu.org/git/quagga.git
cd quagga
./bootstrap.sh
./configure --enable-vtysh --enable-user=quagga --enable-group=quagga
make
sudo make install
Daemon Architecture
| Daemon | Protocol | Default VTY Port | Config File |
|---|
zebra | Kernel/RIB | 2601 | zebra.conf |
ripd | RIPv2 | 2602 | ripd.conf |
ripngd | RIPng | 2603 | ripngd.conf |
ospfd | OSPFv2 | 2604 | ospfd.conf |
ospf6d | OSPFv3 | 2606 | ospf6d.conf |
bgpd | BGP-4 | 2605 | bgpd.conf |
isisd | IS-IS | 2608 | isisd.conf |
Enable Daemons
# Edit /etc/quagga/daemons
zebra=yes
bgpd=yes
ospfd=yes
ripd=no
ripngd=no
ospf6d=no
isisd=no
Start Services
sudo systemctl start zebra
sudo systemctl start ospfd
sudo systemctl start bgpd
sudo systemctl enable zebra ospfd bgpd
VTY Shell (vtysh)
# Enter unified shell
sudo vtysh
# Connect to specific daemon
telnet localhost 2601 # zebra
telnet localhost 2604 # ospfd
telnet localhost 2605 # bgpd
Common VTY Commands
| Command | Description |
|---|
show ip route | Display routing table |
show ip ospf neighbor | Show OSPF neighbor adjacencies |
show ip bgp summary | BGP peer summary |
show running-config | Show current configuration |
write memory | Save config to file |
configure terminal | Enter config mode |
show interface | Display interface details |
show ip ospf database | Show OSPF link-state database |
show ip bgp | Display BGP routing table |
debug ospf packet all | Enable OSPF packet debugging |
OSPF Configuration
sudo vtysh
configure terminal
router ospf
ospf router-id 1.1.1.1
network 10.0.0.0/24 area 0
network 192.168.1.0/24 area 1
passive-interface eth0
area 1 stub
redistribute connected
redistribute static
timers throttle spf 200 1000 5000
exit
interface eth1
ip ospf cost 10
ip ospf hello-interval 10
ip ospf dead-interval 40
ip ospf priority 100
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 MySecret
exit
write memory
OSPF Verification
show ip ospf neighbor
show ip ospf interface
show ip ospf database
show ip ospf border-routers
show ip ospf route
BGP Configuration
configure terminal
router bgp 65001
bgp router-id 2.2.2.2
neighbor 10.0.0.2 remote-as 65002
neighbor 10.0.0.2 description upstream-provider
neighbor 10.0.0.2 password SecretPass
neighbor 10.0.0.2 update-source eth0
neighbor 10.0.0.2 timers 30 90
address-family ipv4 unicast
network 192.168.0.0/16
neighbor 10.0.0.2 soft-reconfiguration inbound
neighbor 10.0.0.2 prefix-list INBOUND in
neighbor 10.0.0.2 prefix-list OUTBOUND out
neighbor 10.0.0.2 route-map IMPORT in
exit-address-family
exit
ip prefix-list INBOUND seq 5 permit 0.0.0.0/0 le 24
ip prefix-list INBOUND seq 10 deny any
ip prefix-list OUTBOUND seq 5 permit 192.168.0.0/16
ip prefix-list OUTBOUND seq 10 deny any
route-map IMPORT permit 10
match ip address prefix-list INBOUND
set local-preference 200
exit
write memory
BGP Verification
show ip bgp summary
show ip bgp neighbors 10.0.0.2
show ip bgp neighbors 10.0.0.2 advertised-routes
show ip bgp neighbors 10.0.0.2 received-routes
show ip bgp regexp _65002_
clear ip bgp 10.0.0.2 soft in
RIP Configuration
configure terminal
router rip
version 2
network 10.0.0.0/8
network 192.168.1.0/24
no auto-summary
redistribute ospf
passive-interface eth0
timers basic 30 180 120 240
distance 120
exit
write memory
Route Filtering and Policy
Access Lists
access-list 10 permit 192.168.1.0 0.0.0.255
access-list 10 deny any
ip prefix-list MY_NETS seq 5 permit 10.0.0.0/8 le 24
ip prefix-list MY_NETS seq 10 permit 172.16.0.0/12 le 24
ip prefix-list MY_NETS seq 100 deny 0.0.0.0/0 le 32
Route Maps
route-map REDISTRIBUTE permit 10
match ip address prefix-list MY_NETS
set metric 100
set tag 1000
exit
route-map REDISTRIBUTE deny 20
exit
Advanced Usage
Static Routes with Zebra
configure terminal
ip route 10.10.0.0/16 192.168.1.1
ip route 0.0.0.0/0 10.0.0.1 200
ipv6 route 2001:db8::/32 fe80::1 eth0
Route Redistribution
router ospf
redistribute bgp metric 100 metric-type 1 route-map BGP_TO_OSPF
exit
router bgp 65001
redistribute ospf route-map OSPF_TO_BGP
exit
BGP Communities
router bgp 65001
neighbor 10.0.0.2 send-community both
route-map SET_COMMUNITY permit 10
set community 65001:100 additive
exit
Logging
# In zebra.conf or vtysh
log file /var/log/quagga/zebra.log
log facility local7
log record-priority
log timestamp precision 3
Troubleshooting
| Issue | Solution |
|---|
| Daemons won’t start | Check /etc/quagga/daemons file enables them |
| OSPF neighbors stuck in INIT | Verify hello/dead timers match, check area config |
| BGP session not establishing | Check TCP/179 firewall rules, verify AS numbers |
| Routes not in kernel table | Ensure zebra daemon is running and healthy |
| Permission denied on config files | Run chown quagga:quagga /etc/quagga/*.conf |
| vtysh shows no config | Verify service integrated-vtysh-config is set |
| OSPF DR/BDR election issues | Check ip ospf priority on interfaces |
| BGP routes not advertised | Confirm network statement matches exactly |
Debug Commands
debug ospf event
debug ospf packet all
debug bgp updates
debug bgp events
debug zebra rib
debug zebra kernel
terminal monitor
# Disable debugging
no debug all
undebug all
Log Locations
/var/log/quagga/zebra.log
/var/log/quagga/ospfd.log
/var/log/quagga/bgpd.log
/var/log/syslog # fallback if file logging not configured