可以装linux的路由器,[转载]linux路由器Quagga的配置(一):安装
部分資料摘自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安裝成功了!
下一篇講如何配置。
總結
以上是生活随笔為你收集整理的可以装linux的路由器,[转载]linux路由器Quagga的配置(一):安装的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php解决mysql主从同步_Mysql
- 下一篇: haskell 求列表最大值_Haske