Distance-Vector 距離矢量是依照傳聞方式進行
rip協議是一個典型的距離矢量路由協議 後面須要學習的BGP協議是一個加強DV協議
R1是依靠R2來學習路由條目的 R2這邊說什麼 R1就會接收什麼 這種不怎麼可靠算法
RIP是一種比較簡單的內部網關協議(IGP協議) RIP基於距離矢量的貝爾曼-福特算法(Bellman-Ford)來計算到達目的網絡的最佳路徑 最初的RIP協議開發時間較早,因此在帶寬、配置和管理方面要求也較低,所以,RIP主要用做教學網絡
一共有三個版本
version 1 不支持VLSM和CIDR 用廣播傳遞rip消息 不支持認證
version 2 支持認證 支持VLSM和CIDR 傳送報文的時候攜帶掩碼 用224.0.0.9傳遞rip消息
version 1 2 默認狀況就是這個版本
建議你們修改成version 2版本ide
RIP使用跳數做爲度量值來衡量到達目的網絡的距離。缺省狀況下,直連網絡的路由跳數爲0。當路由器發送路由更新時,會把度量值加1。RIP規定超過15跳爲網絡不可達。
這個計算的開銷的方式 不合理 極可能會繞過告訴鏈路而走低速鏈路學習
RIP定時器能夠按期的對一些路由進行更新等等測試
[R1]rip 1
注意:在系統模式敲 1是一個進程號 本地有意義this
好比:你的接口IP地址爲以下:加密
10.1.1.1/24 =》 network 10.0.0.0 172.16.1.1/24 =》 network 172.16.0.0 192.168.1.1/24 =》 network 192.168.1.0 172.16.1.1/15 =》 network 172.16.0.0 100.100.100.100/25 =》 network 100.0.0.0
這邊只能宣告A B C網段 也就是/8 /16 /24的網絡地址 宣告網段的意思3d
[R1-rip-1]network 192.168.12.0 必須宣告 [R1-rip-1]network 1.0.0.0 非必須宣告
注意:R1的192.168.12.0網段必定得宣告出去 由於192.168.12.0網段是鏈接R2的一個橋樑 R1這邊若是想要從R2接收到路由的時候 必須R1這邊要宣告192.168.12.0網段 至於R1的1.0.0.0網段 他的宣告不是必須的 只是爲了可以全網當中的rip設備可以學習這條1.0網段code
同理:咱們在R2設備上宣告本身的192.168.12.0網段blog
# rip 1 network 192.168.12.0 必須宣告 network 192.168.23.0 必須宣告 network 2.0.0.0 非必須宣告 #
在R2上查看路由表
<R2>display ip routing-table protocol rip Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Public routing table : RIP Destinations : 1 Routes : 1
RIP routing table status : <Active>
Destinations : 1 Routes : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 RIP 100 1 D 192.168.12.1 GigabitEthernet
0/0/0
RIP routing table status : <Inactive>
Destinations : 0 Routes : 0
<R2>
查看R2的路由表 發現已經動態學習到了1.1.1.1路由條目 是經過rip協議學習到 而且下一跳是192.168.12.1 代表是R1將1.0.0.0網段條目發送給我 在R1上查看路由表
Public routing table : RIP
Destinations : 2 Routes : 2
RIP routing table status : <Active>
Destinations : 2 Routes : 2
Destination/Mask Proto Pre Cost Flags NextHop Interface
2.2.2.2/32 RIP 100 1 D 192.168.12.2 GigabitEthernet
0/0/0
23.1.1.0/24 RIP 100 1 D 192.168.12.2 GigabitEthernet
0/0/0
RIP routing table status : <Inactive>
Destinations : 0 Routes : 0
若是把R2裏面的2.0.0.0宣告的網段刪除掉
[R2-rip-1]undo network 2.0.0.0
在看一下R1的路由表
Public routing table : RIP
Destinations : 1 Routes : 1
RIP routing table status : <Active>
Destinations : 1 Routes : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
23.1.1.0/24 RIP 100 1 D 192.168.12.2 GigabitEthernet
0/0/0
RIP routing table status : <Inactive>
Destinations : 0 Routes : 0
小結: RIP的network宣告分爲兩種 第一種:必須的宣告 指的就是兩個鄰居設備之間的network 第二種:可選的宣告,爲的就是讓對方學習到這條路由條目 ## 第四步:在R3網絡設備上宣告本身的網段
#
rip 1
network 192.168.23.0
network 3.0.0.0
#
查看R3的路由表
Public routing table : RIP
Destinations : 3 Routes : 3
RIP routing table status : <Active>
Destinations : 3 Routes : 3
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 RIP 100 2 D 192.168.23.2 GigabitEthernet
0/0/1
2.2.2.2/32 RIP 100 1 D 192.168.23.2 GigabitEthernet
0/0/1
192.168.12.0/24 RIP 100 1 D 192.168.23.2 GigabitEthernet
0/0/1
RIP routing table status : <Inactive>
Destinations : 0 Routes : 0
[R3]
發現R3這邊已經經過RIP協議學習到1.0網段和12網段的兩條rip路由 根據咱們路由表的詳細信息能夠看到 R3這邊到達R1和R2的路由條目的下一跳是192.168.23.2 代表是R2這邊把咱們1.0網段和12網段通告給咱們R3 ## 第五步:測試以下
<R1>ping -a 1.1.1.1 2.2.2.2
PING 2.2.2.2: 56 data bytes, press CTRL_C to break
Reply from 2.2.2.2: bytes=56 Sequence=1 ttl=255 time=60 ms
Reply from 2.2.2.2: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 2.2.2.2: bytes=56 Sequence=3 ttl=255 time=10 ms
Reply from 2.2.2.2: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 2.2.2.2: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 2.2.2.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/28/60 ms
<R1>ping -a 1.1.1.1 3.3.3.3
PING 3.3.3.3: 56 data bytes, press CTRL_C to break
Reply from 3.3.3.3: bytes=56 Sequence=1 ttl=254 time=30 ms
Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=254 time=20 ms
Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=254 time=30 ms
Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=254 time=40 ms
--- 3.3.3.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/30/40 ms
# RIP防環機制 ## 水平分割 從一個接口收到的路由 不會從該接口發出去 默認開啓  ## 毒性反轉 從一個接口收到的路由 會從該接口發出去 而且發送的時候 rip的跳數直接設置16跳 默認不開啓 注意:若是同時開啓水平分割和毒性反轉的話 優先毒性反轉生效  ## 觸發更新 比較靠譜的 觸發更新是指當路由信息發生變化時,當即向鄰居設備發送觸發更新報文 他是能夠加快收斂的  # rip的認證 不驗證(默認狀況下) 明文驗證(simple) 密文驗證(md5) ## 區分PLAIN和CIPHER
[R1-GigabitEthernet0/0/0]rip authentication-mode simple plain Huawei@123
[R1-GigabitEthernet0/0/0]dis this
#
interface GigabitEthernet0/0/0
ip address 192.168.12.1 255.255.255.0
rip authentication-mode simple plain Huawei@123
#
return
[R1-GigabitEthernet0/0/0]rip authentication-mode simple cipher Huawei@123
[R1-GigabitEthernet0/0/0]dis this
[V200R003C00]
#
interface GigabitEthernet0/0/0
ip address 192.168.12.1 255.255.255.0
rip authentication-mode simple cipher %$%$z3tG=6sr\Y^>3I=Pl-`"OzGI%$%$
小結: plain---對回顯的密碼不進行加密 cipher---對回顯的密碼進行加密 因此:plain和cipher的區別就是對查看(display this)進行簡單的加密 ## MD5的驗證
[R2-GigabitEthernet0/0/1]dis this
[V200R003C00]
#
interface GigabitEthernet0/0/1
ip address 192.168.23.2 255.255.255.0
rip authentication-mode md5 usual plain Huawei@123
#
return
[R2-GigabitEthernet0/0/1]
[R3-GigabitEthernet0/0/1]dis this
[V200R003C00]
#
interface GigabitEthernet0/0/1
ip address 192.168.23.3 255.255.255.0
rip authentication-mode md5 usual cipher %$%$YyQL~7ICK3bavE"ujS+8O$4z%$%$
#
return
總結:要麼兩端都不配置驗證 要麼兩端配置都是simple驗證 要麼兩端配置都是md5驗證 驗證的密碼必定要同樣