溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

實驗設(shè)計與排錯之二RIPI、II的區(qū)別

發(fā)布時間:2020-08-22 01:12:13 來源:網(wǎng)絡(luò) 閱讀:679 作者:deshen_feng 欄目:網(wǎng)絡(luò)安全

一、動態(tài)路由

動態(tài)路由協(xié)議有靈活等很多優(yōu)點,但是缺點也有,比如占用了額外的帶寬,CPU負荷高。

管理距離(Administrative Distances):0到255之間的1個數(shù),它表示一條路由選擇信息源的可信性值。該值越小,可信性級別越高。0為最信任,255為最不信任。即沒有從這條線路將沒有任何流量通過。

假如1臺路由器收到遠端的2條路由更新,路由器將檢查管理距離,管理距離值低的將被選為新路線存放于路由表中;若它們擁有相同的管理距離,將比較它們的度(Metric)。度低的將作為新線路;若它們的管理距離和度都一樣,那么將在2條線路做均衡負載。

一些常用路由協(xié)議默認的管理距離:

l  直接相連:0

l  靜態(tài)路由:1

l  EIGRP:90

l  IGRP:100

l  OSPF:110

l  RIP:120

注意:如果你在1條線路上配置了靜態(tài)路由,又配置了RIP,默認情況下,路由器只會使用靜態(tài)路由,因為靜態(tài)路由的管理距離為1小于RIP的管理距離。

三種路由協(xié)議:

  • 距離向量(Distance Vector)

  • 鏈路狀態(tài)(Link State)

  • 混合型(Hybrid)

距離向量:用于根據(jù)距離(Distance)來判斷最佳路徑,當1個數(shù)據(jù)包每經(jīng)過1個路由器時,被稱之為經(jīng)過1跳,經(jīng)過跳數(shù)最少的則作為最佳路徑,這類協(xié)議的有RIP和IGRP。

  鏈路狀態(tài):也叫最短路徑優(yōu)先(Shortest-Path-First)協(xié)議。每個路由器創(chuàng)建3張單獨的表,1張用來跟蹤與它直接相連的相鄰路由器,1張用來決定網(wǎng)絡(luò)的整個拓撲結(jié)構(gòu),另外1張作為路由表,所以這種協(xié)議對網(wǎng)絡(luò)的了解程度要比距離向量高,這類協(xié)議有OSPF。

  混合型:綜合了前2者的特征,這類協(xié)議的有EIGRP。

二、RIP I、RIP II的區(qū)別

RIPv1

  • 使用廣播的方式發(fā)送路由更新;

  • 路由更新信息中不攜帶子網(wǎng)掩碼,為有類路由協(xié)議;

  • RIP報文大小限制是512字節(jié),最多可以攜帶25條路由信息;

RIPv2

  • 路由信息中加入了子網(wǎng)掩碼,無類的路由協(xié)議;

  • RIPv2發(fā)送更新報文的方式為組播,組播地址為224.0.0.9;

  • 支持認證;

 

特性

RIPv1

RIPv2

采用跳數(shù)為度量值

15是最大的有效度量值,16為無窮大

默認30s更新周期

周期性更新時發(fā)送全部路由信息

拓撲改變時發(fā)送只針對變化的觸發(fā)更新

使用路由毒化、水平分割、毒性逆轉(zhuǎn)

使用抑制計時器

發(fā)送更新的方式

廣播

組播

使用UDP 520端口發(fā)送報文

更新中攜帶子網(wǎng)掩碼,支持VLSM

支持認證

1、實例

如下拓撲環(huán)境,默認所有路由器都做了RIP v2的普通配置,并且全網(wǎng)通過RIP協(xié)議進行網(wǎng)絡(luò)互聯(lián)。

實驗設(shè)計與排錯之二RIPI、II的區(qū)別

 

 2、分析與排錯

(1)、觀察RIP路由啟用后,路由協(xié)議和路由表的信息(以R2為例)

R2#show ip protocols

Routing Protocol is "rip"

Sending updates every 30 seconds, next due in 9 seconds

Invalid after 180 seconds, hold down 180, flushed after 240

Outgoing update filter list for all interfaces is not set

Incoming update filter list for all interfaces is not set

Redistributing: rip

Default version control: send version 2, receive 2

Interface         Send        Recv                   Triggered RIP        Key-chain

Loopback0       2               2

Serial1/1          2               2

Serial1/3          2               2

Serial1/0          2               2

Serial1/2          2               2

Automatic network summarization is not in effect

Maximum path: 4

Routing for Networks:

