部分资料摘自http://blog.chinaunix.net/uid-25513153-id-212328.html

Quagga是一款功能比较强大的开源路由软件,支持rip,ripng,ospfv2,ospfv3,bgp等协议。目前最新版本为Quagga

0.99.17。安装Quagga的目的是使装有linux(我采用的是Ubuntu10.04LTS)系统的电脑变成一台路由器,以便今后的实验。之所以选择Quagga是因为它的操作和Cisco的操作是比较相似的。今天用到的电脑需要多块网卡支持(至少两块)。

安装Quagga

首先下载Quagga

0.99.17到硬盘,然后在终端输入

tar –zxvf quagga-0.99.17.tar.gz

进入目录

#cd quagga-0.99.17

配置

#./configure --enable-vtysh

--enable-user=root

--enable-group=root

--enable-vty-group=root

上述命令为打开vty功能(CLI功能)并给予相应用户权限,另有一些初始化配置见文档中.配置完成后会有一些信息表明quagga安装完成后相关文件所在位置。

此时出现错误:

checking for syslog.h... yes

checking for wchar.h... yes

checking for wctype.h... yes

checking for sys/sysctl.h... yes

checking for sys/sockio.h... no

checking for kvm.h... no

checking for sys/conf.h... no

checking for ucontext.h... yes

checking for special C compiler options needed for large files...

no

checking for _FILE_OFFSET_BITS value needed for large files...

64

checking for perl... /usr/bin/perl

checking for tputs in -ltermcap... yes

checking for main in -lreadline... no

configure: error: vtysh needs libreadline but was not found and

usable on your system.

zinkin@zinkin-desktop:~/quagga/quagga-0.99.17$

zinkin@zinkin-desktop:~/quagga/quagga-0.99.17$

--enable-user=root

--enable-user=root: command not found

zinkin@zinkin-desktop:~/quagga/quagga-0.99.17$

zinkin@zinkin-desktop:~/quagga/quagga-0.99.17$

--enable-group=root

--enable-group=root: command not found

zinkin@zinkin-desktop:~/quagga/quagga-0.99.17$

注:

①./configure是用来检测你的安装平台的目标特征的(比如它会检查是否有编辑器、函数库,CC或GCC等等),并根据配置信息生产相应的makefile,它是个shell脚本。

②./configure –h

输入此命令会一一列出当前配置环境所有配置选项

③此输入选项含义为,

启用相应服务程序,并对不用的服务程序进行关闭,其中--enable- user=root --enable-group=root

是限定quagg软件的使用权限。

④配置时易出现如下错误:

/usr/local/lib/libreadline.so:

undefined reference to `PC'

/usr/local/lib/libreadline.so:

undefined reference to `tgetflag'

/usr/local/lib/libreadline.so:

undefined reference to `tgetent'

/usr/local/lib/libreadline.so:

undefined reference to `UP'

/usr/local/lib/libreadline.so:

undefined reference to `tputs'

/usr/local/lib/libreadline.so:

undefined reference to `tgoto'

/usr/local/lib/libreadline.so:

undefined reference to `tgetnum'

/usr/local/lib/libreadline.so:

undefined reference to `BC'

/usr/local/lib/libreadline.so:

undefined reference to `tgetstr'

checking for perl...

/usr/bin/perl

checking for tputs in -ltermcap... no

checking for tputs in -ltinfo... no

checking for tputs in -lcurses... no

checking for tputs in -lncurses... no

checking for main in -lreadline... no

configure:

error: vtysh needs libreadline but was not found and usable on your

system

解决方法:

1 看readline软件包是否安装

sudo apt-get install

libreadline5-dev

2 是否安装ncurses安装包

sudo apt-get install

libncurses5-dev

3 是否安装libncurses5-dev

或libncursesw5-dev软件包

sudo apt-get install

libncursesw5-dev

安装完成之后再重新用配置命令

#./configure --enable-vtysh

#./configure --enable-user=root

#./configure --enable-group=root

#./configure --enable-vty-group=root

之后编译与安装

#make

#make install

之后出现错误

/usr/bin/install: cannot create regular file`/usr/local/lib/libprotobuf.so.0.0.0':

Permission denied

