Quagga安裝
首先要求探測機服務器能夠連接外網源,Centos能夠使用外網yum源,Ubuntu能夠使用外網apt源,能夠使用外網源直接下載運行相關軟件。
1、首先查看探測機服務器的系統類型:
# cat /etc/issue
2、如果是Centos/RedHat類系統,使用#yum install -y quagga命令安裝quagga,如果是Ubuntu系統,使用#sudo apt-get install quagga quagga-doc的命令安裝quagga。
3、檢查telnet工具是否可用,如無可用的telnet,則使用yum install -y telnet或者sudo apt-get install telnet安裝該工具。
Quagga 基本配置
現以Ubuntu系統爲例,介紹後續的配置過程。
1、 開啓數據包轉發功能:
在Linux系統中,路由表和轉發數據包的功能都是Linux內核所提供。在我們的Ubuntu16系統中,默認情況下是沒有開啓數據包轉發功能的。開啓方式:
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
sysctl –p
2、 爲quagga各種功能分配對應的配置文件
Quagga配置文件例子在/usr/share/doc/quagga/examples/中,每個功能對應各自配置文件,需將其拷貝至/etc/quagga並改名及權限
cp /usr/share/doc/quagga/examples/*.sample /etc/quagga/
mv babeld.conf.sample babeld.conf
mv isisd.conf.sample isisd.conf
mv ospfd.conf.sample ospfd.conf
mv ripngd.conf.sample ripngd.conf
mv zebra.conf.sample zebra.conf
mv bgpd.conf.sample bgpd.conf
mv ospf6d.conf.sample ospf6d.conf
mv ripd.conf.sample ripd.conf
mv vtysh.conf.sample vtysh.conf
root@ubuntu:/etc/quagga# chown quagga:quagga *
3、 上述配置完成後,重啓quagga服務狀態。
# service quagga start/restart
4、 重啓後查看quagga狀態,active表示正常運行。
# service quagga status
5、 查看相應的端口號,結果中如果存在2601/2604,則表示quagga基本功能與quagga ospf功能可用:
netstat -anp | egrep "ospfd|zebra"
6、 檢查能否使用telnet工具連接,默認密碼是zebra
測試zebra進程:
telnet 127.0.0.1 2601
測試ospf進程:
telnet 127.0.0.1 2604
7、 查看vtysh基本功能:
# vtysh
顯示黑屏end時按q返回到quagga shell
返回到quagga shell,使用# show running-config進行檢測。
按q返回至系統的Linux shell,注意quagga shell和Linux shell的不同。
至此,quagga基本配置與檢查已經完成。
Quagga ospf配置
1、 首先登錄與探測機直連的交換機,查看整個直連交換機的ospf配置,以及與探測機直連端口的ip地址設置。
2、 由上圖可知,直連端口ip地址是1.10.4.1。先查看對應area的ospf路由設置:
3、 此時可知ospf中還沒有與直連接口相關的路由,先進到探測機的quagga ospf簡單查看一下此時的ospf鄰居:
命令行依次輸入如下命令:
# telnet localhost 2604
ospfd> enable
ospfd# show ip ospf neighbor
此時由於探測機直連交換機與探測機quagga都未進行相應配置,所以ospf鄰居顯示爲空,如下所示:
4、 配置兩側(探測機、探測機直連交換機)的ospf路由。
直連交換機配置如下:
[~serverleaf3]ospf 1
[~serverleaf3-ospf-1]area 1
[~serverleaf3-ospf-1-area-0.0.0.1]network 1.10.4.0 0.0.0.255
[~serverleaf3-ospf-1-area-0.0.0.1]commit
探測機quagga配置如下:
root@ubuntu:~# telnet localhost 2604
ospfd> enable
ospfd# terminal length 0 // 該命令的目的是設置一次全部輸出到屏幕,以便後續Python腳本一次獲取輸出內容
ospfd# configure terminal
ospfd(config)# router ospf
ospfd(config-router)# network 1.1.1.0/24 area 0.0.0.1
ospfd(config-router)# network 1.1.2.0/24 area 0.0.0.1
ospfd(config-router)# network 1.10.4.0/24 area 0.0.0.1
ospfd(config-router)# write
此時再次查看ospf鄰居,與ospf lsdb,應該能夠獲取到對應的數據條目。
ospfd(config-router)# do show ip ospf neighbor
ospfd(config-router)# do show ip ospf database network
至此ospf qugga配置完畢。