10.0.0.0

192.168.10.0

192.168.20.0

192.168.40.0

192.168.50.0

Passive Interface(s):

Routing Information Sources:

Gateway                   Distance                             Last Update

192.168.10.2           120                             00:00:08

192.168.20.2           120                             00:00:28

192.168.50.2           120                             00:00:10

192.168.40.2           120                             00:00:24

Distance: (default is 120)

解釋:注意觀察紅色部分,如下:

Sending updates every 30 seconds, next due in 9 seconds

表示RIP每次以30秒發(fā)送更新一次路由表,而下一次更新是在9秒以后。

Invalid after 180 seconds, hold down 180, flushed after 240

此處為計時器信息,在180秒后記錄將被作為失效處理,并在180秒會被暫停且可能Down掉,240秒后將會路由表中刪除信息。

Routing for Networks:

10.0.0.0

192.168.10.0

192.168.20.0

192.168.40.0

192.168.50.0

路由的網(wǎng)絡(luò)號包括:(參考以上,此處為略)

Distance: (default is 120)

管理距離默認為120

R2#show ip route rip

10.0.0.0/16 is subnetted, 5 subnets

R                        10.2.0.0 [120/1] via 192.168.10.2, 00:00:06, Serial1/1

R                        10.5.0.0 [120/1] via 192.168.20.2, 00:00:04, Serial1/0

R                        10.11.0.0 [120/1] via 192.168.50.2, 00:00:02, Serial1/3

R                        10.12.0.0 [120/1] via 192.168.40.2, 00:00:18, Serial1/2

192.168.30.0/30 is subnetted, 1 subnets

R                        192.168.30.0 [120/1] via 192.168.40.2, 00:00:18, Serial1/2

[120/1] via 192.168.50.2, 00:00:02, Serial1/3

192.168.60.0/30 is subnetted, 1 subnets

R                        192.168.60.0 [120/1] via 192.168.10.2, 00:00:06, Serial1/1

[120/1] via 192.168.20.2, 00:00:04, Serial1/0

此處我們使用show ip route rip而沒有使用show ip route,因為show ip route rip是顯示當前路由器啟用單獨的RIP協(xié)議后的路由表,而show ip route是顯示當前路由器整個路由表信息。其中我們看到某個網(wǎng)絡(luò)是通過哪個接口,以多長時間學到的,我們能夠發(fā)現(xiàn)其時間都沒有超過30秒。

(2)、設(shè)置R5不讓R1、R2、R3、R4學到

首先我們需要知道如何才能不讓其它4臺路由器來學習R5的路由信息,這里我們可以使用RIP v1和RIP v2版本的功能特性來實現(xiàn),實驗如下:

我們先將R5的RIP版本設(shè)置為v1,看看R5和R2會有什么曲別。

R5#conf t

Enter configuration commands, one per line. End with CNTL/Z.

R5(config)#route rip

R5(config-router)#version 1

如下為R2用于實時查看路由更新,其中紅色部分可以看到“忽略來自192.168.40.2 v1版本路由信息(為非法版本)”此可以說明R5的RIP已被更改為v1且R2還是v2版,因此不能接收其路由更新。

R2#debug ip rip

RIP: received v2 update from 192.168.20.2 on Serial1/0

10.2.0.0/16 via 0.0.0.0 in 2 hops

10.5.0.0/16 via 0.0.0.0 in 1 hops

192.168.60.0/30 via 0.0.0.0 in 1 hops

RIP: received v2 update from 192.168.50.2 on Serial1/3

10.11.0.0/16 via 0.0.0.0 in 1 hops

10.12.0.0/16 via 0.0.0.0 in 2 hops

192.168.30.0/30 via 0.0.0.0 in 1 hops

RIP: ignored v1 packet from 192.168.40.2 (illegal version)

RIP: received v2 update from 192.168.10.2 on Serial1/1

10.2.0.0/16 via 0.0.0.0 in 1 hops

10.5.0.0/16 via 0.0.0.0 in 2 hops

192.168.60.0/30 via 0.0.0.0 in 1 hops

再來看R2的RIP路由表,其中紅色部分時間為00:01:49且已超過30秒,但未到達180秒,而其路由條目還準確的以30秒為單位進行更新。

R2#show ip route rip

10.0.0.0/16 is subnetted, 5 subnets

R               10.2.0.0 [120/1] via 192.168.10.2, 00:00:15, Serial1/1

R               10.5.0.0 [120/1] via 192.168.20.2, 00:00:05, Serial1/0

