1. 程式人生 > >實驗5 RIP實驗

實驗5 RIP實驗

1.實驗目的 1)掌握RIP v1RIP v2的配置方法 2)觀測動態路由的建立過程 3)比較RIP v1RIP v2特點 2.實驗原理 RIP(Routing information Protocol)是應用較早、使用較普遍的內部閘道器 協議(Interior Gateway Protocol,簡稱IGP),適用於小型同類網路,是典型的距離向量(distance-vector)協議。文件見RFC1058、RFC1723。 RIP通過廣播UDP報文來交換路由資訊,每30秒傳送一次路由資訊更新。RIP提供跳躍計數(hop count)作為尺度來衡量路由距離,跳躍計數是一個包到達目標所必須經過的路由器的數目。如果到相同目標有二個不等速或不同頻寬的路由器,但跳躍計數相同,則RIP認為兩個路由是等距離的。RIP最多支援的跳數為15,即在源和目的網間所要經過的最多路由器的數目為15,跳數16表示不可達。
RIP v2 RIP v1 而來,屬於 RIP 協議的補充協議,主要用於擴大 RIP 2 資訊裝載的有用資訊的數量,同時增加其安全效能。RIP 2 是一種基於 UDP 的協議。在 RIP2 下,每臺主機通過路由選擇程序傳送和接受來自 UDP 520的資料包。 3.實驗過程 3.1.配置路由器各個介面IP地址 London(config)#int s0/0/1 London(config-if)#ip add 10.3.3.1 255.255.255.0 London(config-if)#no sh London(config-if)#int lo 0 London(config-if)#ip add 10.1.1.1 255.255.255.0
London(config-if)#no sh London(config-if)#int lo 1 London(config-if)#ip add 10.2.2.1 255.255.255.224 London(config-if)#no sh London(config-if)# London#ping 10.3.3.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.3.3.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 16/16/16 ms
3.2.配置RIP v1 London(config)#router rip London(config-router)#net 10.0.0.0 London#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      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks C       10.3.3.0/24 is directly connected, Serial0/0/1 C       10.2.2.0/27 is directly connected, Loopback1 C      10.1.1.0/24 is directly connected, Loopback0 C    192.168.100.0/24 is directly connected, FastEthernet0/1 London#show cdp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge                   S - Switch, H - Host, I - IGMP, r - Repeater Device ID        Local Intrfce     Holdtme    Capability Platform Port ID Denver           Ser 0/0/0          172        R S I      2811      Ser 0/0/1 sw5              Fas 0/1            126         S I       WS-C3560- Fas 0/3 Florence         Ser 0/0/1          159        R S I      2811      Ser 0/0/0 London#show ip rip database 10.0.0.0/8    auto-summary 10.1.1.0/24    directly connected, Loopback0 10.2.2.0/27    directly connected, Loopback1 10.3.3.0/24    directly connected, Serial0/0/1 3.3.檢視Florence上的路由資訊 Florence#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      172.16.0.0/24 is subnetted, 1 subnets C       172.16.3.0 is directly connected, Serial0/0/1      10.0.0.0/24 is subnetted, 1 subnets C       10.3.3.0 is directly connected, Serial0/0/0 C    192.168.1.0/24 is directly connected, Loopback0 C    192.168.100.0/24 is directly connected, FastEthernet0/1 現在是沒有10.2.20/27172.16.2.0/27這個兩個IP路由資訊。這是因為RIP v1不能識別子網網路地址,不支援變長子網掩碼。 3.4.將RIP v1升級為RIP v2再看看網路聯通情況 London(config)#router rip London(config-router)#version 2 London#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 10.3.3.2 to network 172.16.0.0 R*   172.16.0.0/16 [120/1] via 10.3.3.2, 00:00:06, Serial0/0/1      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks C       10.3.3.0/24 is directly connected, Serial0/0/1 C       10.2.2.0/27 is directly connected, Loopback1      10.1.1.0/24 is directly connected, Loopback0 R    192.168.1.0/24 [120/1] via 10.3.3.2, 00:00:06, Serial0/0/1 C    192.168.100.0/24 is directly connected, FastEthernet0/1 London#show ip protocol Routing Protocol is "ospf 1"  Outgoing update filter list for all interfaces is not set  Incoming update filter list for all interfaces is not set  Router ID 10.1.1.1  Number of areas in this router is 1. 1 normal 0 stub 0 nssa  Maximum path: 4  Routing for Networks:     192.23.1.0 0.0.0.255 area 0     192.34.1.0 0.0.0.255 area 0  Reference bandwidth unit is 100 mbps  Routing Information Sources:     Gateway         Distance      Last Update  Distance: (default is 110) Routing Protocol is "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 8 seconds  Invalid after 180 seconds, hold down 180, flushed after 240  Redistributing: rip  Default version control: send version 2, receive version 2     Interface             Send Recv Triggered RIP Key-chain     Serial0/0/1           2     2     Loopback0             2     2     Loopback1             2     2  Automatic network summarization is in effect  Maximum path: 4  Routing for Networks:     10.0.0.0     172.16.0.0  Routing Information Sources:     Gateway         Distance      Last Update     10.3.3.2             120      00:00:20  Distance: (default is 120) 3.5.在Florence上關閉路由自動彙總功能 London#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 10.3.3.2 to network 172.16.0.0  *   172.16.0.0/16 is variably subnetted, 4 subnets, 3 masks R*      172.16.0.0/16 [120/1] via 10.3.3.2, 00:00:49, Serial0/0/1 R       172.16.1.0/24 [120/2] via 10.3.3.2, 00:00:22, Serial0/0/1 R       172.16.2.0/27 [120/2] via 10.3.3.2, 00:00:22, Serial0/0/1 R       172.16.3.0/24 [120/1] via 10.3.3.2, 00:00:22, Serial0/0/1      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks C       10.3.3.0/24 is directly connected, Serial0/0/1 C       10.2.2.0/27 is directly connected, Loopback1 C       10.1.1.0/24 is directly connected, Loopback0 R    192.168.1.0/24 [120/1] via 10.3.3.2, 00:00:22, Serial0/0/1 C    192.168.100.0/24 is directly connected, FastEthernet0/1 多了很多一樣的路由資訊,這就給路由表多了很多冗餘資訊,並且也增加了資料包轉發的時間。 3.6.將物理介面配置為passive-interface模式 London(config)#router rip London(config-router)#passive-interface s0/0/1 London#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      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks C       10.3.3.0/24 is directly connected, Serial0/0/1 C       10.2.2.0/27 is directly connected, Loopback1 C       10.1.1.0/24 is directly connected, Loopback0 C    192.168.100.0/24 is directly connected, FastEthernet0/1 這裡由於使用passive-interface命令告知動態路由協議不要通過該介面傳送網路廣播,各個路由器上的路由表都沒有動態更新了。 3.7.使用neighbor命令配置RIP的單播更新 London(config)#router rip London(config-router)#neighbor 10.3.3.2 London#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  *   172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks R       172.16.1.0/24 [120/2] via 10.3.3.2, 00:00:15, Serial0/0/1 R       172.16.2.0/27 [120/2] via 10.3.3.2, 00:00:15, Serial0/0/1 R       172.16.3.0/24 [120/1] via 10.3.3.2, 00:00:15, Serial0/0/1      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks C       10.3.3.0/24 is directly connected, Serial0/0/1 C       10.2.2.0/27 is directly connected, Loopback1 C       10.1.1.0/24 is directly connected, Loopback0 R    192.168.1.0/24 [120/1] via 10.3.3.2, 00:00:15, Serial0/0/1 C    192.168.100.0/24 is directly connected, FastEthernet0/1 London# London#ping 172.16.1.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 28/28/32 ms 使用neighbor命令可以配置RIP的單播更新,這樣就可以讓網路重新互通。 4.實驗分析與總結 通過這次實驗讓我們更深刻的瞭解了路由表中動態路由的用法和好處。同時我們又多接觸了一些Cisco IOS命令。 下面對RIP動態路由協議總結一下: 動態路由協議分為距離向量路由協議和鏈路狀態路由協議,兩種協議各有特點,下面對距離向量路由協議作簡要敘述。 RIP協議最初是為Xerox網路系統的Xerox parc通用協議而設計的,是Internet中常用的路由協議。RIP採用距離向量演算法,即路由器根據距離選擇路由,所以也稱為距離向量協議。路由器收集所有可到達目的地的不同路徑,並且儲存有關到達每個目的地的最少站點數的路徑資訊,除到達目的地的最佳路徑外,任何其它資訊均予以丟棄。同時路由器也把所收集的路由資訊用RIP協議通知相鄰的其它路由器。這樣,正確的路由資訊逐漸擴散到了全網。 RIP使用非常廣泛,它簡單、可靠,便於配置。但是RIP只適用於小型的同構網路,因為它允許的最大站點數為15,任何超過15個站點的目的地均被標記為不可達。而且RIP每隔30s一次的路由資訊廣播也是造成網路的廣播風暴的重要原因之一。