您好,登錄后才能下訂單哦!
動態路由協議有靈活等很多優點,但是缺點也有,比如占用了額外的帶寬,CPU負荷高。
管理距離(Administrative Distances):0到255之間的1個數,它表示一條路由選擇信息源的可信性值。該值越小,可信性級別越高。0為最信任,255為最不信任。即沒有從這條線路將沒有任何流量通過。
假如1臺路由器收到遠端的2條路由更新,路由器將檢查管理距離,管理距離值低的將被選為新路線存放于路由表中;若它們擁有相同的管理距離,將比較它們的度(Metric)。度低的將作為新線路;若它們的管理距離和度都一樣,那么將在2條線路做均衡負載。
一些常用路由協議默認的管理距離:
l 直接相連:0
l 靜態路由:1
l EIGRP:90
l IGRP:100
l OSPF:110
l RIP:120
注意:如果你在1條線路上配置了靜態路由,又配置了RIP,默認情況下,路由器只會使用靜態路由,因為靜態路由的管理距離為1小于RIP的管理距離。
三種路由協議:
距離向量(Distance Vector)
鏈路狀態(Link State)
混合型(Hybrid)
距離向量:用于根據距離(Distance)來判斷最佳路徑,當1個數據包每經過1個路由器時,被稱之為經過1跳,經過跳數最少的則作為最佳路徑,這類協議的有RIP和IGRP。
鏈路狀態:也叫最短路徑優先(Shortest-Path-First)協議。每個路由器創建3張單獨的表,1張用來跟蹤與它直接相連的相鄰路由器,1張用來決定網絡的整個拓撲結構,另外1張作為路由表,所以這種協議對網絡的了解程度要比距離向量高,這類協議有OSPF。
混合型:綜合了前2者的特征,這類協議的有EIGRP。
RIPv1
使用廣播的方式發送路由更新;
路由更新信息中不攜帶子網掩碼,為有類路由協議;
RIP報文大小限制是512字節,最多可以攜帶25條路由信息;
RIPv2
路由信息中加入了子網掩碼,無類的路由協議;
RIPv2發送更新報文的方式為組播,組播地址為224.0.0.9;
支持認證;
特性 | RIPv1 | RIPv2 |
采用跳數為度量值 | 是 | 是 |
15是最大的有效度量值,16為無窮大 | 是 | 是 |
默認30s更新周期 | 是 | 是 |
周期性更新時發送全部路由信息 | 是 | 是 |
拓撲改變時發送只針對變化的觸發更新 | 是 | 是 |
使用路由毒化、水平分割、毒性逆轉 | 是 | 是 |
使用抑制計時器 | 是 | 是 |
發送更新的方式 | 廣播 | 組播 |
使用UDP 520端口發送報文 | 是 | 是 |
更新中攜帶子網掩碼,支持VLSM | 否 | 是 |
支持認證 | 否 | 是 |
如下拓撲環境,默認所有路由器都做了RIP v2的普通配置,并且全網通過RIP協議進行網絡互聯。
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秒發送更新一次路由表,而下一次更新是在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
路由的網絡號包括:(參考以上,此處為略)
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協議后的路由表,而show ip route是顯示當前路由器整個路由表信息。其中我們看到某個網絡是通過哪個接口,以多長時間學到的,我們能夠發現其時間都沒有超過30秒。
(2)、設置R5不讓R1、R2、R3、R4學到
首先我們需要知道如何才能不讓其它4臺路由器來學習R5的路由信息,這里我們可以使用RIP v1和RIP v2版本的功能特性來實現,實驗如下:
我們先將R5的RIP版本設置為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、水平分割
首先水平分割是為了減少環路和加快路由匯聚,在實際操作中是為了讓路由器減少發送路由表及環路,從而降低路由器負載的一種技術。下面我們來分析實驗(默認情況下所有路由器已配置完成并已開啟RIP v1協議):
由于水平分割默認是開啟的,它的原則是從某個端口接收到的信息不再允許從這個端口發出。因此下面例子我們看到,R1在通過本地端口Se0/0/1收到R2的路由更新后,會從R2的Se0/0/0端口以廣播的形式發出。另外把本地網絡是通過R2的Se0/0/1發出的來減少環路。這就是一個完整的水平分割的過程。
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取消水平分割后,會從本地端口直接發送整個路由表,這樣重復發送會引起環路,以及降低路由器負載并會對鏈路也是不小的壓力。
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、毒性逆轉
即我們常說的毒化路由,其意思是指當接收到一個“metric 16”路由信息時,將其設為“possibly down”,同時再發送一份廣播出去,若再沒有相關的路由更新后,會立刻將其清除已加速路由的收斂。(如例2.4.3.3水平分割拓撲RIP v1實例,分析如下)。
首先我們將R3的Se0/0/0端口shutdown掉,打開debug ip rip會出現發送毒化路由的信息。
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已將收到的毒化路由轉發廣播到R1上,而R1同樣會把廣播再發出去的同時設置為“Passibly down”并會再下一次接收沒有更新時消除,這就是毒化逆轉的過程及路由器行為。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。