實驗名稱:RIPv2配置
實驗目的:
通過本實驗可以掌握:
(1)在路由器上啓動 RIPv1 路由進程
(2)啓用參與路由協議的接口,並且通告網絡
(3)理解路由表的含義
(4)查看和調試 RIPv1 路由協議相關信息
拓撲結構
實驗拓撲如圖 4-1 所示。
實驗步驟:
(1)步驟 1:配置路由器 R1
R1(config)# router rip //啓動 RIP 進程
R1(config-router)# version 1 //配置 RIP 版本 1
R1(config-router)# network 1.0.0.0 //通告網絡
R1(config-router)# network 192.168.12.0
(2)步驟 2:配置路由器 R2
R2(config)# router rip
R2(config-router)# version 1
R2(config-router)# network 192.168.12.0
R2(config-router)# network 192.168.23.0
(3)步驟 3:配置路由器 R3
R3(config)# router rip
R3(config-router)# version 1
R3(config-router)# network 192.168.23.0
R3(config-router)# network 192.168.34.0
(4)步驟 4:配置路由器 R4
R4(config)# router rip
R4(config-router)# version 1
R4(config-router)# network 192.168.34.0
R4(config-router)# network 4.0.0.0
4.實驗調試
(1) show ip route
該命令用來查看路由表。
R1# show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, Serial0/0/0
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
R 4.0.0.0/8 [120/3] via 192.168.12.2, 00:00:03, Serial0/0/0
R 192.168.23.0/24 [120/1] via 192.168.12.2, 00:00:03, Serial0/0/0
R 192.168.34.0/24 [120/2] via 192.168.12.2, 00:00:03, Serial0/0/0
R 4.0.0.0/8 [120/3] via 192.168.12.2, 00:00:03, Serial0/0/0
R 192.168.23.0/24 [120/1] via 192.168.12.2, 00:00:03, Serial0/0/0
R 192.168.34.0/24 [120/2] via 192.168.12.2, 00:00:03, Serial0/0/0
以上輸出表明路由器 R1 學到了 3 條 RIP 路由,其中路由條目“R 4.0.0.0/8 [120/3]
via 192.168.12.2, 00:00:03, Serial0/0/0
R 4.0.0.0/8 [120/3]
via 192.168.12.2, 00:00:03, Serial0/0/0”的含義如下:
① R:路由條目是通過 RIP 路由協議學習來的;
② 4.0.0.0/8 :目的網絡;
③ 120:RIP 路由協議的默認管理距離;
④ 3: 度量值,從路由器 R1 到達網絡 4.0.0.0/8 的度量值爲 3 跳;
⑤ 192.168.12.2:下一跳地址;
⑥ 00:00:03:距離下一次更新還有 27(30-3)秒;
⑦ Serial0/0/0:接收該路由條目的本路由器的接口。
同時通過該路由條目的掩碼長度可以看到,RIPv1 確實不傳遞子網信息。
(2)show ip protocols
該命令查看 IP 路由協議配置和統計信息。
R1# show ip protocols
【注意 】
“//”後的信息表示註釋,不是輸出內容。
Routing Protocol is "rip"
//路由器上運行的路由協議是 RIP
Outgoing update filter list for all interfaces is not set
//在出方向上沒有設置過濾列表
Incoming update filter list for all interfaces is not set
//在入方向上沒有設置過濾列表
Sending updates every 30 seconds, next due in 23 seconds
//更新週期是 30 秒,距離下次更新還有 23 秒
【注意 】
爲了防止更新同步,RIP 會以 15%的誤差發送更新,即實際發送更新的週期的範圍是
25.5-30 秒。
Invalid after 180 seconds, hold down 180, flushed after 240
// invalid after:路由條目如果在 180 秒還沒有收到更新,則被標記爲無效
【技術要點 】
被標記爲無效的路由條目類似如下所示:
R 4.0.0.0/8 is possibly down, routing via 192.168.12.2, Serial0/0/0
可以通過很多方式使路由條目進入無效週期,例如在接口上加拒絕接收 UDP520 端口的
ACL,還比如將接口設置爲被動接口等。
// hold down:抑制計時器的時間爲 180 秒
// flushed after:路由條目如果在 240 秒還沒有收到更新,則從路由表中刪除此路由條目
【提示 】
可以通過下面的命令來調整以上三個時間參數:
R1(config-router)# timers basic update invalid holddown flushed
Redistributing: rip
//只運行 RIP 協議,沒有其它的協議重分佈進來
Default version control: send version 1, receive version 1
//默認發送版本 1 的路由更新,接收本版 1 的路由更新
Interface Send Recv Triggered RIP Key-chain
Serial0/0/0 1 1
Loopback0 1 1
//以上三行顯示了運行 RIP 協議的接口,以及可以接收和發送的 RIP 路由更新的版本
Automatic network summarization is in effect
//RIP 路由協議默認開啓自動彙總功能
Maximum path: 4
//RIP 路由協議可以支持 4 條等價路徑,最大爲 6 條
【提示 】
可以通過下面的命令來修改 RIP 路由協議支持等價路徑的條數:
R1(config-router)# maximum-paths number-paths
Routing for Networks:
1.0.0.0
192.168.12.0
//以上三行表明 RIP 通告的網絡
Routing Information Sources:
Gateway Distance Last Update
192.168.12.2 120 00:00:03
//以上三行表明路由信息源,其中:
// gateway:學習路由信息的路由器的接口地址,也就是下一跳地址
// distance:管理距離
// last update:更新發生在多長時間以前
Distance: (default is 120)
//默認管理距離是 120
(3)debug ip rip
該命令可以查看 RIP 路由協議的動態更新過程。
R1#clear ip route *
R1#debug ip rip
clear ip route *
R1#debug ip rip
Feb 9 12:43:13.311: RIP: sending request on Serial0/0/0 to 255.255.255.255
Feb 9 12:43:13.315: RIP: sending request on Loopback0 to 255.255.255.255
Feb 9 12:43:13.323: RIP: received v1 update from 192.168.12.2 on Serial0/0/0
Feb 9 12:43:13.323: 4.0.0.0 in 3 hops
Feb 9 12:43:13.323: 192.168.23.0 in 1 hops
Feb 9 12:43:13.323: 192.168.34.0 in 2 hops
Feb 9 12:43:15.311: RIP: sending v1 flash update to 255.255.255.255 via Loopback0 (1.1.1.1)
Feb 9 12:43:15.311: RIP: build flash update entries
Feb 9 12:43:15.311: network 4.0.0.0 metric 4
Feb 9 12:43:15.311: network 192.168.12.0 metric 1
Feb 9 12:43:15.311: network 192.168.23.0 metric 2
Feb 9 12:43:15.311: network 192.168.34.0 metric 3
Feb 9 12:43:15.311: RIP: sending v1 flash update to 255.255.255.255 via Serial0/0/0
(192.168.12.1)
Feb 9 12:43:15.311: RIP: build flash update entries
Feb 9 12:43:15.311: network 1.0.0.0 metric 1
通過以上輸出,可以看到 RIPv1 採用廣播更新(255.255.255.255),分別向 Loopback0
和 s0/0/0 發送路由更新,同時從 s0/0/0 接收三條路由更新,分別是 4.0.0.0,度量值是 3
跳;192.168.34.0, 度量值是 2 跳;192.168.23.0,度量值是 1 跳。
【技術要點】
flash update
】
flash update(閃式更新)指的是當網絡上某個路徑的度量值發生變化,路由器立即
發出更新信息,而不管是否到達常規路由信息更新的週期。
實驗過程圖: