Skip to content

Instantly share code, notes, and snippets.

@ben-bradley
Last active April 1, 2022 21:47
Show Gist options
  • Save ben-bradley/90bde0394c045b4d7f0f to your computer and use it in GitHub Desktop.
Save ben-bradley/90bde0394c045b4d7f0f to your computer and use it in GitHub Desktop.
Quagga install & setup on Ubuntu (https://wiki.ubuntu.com/JonathanFerguson/Quagga)
#!/bin/bash
### Copy/paste from https://wiki.ubuntu.com/JonathanFerguson/Quagga
## Use
## ===
## $ sudo ./installQuagga.sh
## Install the Quagga routing daemon
## =================================
apt-get -y install quagga
## Enable IPv4 and IPv6 Forwarding
## ===============================
echo 'net.ipv4.conf.all.forwarding=1' | tee -a /etc/sysctl.conf
echo 'net.ipv4.conf.default.forwarding=1' | tee -a /etc/sysctl.conf
sed 's/#net.ipv6.conf.all.forwarding=1/net.ipv6.conf.all.forwarding=1/g' /etc/sysctl.conf | tee /etc/sysctl.conf
echo 'net.ipv6.conf.default.forwarding=1' | tee -a /etc/sysctl.conf
sysctl -p
## Create the configuration files
## ==============================
touch /etc/quagga/babeld.conf
touch /etc/quagga/bgpd.conf
touch /etc/quagga/isisd.conf
touch /etc/quagga/ospf6d.conf
touch /etc/quagga/ospfd.conf
touch /etc/quagga/ripd.conf
touch /etc/quagga/ripngd.conf
touch /etc/quagga/vtysh.conf
touch /etc/quagga/zebra.conf
## Change the owner and the mode of the configuration files
## ========================================================
chown quagga:quagga /etc/quagga/babeld.conf && chmod 640 /etc/quagga/babeld.conf
chown quagga:quagga /etc/quagga/bgpd.conf && chmod 640 /etc/quagga/bgpd.conf
chown quagga:quagga /etc/quagga/isisd.conf && chmod 640 /etc/quagga/isisd.conf
chown quagga:quagga /etc/quagga/ospf6d.conf && chmod 640 /etc/quagga/ospf6d.conf
chown quagga:quagga /etc/quagga/ospfd.conf && chmod 640 /etc/quagga/ospfd.conf
chown quagga:quagga /etc/quagga/ripd.conf && chmod 640 /etc/quagga/ripd.conf
chown quagga:quagga /etc/quagga/ripngd.conf && chmod 640 /etc/quagga/ripngd.conf
chown quagga:quaggavty /etc/quagga/vtysh.conf && chmod 660 /etc/quagga/vtysh.conf
chown quagga:quagga /etc/quagga/zebra.conf && chmod 640 /etc/quagga/zebra.conf
## Edit which routing protocols are to run
## =======================================
echo 'zebra=yes' > /etc/quagga/daemons
echo 'bgpd=yes' >> /etc/quagga/daemons
echo 'ospfd=yes' >> /etc/quagga/daemons
echo 'ospf6d=yes' >> /etc/quagga/daemons
echo 'ripd=yes' >> /etc/quagga/daemons
echo 'ripngd=yes' >> /etc/quagga/daemons
echo 'isisd=yes' >> /etc/quagga/daemons
echo 'babeld=yes' >> /etc/quagga/daemons
## Edit telnet access and the retaining of routes over restarts
## ============================================================
echo 'vtysh_enable=yes' > /etc/quagga/debian.conf
echo 'zebra_options=" --daemon -A 127.0.0.1 -P 2601 -u quagga -g quagga --keep_kernel --retain"' >> /etc/quagga/debian.conf
echo 'bgpd_options=" --daemon -A 127.0.0.1 -P 2605 -u quagga -g quagga --retain -p 179"' >> /etc/quagga/debian.conf
echo 'ospfd_options=" --daemon -A 127.0.0.1 -P 2604 -u quagga -g quagga"' >> /etc/quagga/debian.conf
echo 'ospf6d_options=" --daemon -A ::1 -P 2606 -u quagga -g quagga"' >> /etc/quagga/debian.conf
echo 'ripd_options=" --daemon -A 127.0.0.1 -P 2602 -u quagga -g quagga --retain"' >> /etc/quagga/debian.conf
echo 'ripngd_options=" --daemon -A ::1 -P 2603 -u quagga -g quagga --retain"' >> /etc/quagga/debian.conf
echo 'isisd_options=" --daemon -A 127.0.0.1 -P 2608 -u quagga -g quagga"' >> /etc/quagga/debian.conf
echo 'babeld_options=" --daemon -A 127.0.0.1 -P 2609 -u quagga -g quagga"' >> /etc/quagga/debian.conf
## Restart the daemon
## ==================
/etc/init.d/quagga restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment