在Linux上可以實現大部分Route的功能,剛好有個測例須要驗正RIPv2交換路由表.
於是在Ubuntu 12.04安裝現成的套件來實現,記錄一下設定檔與結果.
LINUX上的Quggua是強大的交換路由表協定工具程式,支援RIP,OSPF等協定
8.3 動態路由器架設:quagga (zebra + ripd)
Linux 上使用Zebra上构建路由器实战手册
zebra(8) – Linux man page
設定啟動的服務
/etc/quagga/daemons
zebra=yes ripd=yes |
僅開啟zebra與ripd的服務,
/etc/quagga/debian.conf
vtysh_enable=yes zebra_options=" --daemon -A 127.0.0.1 172.17.220.57" ripd_options=" --daemon -A 127.0.0.1 172.17.220.57" |
把該服務綁定
路由規則送收設定
/etc/quagga/zebra.conf
! -*- zebra -*- hostname Router_tecom_lab password zebra enable password zebra ! Interface description. interface eth0 multicast ! Static default route sample. ip route 192.168.100.0/24 172.17.220.57 !ip route 172.17.220.0/24 192.168.100.1 |
設定zebra console UI密碼,監聽eth0,和串撥流的包,預設要分享的路由規則.
zebra主要負責將收到的路由規則加近本機路由表服務.
/etc/quagga/ripd.conf
! -*- rip -*- hostname ripd_tecom_lab password zebra router rip network 192.168.100.0/24 network eth0 version 2 route 172.17.220.0/24 log file /var/log/quagga/ripd.log |
與zebra設定類似,ripd主要是負責發送路由表.
啟用與檢測動態路由服務
Start Service Command
tecom@ZyXEL-OLT-test-PC:~$ sudo /etc/init.d/quagga restart Stopping Quagga daemons (prio:0): (waiting) .. ripd (waiting) .. zebra (bgpd) (ripngd) (ospfd) (ospf6d) (isisd). Removing all routes made by zebra. Loading capability module if not yet done. Starting Quagga daemons (prio:10): zebra ripd. |
Check Routing Table
tecom@ZyXEL-OLT-test-PC:~$ telnet 127.0.0.1 2601 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. Hello, this is Quagga (version 0.99.20.1). Copyright 1996-2005 Kunihiro Ishiguro, et al. User Access Verification Password: Router_tecom_lab> show ip route Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - ISIS, B - BGP, > - selected route, * - FIB route K>* 0.0.0.0/0 via 172.17.220.254, eth1 C>* 127.0.0.0/8 is directly connected, lo K>* 169.254.0.0/16 is directly connected, eth0 C>* 172.17.220.0/24 is directly connected, eth1 R>* 192.168.1.0/24 [120/2] via 192.168.100.3, ppp0, 00:02:22R>* 192.168.2.0/24 [120/2] via 192.168.100.3, ppp0, 00:02:22S 192.168.100.0/24 [1/0] via 172.17.220.57, eth1 C>* 192.168.100.0/24 is directly connected, eth0 C>* 192.168.100.3/32 is directly connected, ppp0 Router_tecom_lab> |
R的屬性就是藉由學習而得的路由表.
借由觀察封包確認兩路由間交換情況
224.0.0.9的multicast group就是reserve給RIPv2用的channel.
由圖中可見兩台路由器都有發送自身的路由表.大功告成!
Facebook Comments