1. 程式人生 > >實驗5 動態路由協議配置-RIP

實驗5 動態路由協議配置-RIP

【實驗目的及要求】
1.理解動態路由協議的工作原理;
2.掌握動態路由協議的配置方法
3.通過動態路由技術實現網路的互連互通,從而實現資訊的共享和傳遞。
【實驗內容】
假設校園網通過1臺三層交換機連線到校園網出口路由器,路由器連線到校園外的另1臺路由器上,現要在路由器上做適當配置,實現校園網內部主機與校園網外部的相互通訊。
本案例以兩臺R2624路由器、1臺三層交換機為例。S31上劃分有VLAN10和VLAN50,其中VLAN10用於連線Router1,VLAN50用於連線校園網主機。路由器分別命名為Router1和Router2,路由器之間用過串列埠採用V35 DCE/DTE電纜連線,DCE端連線到Router1上。PC1的IP地址和預設閘道器分別為172.16.5.11和172.16.5.1,PC2的IP地址和預設閘道器分別為172.16.3.22和172.16.3.1,網路掩碼都是255.255.255.0.
【實驗拓撲】


路由器之間相連之前,需要先為兩個路由器開啟序列介面
這裡寫圖片描述

【IP地址規劃表】
這裡寫圖片描述

【案例實施】
步驟1 基本配置
1.1三層交換機的基本配置

Switch>enable
Switch#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#hostname S31
S31(config)#VLan 10
S31(config-vlan)#exit

S31(config)#interface range fastEthernet 0/1-2
S31(config-if
-range)#switchport access vlan 10 S31(config-if-range)#exit S31(config)#interface vlan 10 S31(config-if)#ip address 172.16.10.254 255.255.255.0 S31(config-if)#no shutdown S31(config-if)#exit S31(config)#interface f0/24 S31(config-if)#no switchport S31(config-if)#ip address 172.16.1.1 255.255.255.0 S31(config-if
)#exit S31(config)#ip routing

驗證測試:
(1)驗證VLAN相關配置
S31#show vlan
這裡寫圖片描述

(2)驗證介面IP配置
這裡寫圖片描述

1.2路由器基本配置

Router1:
Router>enable
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname router1
router1(config)#interface FastEthernet0/0
router1(config-if)#ip address 172.16.1.254 255.255.255.0
router1(config-if)#no shutdown
router1(config-if)#exit

router1(config)#interface serial 0/1/0
router1(config-if)#ip address 172.16.2.1 255.255.255.0
router1(config-if)#no shutdown
router2:
Router>enable
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname router2
router2(config)#interface serial 0/1/0
router2(config-if)#ip address 172.16.2.2 255.255.255.0
router2(config-if)#no shutdown
router2(config-if)#clock rate 64000
router2(config-if)#exit

router2(config)#interface FastEthernet0/0
router2(config-if)#ip address 172.16.3.254 255.255.255.0
router2(config-if)#no shutdown
router2(config-if)#exit

驗證測試:驗證介面的配置和狀態
router1#show ip interface brief

這裡寫圖片描述

router2#show ip interface brief

這裡寫圖片描述
注意觀察介面IP地址和子網掩碼以及是否啟用(狀態up)

步驟2 配置RIP
S31配置RIP協議

S31(config)#router rip                  ! 開啟rip協議程序
S31(config-router)#network 172.16.10.0    ! 申明本裝置的直連網段
S31(config-router)#network 172.16.1.0
S31(config-router)#version  2            ! 定義rip協議v2

router1配置RIP協議

router1(config)#router rip
router1(config-router)#network 172.16.1.0
router1(config-router)#network 172.16.2.0
router1(config-router)#version 2
router1(config-router)#no auto-summary   ! 關閉路由資訊的自動彙總

router2配置RIP協議

router2(config)#router rip
router2(config-router)#network 172.16.2.0
router2(config-router)#network 172.16.3.0
router2(config-router)#version 2
router2(config-router)#no auto-summary

步驟3 驗證三臺路由裝置(S31、Router1和Router2)的路由表,檢視是否學習了其它網段的路由資訊

步驟4 驗證測試
PC>ping 172.16.10.2 !從PC1 ping PC2
這裡寫圖片描述
PC>ping 172.16.3.1 !從PC1 ping PC3
這裡寫圖片描述
注意事項
1. 在串列埠上配置時鐘頻率時,一定要在電纜的DCE端配置,否則鏈路不通。
2. No auto-summary 功能只在RIP2支援。
3. S31沒有No auto-summary命令。
4. PC主機閘道器一定要指向直連埠IP地址,例如PC1閘道器指向三層交換機vlan10的IP地址。