linux路由器Quagga的配置(一):安装

转自http://blog.sina.com.cn/s/blog_68b156d50101kf64.html,作者:郑大哲

 

部分资料摘自http://blog.chinaunix.net/uid-25513153-id-212328.html
Quagga是一款功能比较强大的开源路由软件,支持rip,ripng,ospfv2,ospfv3,bgp等协议。目前最新版本为Quagga0.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

解决方法:

   看readline软件包是否安装

	sudo apt-get install libreadline5-dev

   是否安装ncurses安装包

	sudo apt-get install libncurses5-dev

   是否安装libncurses5-dev 或libncursesw5-dev软件包

	sudo apt-get install libncursesw5-dev

 

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

#./configure --enable-vtysh --enable-user=root --enable-group=root --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
#sudo ldconfig

 

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  /usr/local/etc目录下有一个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 notlookup 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安装成功了!
下一篇讲如何配置。
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
quagga是一款开源的路由软件套件,在Linux系统中广泛使用。要进行quagga源码安装,按照以下步骤操作: 1. 下载源码:在quagga的官方网站或者Github页面上找到最新的源码包,点击下载并保存到本地。 2. 解压源码:使用解压工具,如tar命令,将源码包解压到一个目录中,比如/home/user/quagga。 3. 安装所需依赖:使用shell命令进入解压后的quagga目录,执行以下命令安装所需的依赖库,以Ubuntu系统为例: ``` sudo apt-get update sudo apt-get install build-essential sudo apt-get install libreadline-dev sudo apt-get install texinfo sudo apt-get install pkg-config ``` 4. 配置和编译:在quagga目录中,执行以下命令进行配置: ``` ./configure ``` 然后执行以下命令进行编译: ``` make ``` 编译过程可能需要一些时间,请耐心等待。 5. 安装:编译成功后,执行以下命令进行安装: ``` sudo make install ``` 安装完成后,quagga将被安装到默认的系统目录中。 6. 配置和启动:安装完成后,可以通过编辑配置文件来配置quagga的路由设置,配置文件通常位于/etc/quagga目录下。然后,执行以下命令启动quagga服务: ``` sudo /etc/init.d/quagga start ``` 现在,quagga服务已启动并运行。 以上是quagga源码安装的简要步骤。根据不同的Linux发行版和系统环境,安装过程可能会有所差异,请根据具体情况进行操作,并参考quagga官方文档或社区支持获取更详细的安装指南。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值