make[3]: *** [install-libLTLIBRARIES] Error 1

make[3]: Exit from catalogue

`/home/alexe/downloads/proto2/protobuf-2.0.0beta/src'

make[2]: *** [install-am] Error 2

make[2]: Exit from catalogue

`/home/alexe/downloads/proto2/protobuf-2.0.0beta/src'

make[1]: *** [install] Error 2

make[1]: Exit from catalogue

`/home/alexe/downloads/proto2/protobuf-2.0.0beta/src'

make: *** [install-recursive] Error 1

可以采用

#sudo make

#sudo make install

3.修改文件/etc/services,添加如下内容(某些版本Ubuntu已有,就不用添加了)

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

之后查看/etc/services,这个文件,发现已经里面有上面这段东西了。

quagga文件夹下/zebra有一个zebra.conf.sample文件,需建立一个zebra.conf文件并把zebra.conf.sample内容copy进去.

启动Quagga

在终端输入zebra -d即可启动quagga。有可能出现以下错误:

zebra: error while loading shared libraries:

libzebra.so.0: cannot open shared object file: No such file or

directory

解决方法:

在/usr/local/lib下有

lrwxrwxrwx 1 root root 17 2010-06-21 01:52

libzebra.so -> libzebra.so.0.0.0

lrwxrwxrwx 1 root root 17 2010-06-21 01:52

libzebra.so.0 -> libzebra.so.0.0.0

-rwxr-xr-x 1 root root 778556 2010-06-21 01:52

libzebra.so.0.0.0

这可能是由于/lib库出现问题:则

zinkin@zinkin-desktop:~/quagga/quagga-0.99.17$ cd

/usr/local/lib

zinkin@zinkin-desktop:/usr/local/lib$ cp libzebra.* /lib

zinkin@zinkin-desktop:/usr/local/lib$ sudo rm libzebra.*

在终端输入zebra -d即可启动quagga。

zinkin@zinkin-desktop:~/quagga/quagga-0.99.17$ zebra -d

privs_init: could not lookup user quagga

[root@localhost1 quagga-0.99.15]#

zebra

privs_init: could not lookup user quagga

[root@localhost1 quagga-0.99.15]# zebra

--help

Usage : zebra [OPTION...]

Daemon which manages kernel routing table management and

redistribution between different routing protocols.

-b,

--batch Runs in batch mode

-d,

--daemon Runs in daemon mode

-f, --config_file Set configuration file

name

-i,

--pid_file Set process identifier file name

-k, --keep_kernel Don't delete old routes which

installed by zebra.

-C,

--dryrun Check configuration for validity and exit

-A,

--vty_addr Set vty's bind address

-P,

--vty_port Set vty's port number

-r,

--retain When program terminates, retain added route by zebra.

-u, --user User to run

as

-g,

--group Group to run as

-s, --nl-bufsize Set netlink

receive buffer size

-v,

--version Print program version

-h,

--help Display this help and exit

Report bugs to http://bugzilla.quagga.net

[root@localhost1 quagga-0.99.15]# zebra

-d -u root -g root

vty_read_config: failed to open configuration file

/usr/local/etc/zebra.conf: No such file or directory

can't open configuration file [/usr/local/etc/zebra.conf]

[root@localhost1 quagga-0.99.15]# cp -Rf

/usr/local/etc/zebra.conf.sample /usr/local/etc/zebra.conf

[root@localhost1 quagga-0.99.15]# zebra

-d -u root -g root

[root@localhost1 quagga-0.99.15]# telnet

localhost 2601

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

Hello, this is Quagga (version

0.99.15).

Copyright 1996-2005 Kunihiro Ishiguro, et al.

由于自己的程序没有在root下,所以有些语句前面得用sudo

zinkin@zinkin-desktop:~/quagga/quagga-0.99.17$ sudo zebra -d -u

root -g root

zinkin@zinkin-desktop:~/quagga/quagga-0.99.17$ telnet localhost

2601

Trying ::1...

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

Hello, this is Quagga (version 0.99.17).

Copyright 1996-2005 Kunihiro Ishiguro, et al.

User Access Verification

Password:

这样就说明已经将quaga安装成功了!

下一篇讲如何配置。

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