安装:
0) 安装依赖软件包(--enable-vtysh需要)
#sudo apt-get install libreadline6-dev (Ubuntu)
#sudo yum install readline-devel (
CentOS)
创建用户(可选)
#sudo groupadd quaggga
#sudo useradd quaggga -g quaggga
1) 下载软件包,解压缩, 编译并安装
#tar xzf quagga-0.99.21.tar.gz
#cd quagga-0.99.21
#sudo mkdir /var/run/quagga
#sudo chmod 777 /var/run/quagga
#./configure --enable-vtysh --localstatedir=/var/run/quagga --enable-user=root --enable-group=root (默认运行用户为quagga, 确保运行的localstatedir对用户有读写的权限,建议配置)
#./configure --enable-vtysh --localstatedir=/var/run/quagga
#./configure --localstatedir=/var/run/quagga
#make
#sudo make install
#sudo ldconfig (加载库文件路径)
注意:
配置文件路径, 默认为/usr/local/etc; 可执行文件路径, 默认为/usr/local/sbin
2) 修改文件/etc/services (某些linux平台可能不需要), 添加如下内容:
zebrasrv 2600/tcp # zebra service
zebra 2601/tcp # zebra vty
ripd 2602/tcp # RIPd vty
ripngd 2603/tcp # RIPngd vty
ospfd 2604/tcp # OSPFd vty
bgpd 2605/tcp # BGPd vty
ospf6d 2606/tcp # OSPF6d vty
ospfapi 2607/tcp # ospfapi
isid 2608/tcp # ISISd vty
3) 使用如下脚本启动/停止quagga: sudo ./run_quagga.sh start|stop|restart
或者直接启动停止:
#sudo /../zebra -u 用户 -g 用户组 -d (确保编译时设置的localstatedir对用户有读写权限即可)
#sudo ospfd -u 用户 -g 用户组 -d
......
4) 登录控制台:
#telnet localhost 2601 //zebra
#telnet localhost 2604 //ospf
......
5) 问题解决
如果遇到zebra库文件未找到
错误,则到目录 /etc/ld.so.conf.d下面新建个文件,
内容为quagga安装的库路径,例如: /usr/local/lib
然后 sudo ldconfig即可。
6) 如果要启用quagga的vtysh控制台:
#./configure --enable-vtysh --localstatedir=/var/run/quagga --sysconfdir=/etc/quagga --enable-vtysh-group=root
#make
#sudo make install
然后配置/etc/quagga/vtysh.conf文件内容即可。
====================================
run_quagga.sh
#!/bin/bash
EXEC_DIR=/usr/local/sbin
CONF_DIR=/usr/local/etc
LIB_DIR=/usr/local/lib
PID_DIR=/var/run/quagga
DAEMON=(zebra bgpd)
USER=quagga
#DAEMON=(zebra ospfd ospf6d ripd bgpd)
#set librery path
export LD_LIBRARY_PATH=$LIB_DIR:$LD_LIBRARY_PATH
#
echo make sure user \"$USER\" has directory \"$PID_DIR\"\'s read-write privileges !
start()
{
for d in ${DAEMON[*]}; do
$EXEC_DIR/$d -f $CONF_DIR/$d.conf -i $PID_DIR/$d.pid -u $USER -g $USER -d
ps -ef | grep $d
done
echo "start \" ${DAEMON[*]} \" finished!"
}
stop()
{
for d in ${DAEMON[*]}; do
killall $d
#rm -f $PID_DIR/$d.pid
done
rm -f $PID_DIR/*
echo "stop \" ${DAEMON[*]} \" finished!"
}
case $1 in
start)
start ;;
stop)
stop ;;
restart)
stop
start ;;
*)
echo "Usage: $0 start | stop | restart"
esac