R               10.11.0.0 [120/1] via 192.168.50.2, 00:00:01, Serial1/3

R               10.12.0.0 [120/1] via 192.168.40.2, 00:01:49, Serial1/2

192.168.30.0/30 is subnetted, 1 subnets

R               192.168.30.0 [120/1] via 192.168.40.2, 00:01:49, Serial1/2

[120/1] via 192.168.50.2, 00:00:01, Serial1/3

192.168.60.0/30 is subnetted, 1 subnets

R               192.168.60.0 [120/1] via 192.168.10.2, 00:00:15, Serial1/1

[120/1] via 192.168.20.2, 00:00:05, Serial1/0

R2#

此為R5的RIP路由記錄,且所有路由記錄都為30秒以上,已更新不到RIP路由信息了。

R5#show ip route rip

10.0.0.0/16 is subnetted, 5 subnets

R               10.2.0.0 [120/2] via 192.168.40.1, 00:02:22, Serial0/0

R               10.5.0.0 [120/2] via 192.168.40.1, 00:02:22, Serial0/0

R               10.6.0.0 [120/1] via 192.168.40.1, 00:02:22, Serial0/0

R               10.11.0.0 [120/1] via 192.168.30.2, 00:02:14, Serial0/1

192.168.10.0/30 is subnetted, 1 subnets

R               192.168.10.0 [120/1] via 192.168.40.1, 00:02:22, Serial0/0

192.168.20.0/30 is subnetted, 1 subnets

R               192.168.20.0 [120/1] via 192.168.40.1, 00:02:22, Serial0/0

192.168.50.0/30 is subnetted, 1 subnets

R               192.168.50.0 [120/1] via 192.168.40.1, 00:02:22, Serial0/0

[120/1] via 192.168.30.2, 00:02:14, Serial0/1

192.168.60.0/30 is subnetted, 1 subnets

R               192.168.60.0 [120/2] via 192.168.40.1, 00:02:22, Serial0/0

R5#

再看看R2的RIP路由表中紅色部分,已00:03:00且為180秒,此時這兩條路由記錄已為Possibly down(為可能down掉了)

R2#show ip route rip

10.0.0.0/16 is subnetted, 5 subnets

R               10.2.0.0 [120/1] via 192.168.10.2, 00:00:26, Serial1/1

R               10.5.0.0 [120/1] via 192.168.20.2, 00:00:18, Serial1/0

R               10.11.0.0 [120/1] via 192.168.50.2, 00:00:17, Serial1/3

R               10.12.0.0 is possibly down, routing via 192.168.40.2, 00:03:00, Serial1/2

192.168.30.0/30 is subnetted, 1 subnets

R               192.168.30.0 is possibly down, routing via 192.168.40.2, 00:03:00, Serial1/2

[120/1] via 192.168.50.2, 00:00:17, Serial1/3

192.168.60.0/30 is subnetted, 1 subnets

R                192.168.60.0 [120/1] via 192.168.10.2, 00:00:26, Serial1/1

[120/1] via 192.168.20.2, 00:00:18, Serial1/0

R2#

最后再看超過240秒后,此兩條記錄已被從RIP路由表中刪除了,說明R2及其它4臺路由器已無法學習到R5的RIP路由更新了,同時R5已不存在其它RIP的路由信息了,只有默認的直連路由信息,同樣也說明就算走Se0/1而R4也無法更新到路由信息。

R2#show ip route rip

10.0.0.0/16 is subnetted, 4 subnets

R               10.2.0.0 [120/1] via 192.168.10.2, 00:00:17, Serial1/1

R                10.5.0.0 [120/1] via 192.168.20.2, 00:00:06, Serial1/0

R               10.11.0.0 [120/1] via 192.168.50.2, 00:00:12, Serial1/3

192.168.30.0/30 is subnetted, 1 subnets

R               192.168.30.0 [120/1] via 192.168.50.2, 00:00:12, Serial1/3

192.168.60.0/30 is subnetted, 1 subnets

R               192.168.60.0 [120/1] via 192.168.10.2, 00:00:17, Serial1/1

[120/1] via 192.168.20.2, 00:00:06, Serial1/0

R2#

如下為R5的240秒之后的路由表信息。

R5#show ip route

Codes: C - connected, S - static, I - IGRP, 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, E - EGP

i - IS-IS, 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/16 is subnetted, 1 subnets

C               10.12.0.0 is directly connected, Loopback0

192.168.30.0/30 is subnetted, 1 subnets

C               192.168.30.0 is directly connected, Serial0/1

192.168.40.0/30 is subnetted, 1 subnets

