自由路由軟件Zebra基本配置完全攻略_第1頁(yè)
自由路由軟件Zebra基本配置完全攻略_第2頁(yè)
自由路由軟件Zebra基本配置完全攻略_第3頁(yè)
自由路由軟件Zebra基本配置完全攻略_第4頁(yè)
自由路由軟件Zebra基本配置完全攻略_第5頁(yè)
已閱讀5頁(yè),還剩21頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、自由路由軟件 Zebra 基本配置完全攻略前言Zebra 是一個(gè)路由軟件包,提供基于 TCP/IP路由服務(wù),支持 RIPv1, RIPv2, RIPng, OSPFv2, OSPFv3, BGP- 4, 和 BGP-4+等眾多路由協(xié)議。 Zebra 還支持 BGP 特性路由反射器(Route Reflector 。除了傳統(tǒng)的 IPv4路由協(xié)議, Zebra 也支持 IPv6路由協(xié)議。如果運(yùn)行的 SNMP 守 護(hù)進(jìn)程(需要 ucd-snmp 支持 SMUX 協(xié) 議, Zebra 還能支持路由協(xié)議 MIBs 。由以上可見, Zebra 的確是一個(gè)很不錯(cuò)的路由系統(tǒng),但比起真正的路由器就簡(jiǎn)直是小兒 科

2、,所以網(wǎng)絡(luò)高手 就當(dāng)這文章是小孩子過(guò)家家吧,而對(duì)于象我這樣的初學(xué)者(特別是沒有 真實(shí)設(shè)備或足夠設(shè)備進(jìn)行實(shí)驗(yàn) 也不失為一個(gè)學(xué)習(xí)和熟悉路由配置、路由協(xié)議的好工具。 我沒有實(shí)際的配置經(jīng)驗(yàn),對(duì)路由的技術(shù)細(xì)節(jié)也 不是十分清晰,完全是在扔破磚頭。希望路 由高手指正概念錯(cuò)誤。安裝shell> cd zebra-0.92ashell> ./configureshell> makeshell> make install這 樣 Zebra 就安裝好了,安裝的執(zhí)行文件:shell> ls /usr/local/sbinbgpd ospfd ripd zebra配置文件:shell>

3、; ls /usr/local/etc運(yùn)行編譯安裝完 Zebra 后, 可以看到有 4個(gè)可執(zhí)行文件和 5個(gè)配置樣本文件,我們就使用 它的配置樣本文件:shell> cd /usr/local/etcZebra 的各進(jìn)程有各自的終端接口或 VTY , 如果我們需要給連接到它們的端口設(shè)置別名 的話,在 /etc/ services文件添加如下內(nèi)容:zebrasrv 2600/tcp# zebra servicezebra 2601/tcp# zebra vtyripd 2602/tcp# RIPd vtyripngd 2603/tcp# RIPngd vtyospfd 2604/tcp# O

4、SPFd vtybgpd 2605/tcp# BGPd vtyospf6d 2606/tcp# OSPF6d vty然后就可以啟動(dòng) Zebra 了:shell> zebra -d這樣, Zebra 就以守護(hù)進(jìn)程啟動(dòng)了,其它的參數(shù)請(qǐng)參考 zebra -h。基本路由配置命令直接用 telnet 連接:shell> telnet localhost 2601Connected to localhost.Escape character is ''.Hello, this is zebra (version 0.92a.Copyright 1996-2001 Kunihir

5、o Ishiguro.User Access VerificationPassword:Zebra 會(huì)提示輸入口令, 我 們通過(guò) /usr/local/etc/zebra.conf可以看到口令是 zebra , enable 口令也是 zebra 。輸 入口令 zebra ,得到路由器用戶模式提示符:Router>進(jìn)入特權(quán)模式:Router> enPassword:Router#輸入一個(gè)問(wèn)號(hào),看看 Zebra 提供了多 少路由命令:Router# ?configure Configuration from vty interfacecopy Copy configurationde

6、bug Debugging functions (see also 'undebug'disable Turn off privileged mode commandend End current mode and change to enable mode.exit Exit current mode and down to previous modehelp Description of the interactive help systemlist Print command listno Negate a command or set its defaultsquit

7、Exit current mode and down to previous modeshow Show running system informationterminal Set terminal line parameterswho Display who is on vtywrite Write running configuration to memory, network, or terminal提供的命令很少,實(shí)際路由器好多命令都沒有,我們只能用有限的 命令投入到無(wú)限的 實(shí)驗(yàn)中去。Router# sh runCurrent configuration:!hostname Rout

8、erpassword zebraenable password zebra!interface lo!interface eth0!line vty!endZebra 把操作系統(tǒng)的網(wǎng)絡(luò)接口當(dāng)做路由 器的接口, 所以在做比較復(fù)雜的路由實(shí)驗(yàn), 會(huì)需 要比較多的網(wǎng)卡。進(jìn)入全局模式,盡可能把實(shí)際可用的配置命令都實(shí)驗(yàn)一遍:Router# conf tRouter(config#自己取一個(gè)路由器名字:Router(config# hostname r1r1(config#Zebra 比較簡(jiǎn)單,登陸口令不 是在 line 下修改,而是直接在全局模式下用 password 修 改 r1(config# pas

9、sword passwordZebra 不支持 enable secret password這種 MD5加密口令,只能使用 enable password password來(lái)修改 enable 口令:r1# conf tr1(config# enable password password在路由器配置中加密所有的口令:r1(config# service password-encryption回到特權(quán)模式:r1(config# exitr1# sh runCurrent configuration:!hostname r1password 8 alA5.vcyMAwXQenable passw

10、ord 8 ksbxOFN8xcFMcservice password-encryption!interface lo!interface eth0!line vty!end我 們看到剛才的明文密碼都進(jìn)行加密了, 給我們的實(shí)驗(yàn)機(jī)也提高安全性。 Zebra 有一點(diǎn) 比較惡心,如果我 們先設(shè)置了 service password-encryption ,然后再修改口令, sh run 就發(fā)現(xiàn)口令又都是明文的了,但是由 于有 service password-encryption,所以就無(wú)法登陸了。去掉會(huì)話超時(shí), 免得 10分鐘沒有動(dòng)作, 就把我們給踢了。 但是在實(shí)際 的路由器配置中, 為安全起見我

11、們 最好還是設(shè)上會(huì)話超時(shí)。r1# conf tr1(config# line vtyr1(config-line# exec-timeout 0 0設(shè)置日志記錄, Zebra 可以把日志記 錄到標(biāo)準(zhǔn)輸出、 syslog 、以及指定輸出文件:r1(config-line# exitr1(config# log stdoutr1(config# no log stdoutr1(config# log syslogr1(config# no log syslogr1(config# log file /usr/local/etc/zebra.log配置接口 IP 地址:r1(config# int

12、lor1(config-if# exitr1(config# int eth0保存我們剛才的配置:r1(config-if# exitr1(config# exitr1# copy run startConfiguration saved to /usr/local/etc/zebra.confr1#2、用 Zebra 做簡(jiǎn)單的 RIP 實(shí)驗(yàn)RIP 是應(yīng)用較早、使用較 普遍的 IGP ,適用 于小型同類網(wǎng) 絡(luò),是典型的 距離向量 (distance-vector協(xié) 議。 RIP 通過(guò)廣播 UDP 報(bào)文來(lái)交換路由信息, 每 30秒發(fā)送一次路由信息 更新。 RIP 提供跳躍計(jì)數(shù) (hop coun

13、t 作為尺度來(lái)衡量路由距離,跳躍計(jì)數(shù)是一個(gè)包到達(dá)目標(biāo) 所必須經(jīng)過(guò)的路由器的數(shù)目。如果到相同 目標(biāo)有二個(gè)不等速或不同帶寬的路由器,但跳躍 計(jì)數(shù)相同,則 RIP 認(rèn)為兩個(gè)路由是等距離的。 RIP 最多支 持的跳數(shù)為 15,即在源和目的網(wǎng)間所要經(jīng)過(guò)的最多路由器的數(shù)目為 15,跳數(shù) 16表示不可達(dá)。 RIPv2支持 驗(yàn)證、密鑰管理、 路由匯總、無(wú)類域間路由 (CIDR和變長(zhǎng)子網(wǎng)掩碼 (VLSMs。Zebra 支持 RIPv2,使用 ripd 程 序?qū)崿F(xiàn) RIP 路由功能,但 ripd 程序需要在 zebra 程序讀 取接口信息, 所以 zebra 一定要在 ripd 之前啟動(dòng)。 由于條件所限, 下面的

14、 RIP 實(shí)驗(yàn)是在兩臺(tái) 單網(wǎng)卡的 RedHat7.2下做的,所以只是 最簡(jiǎn)單的演示。按照上面基本配置的方法初始化第一臺(tái)機(jī)器:shell_1> cd /usr/local/etcshell_1> zebra -d進(jìn)入 zebra 設(shè) 置 IPshell_1> telnet localhost 2601Password:Router> enPassword:Router# conf tRouter(config# hostname r1r1(config# int eth0r1(config-if# ctrl+zr1# copy run start進(jìn)入第一臺(tái)機(jī)器的 rip

15、設(shè)置shell_1> ripd -dshell_1> telnet localhost 2602Password:ripd> enripd# conf tripd(config# hostname r1_ripd !改個(gè)名字好辨認(rèn)r1_ripd(config# router rip !啟動(dòng) ripr1的 RIP 簡(jiǎn)單配置這樣就可用了,下面來(lái)檢驗(yàn)一下:r1_ripd# sh ip protocolsRouting Protocol is "rip"Sending updates every 30 seconds with +/-50%, next due i

16、n 3 secondsTimeout after 180 seconds, garbage collect after 120 secondsOutgoing update filter list for all interface is not setIncoming update filter list for all interface is not setDefault redistribution metric is 1Redistributing:Default version control: send version 2, receive version 2Interface

17、Send Recv Key-chaineth022Routing for Networks:Routing Information Sources:Gateway BadPackets BadRoutesDistance Last UpdateDistance: (default is 120我們看到 RIP 已經(jīng)起來(lái)了,是 RIPv2。r1_ripd# sh ip ripCodes: R - RIP, C - connected, O - OSPF, B - BGPNetwork Next HopMetric FromTime由于就兩個(gè)接口直連,沒有其 它網(wǎng)絡(luò),所以 sh ip rip看不到

18、什么。Zebra 對(duì) log 處理可能有些問(wèn)題, 使用 log stdout不能顯示各種 debug 信息, 所以只能記 錄到文件,在 shell 下 用 tail 命令查看。r1_ripd# debug rip eventsr1_ripd# debug rip packetr1_ripd(config# log file /usr/local/etc/ripd.log然后我們?cè)?shell 下查看 debug 信息shell_1> tail -f /usr/local/etc/ripd.log-8<-2002/04/28 22:17:44 RIP: update timer fi

19、re!2002/04/28 22:17:44 RIP: SEND UPDATE to eth0 ifindex 22002/04/28 22:17:44 RIP: multicast announce on eth02002/04/28 22:17:44 RIP: update routes on interface eth0 ifindex 22002/04/28 22:18:23 RIP: update timer fire!2002/04/28 22:18:23 RIP: SEND UPDATE to eth0 ifindex 22002/04/28 22:18:23 RIP: mult

20、icast announce on eth02002/04/28 22:18:23 RIP: update routes on interface eth0 ifindex 22002/04/28 22:19:04 RIP: update timer fire!2002/04/28 22:19:04 RIP: SEND UPDATE to eth0 ifindex 22002/04/28 22:19:04 RIP: multicast announce on eth02002/04/28 22:19:04 RIP: update routes on interface eth0 ifindex

21、 2-8<-RIP 每隔 30秒發(fā)送一次更新, 在 sh ip prot可以看到 Sending updates every 30 seconds with +/-50%第二臺(tái)機(jī)器的設(shè)置進(jìn)入第二臺(tái)機(jī)器的 rip 設(shè)置shell_2> ripd -dshell_2> telnet localhost 2602Password:ripd> enripd# conf tripd(config# hostname r2_ripdr2_ripd(config# router rip執(zhí)行完 network 命令, 我們看到第一臺(tái)機(jī)器的 tail -f /usr/local/etc/

22、ripd.log輸出下面的信 息:-8<-2002/04/28 22:19:15 RIP: RECV REQUEST version 2 packet size 242002/04/28 22:19:35 RIP: update timer fire!2002/04/28 22:19:35 RIP: SEND UPDATE to eth0 ifindex 22002/04/28 22:19:35 RIP: multicast announce on eth02002/04/28 22:19:35 RIP: update routes on interface eth0 ifindex 2

23、-8<-r1_ripd# copy run startConfiguration saved to /usr/local/etc/ripd.confr2_ripd# copy run startConfiguration saved to /usr/local/etc/ripd.confZebra 還支持很多 RIP 功能,如果 Filtering RIP Routes, RIP route-map, RIP Authentication等,有條件有時(shí)間 的話可以做更復(fù)雜的實(shí)驗(yàn)。3、用 Zebra 做 OSPF 實(shí)驗(yàn)OSPF (開放最短路徑優(yōu)先 路由協(xié)議是一項(xiàng) 鏈路狀態(tài)型技術(shù), 是目前

24、IGP 中應(yīng)用最廣、 性能最優(yōu)的一個(gè) 協(xié)議,解決了 RIP 不能解決的大型、可擴(kuò)展的網(wǎng)絡(luò)需求而寫的,適用于大 規(guī)模的網(wǎng)絡(luò)。Zebra 支持 OSPFv2和 OSPFv3(用于 IPv6的 OSPF , CISCO 還未對(duì)其封裝 ,由于條件所 限,下面的 OSPF 實(shí) 驗(yàn)同樣是在兩臺(tái)單網(wǎng)卡的 RedHat7.2下做的。Zebra 使用 ospfd 程序?qū)崿F(xiàn) OSPF 路由功能,但 ospfd 需要從 zebra 程序獲得接口信息, 所以 zebra 程序必須在 ospfd 程序之前運(yùn)行。 ospfd 不支持多個(gè) OSPF 進(jìn)程,我們不能指定 OSPF 進(jìn)程號(hào)。初始化第一臺(tái)機(jī)器:shell_1&g

25、t; cd /usr/local/etcshell_1> zebra -d進(jìn)入 zebra 設(shè)置 IPshell_1> telnet localhost 2601Password:Router> enPassword:Router# conf tRouter(config# hostname r1r1(config# int eth0r1(config-if# ctrl+zr1# copy run start進(jìn)入第一臺(tái)機(jī)器的 ospf 設(shè)置shell_1> ospfd -dshell_1> telnet localhost 2604Password:ospfd&g

26、t; enospfd# conf tospfd(config# hostname r1_ospfd !改個(gè)名字好辨認(rèn)r1_ospfd(config# router ospf !啟動(dòng) ospf! 最關(guān)鍵的,來(lái)標(biāo)識(shí)路由器上哪些 IP 網(wǎng)絡(luò)號(hào)是 OSPF 的一部分,對(duì)于每個(gè)網(wǎng)絡(luò),我們必 須標(biāo)識(shí)該網(wǎng)絡(luò)所屬 的區(qū)域。由于我們只有兩臺(tái)機(jī)器,當(dāng)然只有一個(gè)網(wǎng)絡(luò),所以只需執(zhí)行一 個(gè) network 命令就夠了。對(duì)于我們的小網(wǎng)絡(luò), ospf 就算 配好了,下面來(lái)檢驗(yàn)一下:r1_ospfd(config-router# ctrl+zr1_ospfd# sh ip ospf route= OSPF network r

27、outing table =directly attached to eth0= OSPF router routing table = OSPF external routing table =r1_ospfd# sh ip ospf databaseLink IDADV RouterAge Seq#CkSum Link countr1_ospfd# sh ip ospf int eth0eth0 is up, line protocol is upTransmit Delay is 1 sec, State DR, Priority 1No backup designated router

28、 on this networkTimer intarvals configured, Hello 10, Dead 40, Wait 40, Retransmit 5Hello due in 00:00:07Neighbor Count is 0, Adjacent neighbor count is 0由于網(wǎng)絡(luò)里沒有其它 的路由器, r1就把自己選為 DR (指定路由器了。 Zebra 對(duì) log 處理可能有些問(wèn)題,使 用 log stdout 不能顯示各種 debug 信息,所以只能記錄到文件,在shell 下用 tail 命令查看。而且 debug 命令和 實(shí)際路由器也有不同。r1_o

29、spfd# debug ospf eventr1_ospfd(config# log file /usr/local/etc/ospfd.log然后我們?cè)?shell 下查看 debug 信息shell_1> tail -f /usr/local/etc/ospfd.log-8<-8<-第二臺(tái)機(jī)器的設(shè)置shell_2> ospfd -dshell_2> telnet localhost 2604Password:ospfd> enospfd# conf tospfd(config# hostname r2_ospfdr2_ospfd(config# rout

30、er ospf執(zhí)行完 network 命令,我們看到第一臺(tái)機(jī)器的 tail -f /usr/local/etc/ospfd.log輸出下面的 信息:-8<-2002/04/28 14:25:52 OSPF: couldn't find any VL to associate the packet with2002/04/28 14:25:52 OSPF: PacketDD: Negotiation done (Slave.-8<-r1_ospfd# sh ip ospf neigNeighbor ID Pri State Dead Time Address Interfac

31、e RXmtLRqstL DBsmL檢驗(yàn)其它信息r1_ospfd# sh ip ospf databaseLink IDADV RouterAge Seq#CkSum Link countLink IDADV RouterAge Seq#CkSumr1_ospfd# sh ip ospf int eth0eth0 is up, line protocol is upTransmit Delay is 1 sec, State DR, Priority 1Timer intarvals configured, Hello 10, Dead 40, Wait 40, Retransmit 5Hel

32、lo due in 00:00:01Neighbor Count is 1, Adjacent neighbor count is 1拔掉兩臺(tái)機(jī)器連接的網(wǎng)線,看 ospfd.log 的記錄:-8<-2002/04/28 16:26:37 OSPF: ospf_check_abr_status(: Start2002/04/28 16:26:37 OSPF: ospf_check_abr_status(: looked through areas2002/04/28 16:26:37 OSPF: ospf_check_abr_status(: bb_configured: 12002/04

33、/28 16:26:37 OSPF: ospf_check_abr_status(: bb_act_attached: 12002/04/28 16:26:37 OSPF: ospf_check_abr_status(: areas_configured: 12002/04/28 16:26:37 OSPF: ospf_check_abr_status(: areas_act_attached: 12002/04/28 16:26:37 OSPF: ospf_check_abr_status(: Start2002/04/28 16:26:37 OSPF: ospf_check_abr_sta

34、tus(: looked through areas2002/04/28 16:26:37 OSPF: ospf_check_abr_status(: bb_configured: 12002/04/28 16:26:37 OSPF: ospf_check_abr_status(: bb_act_attached: 12002/04/28 16:26:37 OSPF: ospf_check_abr_status(: areas_configured: 12002/04/28 16:26:37 OSPF: ospf_check_abr_status(: areas_act_attached: 1

35、2002/04/28 16:26:37 OSPF: Timerrouter-LSA: (router-LSA Refresh expire2002/04/28 16:26:37 OSPF: there are 0 of them2002/04/28 16:26:37 OSPF: SPF: calculation timer scheduled2002/04/28 16:26:37 OSPF: SPF: calculation timer delay = 52002/04/28 16:26:42 OSPF: ospf_spf_calculate: Start2002/04/28 16:26:42

36、 OSPF: = OSPF routing table =2002/04/28 16:26:42 OSPF: =2002/04/28 16:26:42 OSPF: ospf_intra_add_stub(: Start2002/04/28 16:26:42 OSPF: ospf_intra_add_stub(: installing new route2002/04/28 16:26:42 OSPF: ospf_intra_add_stub(: this network is on this router2002/04/28 16:26:42 OSPF: children of V:2002/04/28 16:26:42 OSPF: ospf_spf_calculate: Stop2002/04/28 16

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論