RIPv1基本配置
拓撲結構:
實驗步驟1:路由器基本IP配置
R1基本配置:
R1(config)#int lo0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#int s1/0
R1(config-if)#ip add 192.168.12.1255.255.255.0
R1(config-if)#no shut
R2基本配置:
R2(config)#int s1/0
R2(config-if)#ip add 192.168.12.2255.255.255.0
R2(config-if)#no shut
R2(config-if)#int s1/1
R2(config-if)#ip add 192.168.23.2255.255.255.0
R2(config-if)#no sh
R3基本配置:
R3(config)#int s1/0
R3(config-if)#ip add 192.168.23.3255.255.255.0
R3(config-if)#no sh
R3(config-if)#int s1/1
R3(config-if)#ip add 192.168.34.3255.255.255.0
R3(config-if)#no sh
R4基本配置:
R4(config)#int s1/0
R4(config-if)#ip add 192.168.34.4255.255.255.0
R4(config-if)#no sh
R4(config-if)#int lo0
R4(config-if)#ip add 4.4.4.4 255.255.255.0
實驗步驟2:RIP路由通告
R1配置:
R1(config)#router rip //啓動RIP進程
R1(config-router)#network 1.1.1.1 //network命令通告各接口路由,注意RIPv1是classfull協議
R1(config-router)# network 192.168.12.0
R2配置:
R2(config-if)#router rip
R2(config-router)#network 192.168.12.0
R2(config-router)#network 192.168.23.0
R3配置:
R3(config)#router rip
R3(config-router)#network 192.168.23.0
R3(config-router)#network 192.168.34.0
R4配置:
R4(config-if)#router rip
R4(config-router)#network 192.168.34.0
R4(config-router)#netwo 4.4.4.4
實驗調試:
R1#showip rout //查看R1路由表
C 192.168.12.0/24 is directly connected, Serial1/0 //R1直連路由,通過S1/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/1] via 192.168.12.2,00:00:21, Serial1/0 //通過RIP學習到A類路由
R 192.168.23.0/24 [120/1] via 192.168.12.2, 00:00:21, Serial1/0 //通過RIP學習C類路由
R 192.168.34.0/24 [120/1] via 192.168.12.2, 00:00:21, Serial1/0 //通過RIP學習C類路由
路由條目“4.0.0.0/8 [120/1] via 192.168.12.2, 00:00:21, Serial1/0”的含義如下:
① R:路由條目是通過 RIP 路由協議學習來的;
② 4.0.0.0/8:目的網絡;
③ 120:RIP 路由協議的默認管理距離;
④1: 度量值,從路由器 R1 到達網絡 4.0.0.0/8 的度量值爲1 跳;//問題來了,怎麼只有1跳?
⑤ 192.168.12.2:下一跳地址;//相鄰路由器接口的IP地址
⑥ 00:00:03:距離下一次更新還有 27(30-3)秒;
⑦ Serial1/0:接收該路由條目的本路由器R1的接口。
R1#show ip protocols //查看R1路由協議
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 22 seconds //更新週期是 30 秒,距離下次更新還有 23秒
Invalid after 180 seconds, hold down 180, flushed after 240 //無效時間、抑制時間和刷新時間
Redistributing: rip //只運行 RIP 協議,沒有其它的協議重分佈進來
Default version control: send version 1, receive any version //默認發送版本 1 的路由更新,接收本版 1 的路由更新
Interface Send Recv Triggered RIP Key-chain
Serial1/0 1 1 2
Loopback0 1 1 2
//以上三行顯示了運行 RIP協議的接口,以及可以接收和發送的 RIP 路由更新的版本
Automatic network summarization is in effect //RIP 路由協議默認開啓自動彙總功能
Maximum path: 4 //RIP 路由協議可以支持 4 條等價路徑,最大爲 6 條
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:13
Distance: (default is 120)
//以上三行表明路由信息源,其中:
//gateway:學習路由信息的路由器的接口地址,也就是下一跳地址
//distance:管理距離
//last update:更新發生在多長時間以前
Distance: (default is 120)
//默認管理距離是 120
【注意】爲了防止更新同步,RIP 會以 15%的誤差發送更新,即實際發送更新的週期的範圍是
25.5-30 秒。//老師在上課時候提到該注意點。
R1#debug ip rip //該命令可以查看 RIP 路由協議的動態更新過程。
Dec12 11:08:00.615: RIP: sending v1 update to 255.255.255.255 via Serial1/0(192.168.12.1)
*Dec12 11:08:00.615: RIP: build update entries
*Dec12 11:08:00.615: network 1.0.0.0 metric1
R1#
*Dec12 11:08:09.095: RIP: received v1 update from 192.168.12.2 on Serial1/0
*Dec12 11:08:09.095: 4.0.0.0 in 1 hops
*Dec12 11:08:09.099: 192.168.23.0 in 1hops
*Dec12 11:08:09.099: 192.168.34.0 in 1hops
R1#debugip rip
*Dec12 11:08:18.631: RIP: sending v1 update to 255.255.255.255 via Loopback0(1.1.1.1)
*Dec12 11:08:18.631: RIP: build update entries
*Dec12 11:08:18.631: network 4.0.0.0 metric1
*Dec12 11:08:18.635: network 192.168.12.0metric 1
*Dec12 11:08:18.635: network 192.168.23.0metric 1
*Dec12 11:08:18.635: network 192.168.34.0metric 1 //可以看到 RIPv1 採用廣播更新(255.255.255.255),分別向 Loopback0和 s0/0/0 發送路由更新,同時從 s0/0/0 接收三條路由更新,分別是 4.0.0.0,度量值是 1跳;192.168.34.0, 度量值是 1 跳;192.168.23.0,度量值是 1 跳。這裏有問題的?
【flash update】flash update(閃式更新)指的是當網絡上某個路徑的度量值發生變化,路由器立即發出更新信息,而不管是否到達常規路由信息更新的週期。
學習心得:
路由協議如何啓動進程;
router rip、network *.*.*.*操作命令及其作用;
路由表含義;
調試命令:show ip route、show ip protocols、debug ip rip,這些命令我常常忘記。