C               192.168.40.0 is directly connected, Serial0/0

3、水平分割

首先水平分割是為了減少環(huán)路和加快路由匯聚,在實際操作中是為了讓路由器減少發(fā)送路由表及環(huán)路,從而降低路由器負載的一種技術(shù)。下面我們來分析實驗(默認情況下所有路由器已配置完成并已開啟RIP v1協(xié)議):

實驗設(shè)計與排錯之二RIPI、II的區(qū)別

    由于水平分割默認是開啟的,它的原則是從某個端口接收到的信息不再允許從這個端口發(fā)出。因此下面例子我們看到,R1在通過本地端口Se0/0/1收到R2的路由更新后,會從R2的Se0/0/0端口以廣播的形式發(fā)出。另外把本地網(wǎng)絡(luò)是通過R2的Se0/0/1發(fā)出的來減少環(huán)路。這就是一個完整的水平分割的過程。

R1#debug ip rip

RIP protocol debugging is on

R1#RIP: received v1 update from 192.168.10.2 on Serial0/0/1

192.168.20.0 in 1 hops

192.168.30.0 in 2 hops

RIP: sending v1 update to 255.255.255.255 via Serial0/0/0 (192.168.10.2)

RIP: build update entries

network 192.168.20.0 metric 1

network 192.168.30.0 metric 2

RIP: sending v1 update to 255.255.255.255 via Serial0/0/1 (192.168.20.2)

RIP: build update entries

network 192.168.10.0 metric 1

R1取消水平分割后,會從本地端口直接發(fā)送整個路由表,這樣重復發(fā)送會引起環(huán)路,以及降低路由器負載并會對鏈路也是不小的壓力。

R1(config)#interface serial0/0/1

R1(config-if)#no ip split-horizon

R1(config-if)#end

R1#

%SYS-5-CONFIG_I: Configured from console by console

RIP: sending v1 update to 255.255.255.255 via Serial0/0/1 (192.168.10.1)

RIP: build update entries

network 192.168.10.0 metric 1

network 192.168.20.0 metric 2

network 192.168.30.0 metric 3

RIP: received v1 update from 192.168.10.2 on Serial0/0/1

192.168.20.0 in 1 hops

192.168.30.0 in 2 hops

    4、毒性逆轉(zhuǎn)

即我們常說的毒化路由,其意思是指當接收到一個“metric 16”路由信息時,將其設(shè)為“possibly down”,同時再發(fā)送一份廣播出去,若再沒有相關(guān)的路由更新后,會立刻將其清除已加速路由的收斂。(如例2.4.3.3水平分割拓撲RIP v1實例,分析如下)。

首先我們將R3的Se0/0/0端口shutdown掉,打開debug ip rip會出現(xiàn)發(fā)送毒化路由的信息。

R3(config)#int s0/0/0

R3(config-if)#shutdown

 

R3(config-if)#

%LINK-5-CHANGED: Interface Serial0/0/0, changed state to administratively down

 

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed state to down

end

R3#

%SYS-5-CONFIG_I: Configured from console by console

 

R3#debug ip rip

RIP protocol debugging is on

R3#RIP: sending v1 update to 255.255.255.255 via Serial0/0/1 (192.168.30.1)

RIP: build update entries

network 192.168.10.0 metric 16

再來看看R2的RIP廣播及R1的路由表信息。

R2#debug ip rip

RIP protocol debugging is on

R2#RIP: sending v1 update to 255.255.255.255 via Serial0/0/0 (192.168.10.2)

RIP: build update entries

network 192.168.30.0 metric 16

---------------------------------

R1#show ip route

Codes: L - local, 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, E - EGP

i - IS-IS, 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, 2 subnets, 2 masks

C                10.2.0.0/16 is directly connected, Loopback0

L               10.2.0.2/32 is directly connected, Loopback0

192.168.10.0/24 is variably subnetted, 2 subnets, 2 masks

C               192.168.10.0/30 is directly connected, Serial0/0/1

L               192.168.10.1/32 is directly connected, Serial0/0/1

R     192.168.20.0/24 is possibly down, routing via 192.168.10.2, Serial0/0/1

R     192.168.30.0/24 is possibly down, routing via 192.168.10.2, Serial0/0/1

R2已將收到的毒化路由轉(zhuǎn)發(fā)廣播到R1上,而R1同樣會把廣播再發(fā)出去的同時設(shè)置為“Passibly down”并會再下一次接收沒有更新時消除,這就是毒化逆轉(zhuǎn)的過程及路由器行為。

 

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI