quazza各版本源码下载地址:http://download.savannah.gnu.org/releases/quagga/
我下载了:quagga-1.1.1.tar.gz
【一】安装
0、 apt-get install g++
1、 tar -xzvf quagga-1.1.1.tar.gz -C /tmp0925
2、 cd quagga-1.1.1
3、 ./configure --enable-vtysh --enable-user=root --enable-group=root --enable-vty-group=root
;上述命令为打开vty功能(CLI功能)并给予相应用户权限
【出错1】
configure: error: GNU awk is required for lib/memtype.h made by memtypes.awk.
BSD awk complains: awk: gensub doesn't support backreferences (subst "\1")
解决办法:sudo apt-get install gawk
【出错2】
configure: error: vtysh needs libreadline but was not found and usable on your system.
解决办法:sudo apt-get install libreadline-dev
编译成功:
Quagga configuration
--------------------
quagga version : 1.1.1
host operating system : linux-gnu
source code location : .
compiler : gcc
compiler flags : -g -O2 -std=gnu99 -g -Os -fpie -fno-omit-frame-pointer -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers
make : make
linker flags : -lcrypt -lrt -ltermcap -lreadline -lm
state file directory : /var/run
config file directory : /usr/local/etc
example directory : /usr/local/etc
user to run as : root
group to run as : root
group for vty sockets : root
config file mask : 0600
log file mask : 0600
zebra protobuf enabled : no
The above user and group must have read/write access to the state file
directory and to the config files in the config file directory.
root@ubuntu:/tmp0925/quagga-1.1.1#
4、编译:make
出错:
Makefile:487: recipe for target 'quagga.info' failed
make[3]: *** [quagga.info] Error 127
make[3]: Leaving directory '/tmp0925/quagga-1.1.1/doc'
Makefile:444: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/tmp0925/quagga-1.1.1/doc'
Makefile:466: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/tmp0925/quagga-1.1.1'
Makefile:398: recipe for target 'all' failed
make: *** [all] Error 2
解决办法:sudo apt-get install texinfo
make clean
make
编译成功。
5、make install
【二】配置zebra和rip(这里我选择rip协议)
1.cd /usr/local/etc //存放.conf文件的目录
root@ubuntu:/etc# cd /usr/local/etc
root@ubuntu:/usr/local/etc# ls
bgpd.conf.sample ospf6d.conf.sample ripd.conf.sample zebra.conf.sample
bgpd.conf.sample2 ospfd.conf.sample ripngd.conf.sample
isisd.conf.sample pimd.conf.sample vtysh.conf.sample
2.sudo cp zebra.conf.sample zebra.conf //.sample为自带的配置文件
3.sudo cp ripd.conf.sample rip.conf
4.sudo zebra -d //启动
出现错误:zebra: error while loading shared libraries: libzebra.so.1: cannot open shared object file: No such file or directory
解决办法:sudo cp /usr/local/lib/libzebra.so.1 /lib
然后重新执行sudo zebra -d (注:此步无信息输出)
ps -e | grep zebra //查看进程是否启动成功,成功会出现对应的进程号,否则不会有输出
root@ubuntu:/usr/local/etc# ps -e | grep zebra
93254 ? 00:00:00 zebra
此时配置已经成功了,电脑已经成为一个路由器了,但是我们还未对其中的设置进行配置。
5.telnet localhost 2601
出现:
【
root@ubuntu:/usr/local/etc# telnet localhost 2601
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Hello, this is Quagga (version 1.1.1).
Copyright 1996-2005 Kunihiro Ishiguro, et al.
User Access Verification
Password:
】
密码为:zebra
然后出现:
Password:
Router>
6、进入特权模式,在特权模式就可以配置一些路由器的属性:
Router> en
Password:
Router#
==================================
/etc/services:
该文件是记录网络服务名和它们对应使用的端口号及协议。文件中的每一行对应一种服务,它由4个字段组成,
中间用TAB或空格分隔,分别表示“服务名称”、“使用端口”、“协议名称”以及“别名”。
/etc/services文件包含了服务名和端口号之间的映射,很多的系统程序要使用这个文件。
一般情况下,不要修改该文件的内容,因为这些设置都是Internet标准的设置。
一旦修改,可能会造成系统冲突,使用户无法正常访问资源。
Linux系统的端口号的范围为0–65535,不同范围有不同的意义。
0 不使用
1--1023 系统保留,只能由root用户使用
1024---4999 由客户端程序自由分配
5000---65535 由服务器端程序自由分配
关于各种协议的配置文本所在的目录为/usr/local/etc下面(很重要的一点)
对Quagga进行配置,实际上就是对各进程进行配置,并且路由器的配置和路由协议的配置是分开不同进程的。
可以通俗理解,Quagga里的zebra进程,相当于一个路由器,对zebra进行配置,就相当于对路由器进行基本配置(注意,这里是说基本配置,路由协议不是在zebra里配置的)。
而Quagga里的ripd、ospfd、bgpd等进程,相当于不同的路由协议,要启动哪一种协议,就对协议相应的进程进行配置。