Linux下Quagga安装与配置
程序员文章站
2024-02-15 19:34:58
...
安装环境
Ubuntu 16.04
安装过程
安装quagga:
sudo apt-get install quagga
开启 IPv4 和 IPv6 的转发服务:
echo "net.ipv4.conf.all.forwarding=1" | sudo tee -a /etc/sysctl.conf
echo "net.ipv4.conf.default.forwarding=1" | sudo tee -a /etc/sysctl.conf
sed 's/#net.ipv6.conf.all.forwarding=1/net.ipv6.conf.all.forwarding=1/g' /etc/sysctl.conf | sudo tee /etc/sysctl.conf
echo "net.ipv6.conf.default.forwarding=1" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
创建配置文件夹Create the configuration files:
sudo nano /etc/quagga/babeld.conf
sudo nano /etc/quagga/bgpd.conf
sudo nano /etc/quagga/isisd.conf
sudo nano /etc/quagga/ospf6d.conf
sudo nano /etc/quagga/ospfd.conf
sudo nano /etc/quagga/ripd.conf
sudo nano /etc/quagga/ripngd.conf
sudo nano /etc/quagga/vtysh.conf
sudo nano /etc/quagga/zebra.conf
nano中Ctrl+O写入文件,Ctrl+X关闭文件。
更改配置文件夹的 owner 和 mode:
sudo chown quagga:quagga /etc/quagga/babeld.conf && sudo chmod 640 /etc/quagga/babeld.conf
sudo chown quagga:quagga /etc/quagga/bgpd.conf && sudo chmod 640 /etc/quagga/bgpd.conf
sudo chown quagga:quagga /etc/quagga/isisd.conf && sudo chmod 640 /etc/quagga/isisd.conf
sudo chown quagga:quagga /etc/quagga/ospf6d.conf && sudo chmod 640 /etc/quagga/ospf6d.conf
sudo chown quagga:quagga /etc/quagga/ospfd.conf && sudo chmod 640 /etc/quagga/ospfd.conf
sudo chown quagga:quagga /etc/quagga/ripd.conf && sudo chmod 640 /etc/quagga/ripd.conf
sudo chown quagga:quagga /etc/quagga/ripngd.conf && sudo chmod 640 /etc/quagga/ripngd.conf
sudo chown quagga:quaggavty /etc/quagga/vtysh.conf && sudo chmod 660 /etc/quagga/vtysh.conf
sudo chown quagga:quagga /etc/quagga/zebra.conf && sudo chmod 640 /etc/quagga/zebra.conf
如果上一步没有成功清除文件则会报错:
unlink: 无法清除'/etc/systemd/system/multi-user.target.wants/bgpd.service' 的链接: 没有那个文件或目录
选择要启动的路由协议:
sudo nano /etc/quagga/daemons
要启动的路由协议后的 no 改成 yes:
zebra=yes
bgpd=yes
ospfd=yes
ospf6d=yes
ripd=yes
ripngd=yes
isisd=yes
babeld=yes
编辑Telnet的接入以及余下的路由:
sudo nano /etc/quagga/debian.conf
vtysh_enable=yes
zebra_options=" --daemon -A 127.0.0.1 -P 2601 -u quagga -g quagga"
bgpd_options=" --daemon -A 127.0.0.1 -P 2605 -u quagga -g quagga --retain -p 179"
ospfd_options=" --daemon -A 127.0.0.1 -P 2604 -u quagga -g quagga"
ospf6d_options=" --daemon -A ::1 -P 2606 -u quagga -g quagga"
ripd_options=" --daemon -A 127.0.0.1 -P 2602 -u quagga -g quagga"
ripngd_options=" --daemon -A ::1 -P 2603 -u quagga -g quagga"
isisd_options=" --daemon -A 127.0.0.1 -P 2608 -u quagga -g quagga"
babeld_options=" --daemon -A 127.0.0.1 -P 2609 -u quagga -g quagga"
重启后台Restart the daemon:
sudo /etc/init.d/quagga restart
使用Telnet链接localhost (zebra port)
telnet localhost zebra
提示密码未设置:
27.0.0.1 2601
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Vty password is not set.
Connection closed by foreign host.
配置密码:
sudo echo "password typeyourpasswordhere" >> /etc/quagga/zebra.conf
关闭当前终端,重新打开一个,输入:
telnet localhost zebra
输入密码登录,然后输入“enable”来获得所有特权:
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Hello, this is Quagga (version 0.99.24.1).
Copyright 1996-2005 Kunihiro Ishiguro, et al.
User Access Verification
Password:
tracy-virtual-machine> enable
tracy-virtual-machine#
每次启动quagga都要输入
sudo /etc/init.d/quagga start
上一篇: Linux常用命令的总结