H3C路由器配置——動態路由RIP協議


一、靜態路由的不足

靜態路由適用於:小規模的網絡、架構不怎么調整的網絡、沒有環路的網絡

 

二、RIP協議工作過程

2.1、工作特點

  n路由信息協議RIPRouting Information Protocol)是一個真正的距離矢量路由選擇協議

  n它每隔30秒就送出自己完整的路由表到所有激活的接口。

  nRIP協議選擇最佳路徑的標准就是跳數,認為到達目標網絡經過的路由器最少的路徑就是最佳路徑。

  n默認它所允許的最大跳數為15跳,也就是說16跳的距離將被認為是不可達的。

  n在小型網絡中,RIP會運轉良好,但是對於使用慢速WAN連接的大型網絡或者安裝有大量路由器的網絡來說,它的效率就很低了。

  補充:垃圾收集計算器失效的路由,120秒后,自動從路由表測地刪除

 

 

2.2、工作過程

 

 說明:目標網絡是192.168.10.0/24網段

(1)、在A、B、C、D、E路由器上配置RIP協議,接下來我們從A路由器角度來看

(2)、由於192.168.10.0/24 網段就處在A路由器上,所以會生成一條路由條目如圖所示,距離是0,接口是E0

(3)、A路由器每隔30秒就送出自己路由器里面的全部路由到B(使用廣播)、E路由器

  當B路由器B接收到A路由器發送來時,在B路由器就會把距離改為1,下一跳為2.0.0.1,;同理對於C路由器來說,接收到B路由器發送過來時,路由器距離變為2,下一跳路由3.0.0.1

  當E路由器B接收到A路由器發送來時,在B路由器就會把距離改為1,下一跳為4.0.0.1,;同理對於D路由器來說,接收到E路由器發送過來時,路由器距離變為2,下一跳路由5.0.0.1;同理對於C路由器來說,接收到D路由器發送過來時,路由器距離變為3,下一跳路由6.0.0.1

(4)、由於從A-B-C線路過來的路由條目距離是2,從A-E-D-C線路過來的條目距離是3,2<3,所以會忽略距離是3的路由保留距離是2的路由條目

(5)、當AB路由器之間出現故障的導致B路由器在30秒之內收不到A路由器發送過來的路由條目,B路由器里面原來的路由條目(192.168.10.0 ;距離為2;下一跳是2.0.0.1) 就直接變為192.168.10.0,矢量距離變為最大距離16,下一跳是2.0.0.1

  對於C路由器來說,通過RIP協議直接接收B路由器發送過來的路由條目,導致C路由條目改變為192.168.10.0 ,矢量距離16,下一跳是3.0.0.1

(6)、對於A-E-D-C路由線路沒有受到影響,所以C收到的路由條目不變(目標網絡192.168.10.0,矢量距離3,下一跳6.0.0.1)

(7)

  從A-B-C線路過來,C路由條目是192.168.10.0,矢量距離是16,下一跳是3.0.0.1

  從A-E-D-C線路過來,C路由條目是192.168.10.0,矢量距離是3,下一跳是6.0.0.1

  矢量距離是16的自動刪除,矢量距離是3的保存了下來

(8)、同理,如果A-B-C線路恢復的化,A-B-C線路又恢復初始狀態

三、RIP協議配置和設置

 

配置RIP協議:

 

說明  命令
啟用RIP協議、確定進程號  [H3C]rip 進程號
使用network命令通告各網段 
[H3C-rip-1]network 網段
顯示RIP協議配置情況 [H3C-rip-1]display this
查看RIP協議學到的路由  [H3C]display ip routing-table protocol rip
顯示RIP協議數據庫 (顯示動態路由協議到各網段的信息) [H3C]display rip 1 database

 

詳細說明:

啟用RIP協議、確定進程號 

  [H3C]rip 進程號

說明:設置RIP協議運行的進程號<每一個設備的進程號可以相同>

 

使用network命令通告各網段 
  [H3C-rip-1]network 網段

# 說明1

  1、該網段的子網掩碼是根據該網段的IP地址分類來默認的,所以不用寫子網掩碼

  2、假如本來有兩個網段(172.16.0.0 和172.16.5.0兩個網段,但是該兩個網段是同一類IP地址,所以其子網掩碼是一樣的,只寫一個網段就OK)

# 說明2:
1、就要看接口屬於哪個網絡,多個接口屬於同一個網段(按A、B、C分類),只需寫一個
2、Network 用來配置路由器哪些接口參與到RIP協議
  接口能夠發送和接收RIP數據包
  該接口所在的網段會被RIP協議通告出去


顯示RIP協議配置情況
  [H3C-rip-1]display this

# 示列:
rip 1
network 172.16.0.0
network 192.168.0.0
#
return

查看RIP協議學到的路由
  [R1]display ip routing-table protocol rip
<Active> : 活躍,代表正在使用的
<Inactive>:不活躍,代表沒有用的,沒有放到路由表里面去的


顯示RIP協議數據庫(顯示動態路由協議到各網段的信息)
  [H3C]display rip 1 database
  172.16.0.0/16, auto-summary
  172.16.0.0/24, cost 0, nexthop 172.16.0.1, RIP-interface
  172.16.1.0/24, cost 1, nexthop 172.16.0.2
  172.16.2.0/24, cost 2, nexthop 172.16.0.2
  172.16.3.0/24, cost 2, nexthop 172.16.0.2
  172.16.3.0/24, cost 2, nexthop 172.16.5.2
  172.16.4.0/24, cost 1, nexthop 172.16.5.2
  172.16.5.0/24, cost 0, nexthop 172.16.5.1, RIP-interface
  192.168.0.0/24, auto-summary
  192.168.0.0/24, cost 0, nexthop 192.168.0.1, RIP-interface

查看運行的RIP協議

 

說明               命令
顯示RIP協議學到的路由

<H3C>display ip routing-table protocol rip

<AH3C>display rip 1 route

顯示RIP 1的配置 <H3C>display rip 1
顯示運行RIP協議的接口 <H3C>display rip 1 interface

 

 

 

 查看/監控RIP協議活動情況

說明 命令

顯示RIP協議活動狀態

<R1>terminal monitor 
<R1>terminal debugging
顯示所有接口發送和接收的RIP包 <R1>debugging rip 1 packet
只顯示G0/0/0接口發送和接收的RIP包 <R1>debugging rip 1 packet GigabitEthernet 0/0/0
關閉所有診斷輸出 <R1>undo debugging all

 

四、RIP協議中network的作用(怎么寫network)

寫network方法說明:

  1、就要看接口屬於哪個網絡,多個接口屬於同一個網段(按A、B、C分類),只需寫一個。
  2、Network 用來配置路由器哪些接口參與到RIP協議
    接口能夠發送和接收RIP數據包
    該接口所在的網段會被RIP協議通告出去

示列1:

上圖示列:network應該怎么寫

方法一:全寫(每個網段都寫)

  [RA] network 172.16.10.0

  [RA] network 172.16.20.0

  [RA] network 172.17.10.0

方法二:由於與路由器相連的三個網絡中,有兩個網段都是屬於同一類網絡(B類網絡),可以寫為一條network

  [RA] network 172.17.0.0

  [RA] network 172.16.0.0 

 

示列2:

 

上圖示列:network應該怎么寫

方法一:全寫(每個網段都寫)

  [RA] network 172.16.10.0

  [RA] network 172.16.20.0

  [RA] network 192.168.10.0

方法二:由於與路由器相連的三個網絡中,有兩個網段都是屬於同一類網絡(B類網絡),可以寫為一條network

  [RA] network 172.16.0.0

  [RA] network 192.168.10.0

五、配置路由器接口不發送RIP路由更新(可以優化網絡)

1、配置場景

(1)、對於路由器一端只是接了交換機的一端,在默認配置RIP協議的時候也會把這個接口配置進去,這這樣的做法是不對的,那么怎么一個怎么操作才能使用這個單一的接口不發送路由更新(這個設備的其他接口正常發送路由更新)

(2)、對於兩個公司連接的兩台路由器我們不希望把自己公司的rip路由協議通過給別的公司,可以在連接的該台設備上的對外的接口設置為不發送rip路由協議(公司的網關設置也是一樣)

2、配置思路和命令

方法一:在rip 1 進程上面進行關閉該接口的rip協議

[R1]rip 1
[R1-rip-1]silent-interface GigabitEthernet 0/0   [想要開啟的話,在前面直接加一個no就好了]

方法二:進入該接口,在接口上設置關閉rip發送功能

[R1]interface GigabitEthernet 0/0
[R1-GigabitEthernet0/0]rip
[R1-GigabitEthernet0/0]no rip output  [不知道命令的話,可以使用rip ?查看幫助手冊]

說明:在配置的時候最好打開監控功能

3、配置案例

參考本章最后面案例1

六、RIPv2支持變長子網和身份驗證

1、RIPv1和RIPv2的優缺點比較

分類 說明 等長子網 變長子網
RIPv1  

1、通過廣播255.255.255.255 FF-FF-FF-FF-FF-FF 影響到電腦性能
2、通告路由信息(不帶子網掩碼)、支持等長子網、不支持變長子網
3、RIPv1沒有認證的功能。

推薦使用

不推薦使用

(使用RIPv1版本學到的路由的錯誤的)

RIPv2

(推薦)

1、通過多播224.0.0.9 多播MAC地址 不影響電腦的性能
2、通告路由信息 帶子網掩碼信息 支持變長和等長子網
3、RIPv2可以支持認證,並且有明文和MD5兩種認證
4、支持手動路由匯總

不推薦使用

(使用RIPv2版本學到的路由的錯誤的)

推薦使用

2、RIPv1和RIPv2版本查看/切換命令

版本查看命令:

 

方法一:進入進程查看
[R2]rip 1
[R2-rip-1]display this # rip 1 version 2 network 192.168.10.0 # return [R2-rip-1]

方法二:通過監控調試命令行查看
<R2>terminal monitor 
The current terminal is enabled to display logs.
<R2>terminal debugging 
The current terminal is enabled to display debugging logs.
<R2>debugging rip 1 packet interface GigabitEthernet 0/0
<R2>*Jun 19 12:02:24:160 2019 R2 RIP/7/RIPDEBUG: RIP 1 : Sending response on interface GigabitEthernet0/0 from 192.168.10.2 to 224.0.0.9
*Jun 19 12:02:24:160 2019 R2 RIP/7/RIPDEBUG: Packet: version 2, cmd response, length 64
*Jun 19 12:02:24:160 2019 R2 RIP/7/RIPDEBUG: AFI 2, destination 192.168.10.4/255.255.255.252, nexthop 0.0.0.0, cost 1, tag 0
*Jun 19 12:02:24:160 2019 R2 RIP/7/RIPDEBUG: AFI 2, destination 192.168.10.32/255.255.255.224, nexthop 0.0.0.0, cost 2, tag 0
<R2>no no terminal all     # 關閉接口調試

版本切換命令:version

[R2]rip 1
[R2-rip-1]display this 
#
rip 1
 version 2
 network 192.168.10.0
#
return
[R2-rip-1]version 1    <假如當前版本是2版本,我們需要切換成1版本>

 

3、RIPv2功能介紹案例(不連續子網)

步驟1:IP地址配置

PC7:
    192.168.10.130
    255.255.255.128
    192.168.10.129
PC8
    192.168.10.66
    255.255.255.192
    192.168.10.65
PC9
    192.168.10.34
    255.255.255.224
    192.168.10.33
R1:
    [R1]hostname R1
    [R1]interface GigabitEthernet 0/1
    [R1-GigabitEthernet0/1]ip address 192.168.10.129 25 
    [R1]interface GigabitEthernet 0/0
    [R1-GigabitEthernet0/0]ip address 192.168.10.1 30
    [R1]ping 192.168.10.130
    [R1]ping 192.168.10.2
R2
    [H3C]hostname R2
    [R2]interface GigabitEthernet 0/2
    [R2-GigabitEthernet0/2]ip address 192.168.10.65 26
    [R2]interface GigabitEthernet 0/1
    [R2-GigabitEthernet0/1]ip address 192.168.10.5 30 
    [R2]interface GigabitEthernet 0/0
    [R2-GigabitEthernet0/0]ip address 192.168.10.2 30
    [R2]ping 192.168.10.1
    [R2]ping 192.168.10.6
    [R2]ping 192.168.10.66
R3
    [H3C]hostname R3
    [R3]interface GigabitEthernet 0/0
    [R3-GigabitEthernet0/0]ip address 192.168.10.6 30
    [R3-GigabitEthernet0/0]quit 
    [R3]interface GigabitEthernet 0/1
    [R3-GigabitEthernet0/1]ip address 192.168.10.33 27
    [R3-GigabitEthernet0/1]ping 192.168.10.33
    [R3-GigabitEthernet0/1]ping 192.168.10.5
View Code

步驟2:配置RIP協議

R1:
    [R1]rip 1
    [R1-rip-1]network 192.168.10.0
R2:
    [R2]rip 1
    [R2-rip-1]network 192.168.10.0
R3:
    [R3]rip 1
    [R3-rip-1]network 192.168.10.0
View Code

步驟3:查看路由表(以R2為示列),是否學到了到各網段的路由

    [R2-rip-1]display ip routing-table protocol rip 

    Summary count : 3

    RIP Routing table status : <Active>   # 這里為空,說明未學到路由
    Summary count : 0

    RIP Routing table status : <Inactive>
    Summary count : 3

    Destination/Mask   Proto   Pre Cost        NextHop         Interface
    192.168.10.0/30    RIP     100 0           0.0.0.0         GE0/0
    192.168.10.4/30    RIP     100 0           0.0.0.0         GE0/1
    192.168.10.64/26   RIP     100 0           0.0.0.0         GE0/2

總結:總結:由於路由器默認的RIP協議是1版本的RIPv1協議,因為RIPv1協議不支持變長子

步驟4:修改RIP協議版本(修改的時候,記得全部路由器都需要修改)

 R1:      
    [R1]rip 1
    [R1-rip-1]network 192.168.10.0
R2:    
    [R2]rip 1
    [R2-rip-1]network 192.168.10.0
R3:
    [R3]rip 1
    [R3-rip-1]network 192.168.10.0    

步驟5:再次查看路由表

[R2]display ip routing-table protocol rip 
[R2]display ip routing-table protocol rip 

    Summary count : 5

    RIP Routing table status : <Active>
    Summary count : 2

    Destination/Mask   Proto   Pre Cost        NextHop         Interface
    192.168.10.32/27   RIP     100 1           192.168.10.6    GE0/1 
    192.168.10.128/25  RIP     100 1           192.168.10.1    GE0/0   #已經學到了兩個網段的路由條目了

    RIP Routing table status : <Inactive>
    Summary count : 3

    Destination/Mask   Proto   Pre Cost        NextHop         Interface
    192.168.10.0/30    RIP     100 0           0.0.0.0         GE0/0
    192.168.10.4/30    RIP     100 0           0.0.0.0         GE0/1
    192.168.10.64/26   RIP     100 0           0.0.0.0         GE0/2

步驟6:進行ping測試,

  [R2]ping 192.168.10.34
  [R2]ping 192.168.10.34
  說明:如果能夠正常ping通,代表鏈路正常

步驟7:RIPv2支持身份驗證功能測試

身份證驗證功能說明:身份驗證功能是針對路由器和路由器相連的兩個接口的身份驗證,如果設置了密碼連接的兩個接口且驗證的密碼必須要相同

驗證功能配置命令:

 

需要R1的0/0接口和R2的0/0接口密碼相同,R2的0/1和R3的0/0密碼相同
R1:
  [R1]interface GigabitEthernet 0/0
  [R1-GigabitEthernet0/0]rip authentication-mode simple plain 1234
R2:
  [R2]interface GigabitEthernet 0/0
  [R2-GigabitEthernet0/0]rip authentication-mode simple plain 1234
  [R2]interface GigabitEthernet 0/1
  [R2-GigabitEthernet0/1]rip authentication-mode simple plain abcd
R3
  [R3]interface GigabitEthernet 0/0

 

七、RIP協議的自動匯總

1、連續子網和不連續子網區別

 連續子網:由同一主網划分的多個子網連續,沒有被其它多個網絡隔開。

 不連續子網:指在一個網絡中,某幾個連續由同一主網划分的子網中間被1個或多個其它網段的子網或網絡隔開了,對於不連續子網來說,RIP協議會在類的邊界進行路由的自動匯總

 

2、關閉RIP協議的自動匯總功能(僅支持不連續子網)

 

3、RIP協議的手動匯總

八、配置RIP協議發布默認路由

 

九、RIP協議定時器和防止環路的方法

十、動態路由協議的不足

1)、協議中規定,一條有效的路由信息的度量(metric)不能超過15,這就使得該協議不能應用於很大型的網絡,應該說正是由於設計者考慮到該協議只適合於小型網絡所以才進行了這一限制。對於metric為16的目標網絡來說,即認為其不可到達。
2)、該路由協議應用到實際中時,很容易出現“計數到無窮大”的現象,這使得路由收斂很慢,在網絡拓撲結構變化以后需要很長時間路由信息才能穩定下來。
3)、該協議以跳數,即報文經過的路由器個數為衡量標准,並以此來選擇路由,這一措施欠合理性,因為沒有考慮網絡延時、可靠性、線路負荷等因素對傳輸質量和速度的影響。

 

案例1

 

步驟1:配置各項IP地址

R1:
    [H3C]interface GigabitEthernet 0/0
    [H3C-GigabitEthernet0/0]ip address 192.168.0.1 24
    [H3C-GigabitEthernet0/0]no shutdown 
    [H3C-GigabitEthernet0/0]quit 

    [H3C]interface GigabitEthernet 0/1
    [H3C-GigabitEthernet0/1]ip address 172.16.0.1 24
    [H3C-GigabitEthernet0/1]no shutdown 
    [H3C-GigabitEthernet0/1]quit 

    [H3C]interface GigabitEthernet 0/2
    [H3C-GigabitEthernet0/2]ip address 172.16.5.1 24
    [H3C-GigabitEthernet0/2]no shutdown 
    [H3C-GigabitEthernet0/2]quit 
    [H3C]hostname R1
    
R2:
    [H3C]hostname R2
    [R2]interface GigabitEthernet 0/0
    [R2-GigabitEthernet0/0]ip address 172.16.0.2 24
    [R2-GigabitEthernet0/0]no shutdown 
    [R2-GigabitEthernet0/0]quit 

    [R2]interface GigabitEthernet 0/1
    [R2-GigabitEthernet0/1]ip address 172.16.1.1 24
    [R2-GigabitEthernet0/1]no shutdown 
    [R2-GigabitEthernet0/1]quit 
    
    [R2]ping 172.16.0.1   <測試R1和R2的連通性,如果能ping通的話,說明配置正常>



R3:

    [H3C]hostname R3
    [R3]interface GigabitEthernet 0/0
    [R3-GigabitEthernet0/0]ip address 172.16.1.2 24
    [R3-GigabitEthernet0/0]no shutdown 
    [R3-GigabitEthernet0/0]quit 

    [R3]interface GigabitEthernet 0/1
    [R3-GigabitEthernet0/1]ip address 172.16.2.1 24
    [R3-GigabitEthernet0/1]no shutdown 
    [R3-GigabitEthernet0/1]quit 

    [R3]interface GigabitEthernet 0/2
    [R3-GigabitEthernet0/2]ip address 172.16.3.2 24
    [R3-GigabitEthernet0/2]no shutdown 
    [R3-GigabitEthernet0/2]quit 

    [R3]ping 172.16.1.1    <測試R2和R3的連通性,如果能ping通的話,說明配置正常>

R4:
    [H3C]hostname R4
    [R4]interface GigabitEthernet 0/0
    [R4-GigabitEthernet0/0]ip address 172.16.5.2 24
    [R4-GigabitEthernet0/0]no shutdown 
    [R4-GigabitEthernet0/0]ping 172.16.5.1   <測試R1和R4的連通性,如果能ping通的話,說明配置正常>
    [R4-GigabitEthernet0/0]quit 

    [R4]interface GigabitEthernet 0/1
    [R4-GigabitEthernet0/1]ip address 172.16.4.1 24
    [R4-GigabitEthernet0/1]no shutdown 
    [R4-GigabitEthernet0/1]quit 

R5

    [H3C]hostname R5
    [R5]interface GigabitEthernet 0/0
    [R5-GigabitEthernet0/0]ip address 172.16.4.2 24
    [R5-GigabitEthernet0/0]no shutdown 
    [R5-GigabitEthernet0/0]quit 

    [R5]interface GigabitEthernet 0/1
    [R5-GigabitEthernet0/1]ip address 172.16.3.1 24
    [R5-GigabitEthernet0/1]no shutdown 
    [R5-GigabitEthernet0/1]quit 
    [R5]ping 172.16.4.1         <測試R4和R5的連通性,如果能ping通的話,說明配置正常>
    [R5]ping 172.16.3.2         <測試R2和R5的連通性,如果能ping通的話,說明配置正常>
    
R6:

    [H3C]hostname R6
    [R6]interface GigabitEthernet 0/0
    [R6-GigabitEthernet0/0]ip address 172.16.2.2 24
    [R6-GigabitEthernet0/0]no shutdown 
    [R6-GigabitEthernet0/0]quit 
    [R6]ping  172.16.2.1    <測試R3和R6的連通性,如果能ping通的話,說明配置正常>

    [R6]interface GigabitEthernet 0/1
    [R6-GigabitEthernet0/1]ip address 192.168.1.1 24
    [R6-GigabitEthernet0/1]no shutdown 
    [R6-GigabitEthernet0/1]quit 
    [R6]ping 192.168.1.2    <測試PC10和R6的連通性,如果能ping通的話,說明配置正常>
    
PC9:
    192.168.0.2
    255.255.255.0
    192.168.0.1

PC10
    192.168.1.2
    255.255.255.0
    192.168.1.1
View Code

步驟2:設置RIP協議

設定思路:

(1):啟用RIP協議、確定進程號    # 設置RIP協議運行的進程號<每一個設備的進程號可以相同>
[H3C]rip 進程號
(2):使用network命令通告各網段   # 說明1:該網段的子網掩碼是根據該網段的IP地址分類來默認的,所以不用寫子網掩碼
[H3C-rip-1]network 網段      # 說明2:假如本來有兩個網段(172.16.0.0 和172.16.5.0兩個網段,但是該兩個網段是同一類IP地址,所以其子網掩碼是一樣的,只寫一個網段就OK)

說明:
1、就要看接口屬於哪個網絡,多個接口屬於同一個網段(按A、B、C分類),只需寫一個
2、Network 用來配置路由器哪些接口參與到RIP協議
接口能夠發送和接收RIP數據包
該接口所在的網段會被RIP協議通告出去


(3):顯示RIP協議配置情況
[H3C-rip-1]display this
#
rip 1
network 172.16.0.0
network 192.168.0.0
#
return

(4):查看RIP協議學到的路由
[R1]display ip routing-table protocol rip 
<Active> : 活躍,代表正在使用的
<Inactive>:不活躍,代表沒有用的,沒有放到路由表里面去的


(5):顯示RIP協議數據庫(顯示動態路由協議到各網段的信息)
[H3C]display rip 1 database

配置命令:

R1路由器設定
  [R1-rip-1]network 192.168.0.0
  [R1-rip-1]network 172.16.0.0
R2路由器設定:
  [R2-rip-1]network 172.16.0.0
R3路由器設定:
  [R3-rip-1]network 172.16.0.0
R4路由器設定:
  [R4-rip-1]network 172.16.0.0
R5路由器設定:
  [R5-rip-1]network 172.16.0.0
R6路由器設定:
  [R6-rip-1]network 172.16.0.0
  [R6-rip-1]network 192.168.1.0
View Code

步驟3:進行測試

(1)配置好了之后,進行PC9 ——ping——> PC10 的測試,如果ping測試連通的話,代表配置沒有問題(上面的配置沒有問題)

(2)我們在R1上執行下面命令,查看動態路由協議到各網段的信息

[R1-rip-1]display rip 1 database

[R1-rip-1]display rip 1 database

  172.16.0.0/16, auto-summary
 172.16.0.0/24, cost 0, nexthop 172.16.0.1, RIP-interface
 172.16.1.0/24, cost 1, nexthop 172.16.0.2
 172.16.2.0/24, cost 2, nexthop 172.16.0.2
 172.16.3.0/24, cost 2, nexthop 172.16.5.2
 172.16.3.0/24, cost 2, nexthop 172.16.0.2
 172.16.4.0/24, cost 1, nexthop 172.16.5.2
 172.16.5.0/24, cost 0, nexthop 172.16.5.1, RIP-interface
 192.168.0.0/24, auto-summary
 192.168.0.0/24, cost 0, nexthop 192.168.0.1, RIP-interface
 192.168.1.0/24, auto-summary
 192.168.1.0/24, cost 3, nexthop 172.16.0.2 <這里是3,代表正常>
[R1-rip-1]ping 192.168.1.2 <能ping通代表正常>

 

(3)把R2的一個接口關閉(這里關閉0/1接口),這里要等待30S才能正常顯示

 [R2]interface GigabitEthernet 0/1
 [R2-GigabitEthernet0/1]shutdown
再次到R1上面,查看動態路由協議到各網段的信息
[R1-rip-1]display rip 1 database
 172.16.0.0/16, auto-summary
 172.16.0.0/24, cost 0, nexthop 172.16.0.1, RIP-interface
 172.16.1.0/24, cost 16, nexthop 172.16.0.2  <這里是16,代表正常。由於我們把R2斷開了,所以從172.16.0.0網段到192.168.1.0鏈路出現問題,即變為16了>
 172.16.2.0/24, cost 16, nexthop 172.16.0.2  <這里是16,代表正常。由於我們把R2斷開了,所以從172.16.0.0網段到192.168.1.0鏈路出現問題,即變為16了>
 172.16.3.0/24, cost 2, nexthop 172.16.5.2
 172.16.4.0/24, cost 1, nexthop 172.16.5.2
 172.16.5.0/24, cost 0, nexthop 172.16.5.1, RIP-interface
 192.168.0.0/24, auto-summary
 192.168.0.0/24, cost 0, nexthop 192.168.0.1, RIP-interface
 192.168.1.0/24, auto-summary
 192.168.1.0/24, cost 16, nexthop 172.16.0.2 <這里是16,代表正常。由於我們把R2斷開了,所以從172.16.0.0網段到192.168.1.0鏈路出現問題,即變為16了>

[R1-rip-1]ping 192.168.1.2 <能ping通代表正常>

步驟4:配置診斷輸出,修改錯誤的RIP,看顯示的是什么情況<以R2為示列>

(1)、顯示終端監控
<R2>terminal monitor
The current terminal is enabled to display logs.
(2)、輸出終端debug
<R2>terminal debugging
The current terminal is enabled to display debugging logs.
(3)、查看R2上的rip 1 進程包的發送和接收情況
<R2>debugging rip 1 packet

<R2>debugging rip 1 packet
<R2>*Jun 18 18:47:32:011 2019 R2 RIP/7/RIPDEBUG: RIP 1 : Receiving response from 172.16.1.2 on GigabitEthernet0/1 # 到172.16.1.2地址的0/1接口RIP接收情況
*Jun 18 18:47:32:011 2019 R2 RIP/7/RIPDEBUG:   Packet: version 1, cmd response, length 84
*Jun 18 18:47:32:011 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.2.0, cost 1
*Jun 18 18:47:32:011 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.3.0, cost 1
*Jun 18 18:47:32:011 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.4.0, cost 2
*Jun 18 18:47:32:011 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 192.168.1.0, cost 2
*Jun 18 18:47:39:154 2019 R2 RIP/7/RIPDEBUG: RIP 1 : Receiving response from 172.16.0.1 on GigabitEthernet0/0 # 到172.16.0.1地址的0/0接口RIP發送情況
*Jun 18 18:47:39:154 2019 R2 RIP/7/RIPDEBUG:   Packet: version 1, cmd response, length 64
*Jun 18 18:47:39:154 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.4.0, cost 2
*Jun 18 18:47:39:154 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.5.0, cost 1
*Jun 18 18:47:39:154 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 192.168.0.0, cost 1
*Jun 18 18:47:40:318 2019 R2 RIP/7/RIPDEBUG: RIP 1 : Sending response on interface GigabitEthernet0/0 from 172.16.0.2 to 255.255.255.255
*Jun 18 18:47:40:318 2019 R2 RIP/7/RIPDEBUG:   Packet: version 1, cmd response, length 84
*Jun 18 18:47:40:318 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.1.0, cost 1
*Jun 18 18:47:40:318 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.2.0, cost 2
*Jun 18 18:47:40:318 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.3.0, cost 2
*Jun 18 18:47:40:318 2019 R2 RIP/7/RIPDEBUG: AFI 2, destination 192.168.1.0, cost 3 # 未刪除network 192.168.1.0
*Jun 18 18:47:40:318 2019 R2 RIP/7/RIPDEBUG: RIP 1 : Sending response on interface GigabitEthernet0/1 from 172.16.1.1 to 255.255.255.255
*Jun 18 18:47:40:318 2019 R2 RIP/7/RIPDEBUG:   Packet: version 1, cmd response, length 64
*Jun 18 18:47:40:318 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.0.0, cost 1
*Jun 18 18:47:40:318 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.5.0, cost 2
*Jun 18 18:47:40:318 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 192.168.0.0, cost 2

 

(4)、把R6上面的network 192.168.1.0 網段刪除,看R2上面是否有什么變化

①:刪除R6上面的192.168.1.0網段的network 

[R6] system-view
[R6] rip 1
[R6-rip-1]display this 
#
rip 1
network 172.16.0.0
network 192.168.1.0
#
return
[R6-rip-1]no network 192.168.1.0 [刪除192.168.1.0網段的network]
[R6-rip-1]display this 
#
rip 1
network 172.16.0.0
#
return

②、查看R2上面有什么變化

<R2>terminal monitor
The current terminal is enabled to display logs.
<R2>terminal debugging
The current terminal is enabled to display debugging logs.
<R2>debugging rip 1 packet

<R2>debugging rip 1 packet
*Jun 18 18:57:13:548 2019 R2 RIP/7/RIPDEBUG: RIP 1 : Receiving response from 172.16.1.2 on GigabitEthernet0/1
*Jun 18 18:57:13:548 2019 R2 RIP/7/RIPDEBUG:   Packet: version 1, cmd response, length 84
*Jun 18 18:57:13:548 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.2.0, cost 1
*Jun 18 18:57:13:548 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.3.0, cost 1
*Jun 18 18:57:13:548 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.4.0, cost 2
*Jun 18 18:57:13:548 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 192.168.1.0, cost 16
<R2>terminal m*Jun 18 18:56:59:317 2019 R2 RIP/7/RIPDEBUG: RIP 1 : Sending response on interface GigabitEthernet0/0 from 172.16.0.2 to 255.255.255.255
*Jun 18 18:56:59:317 2019 R2 RIP/7/RIPDEBUG:   Packet: version 1, cmd response, length 84
*Jun 18 18:56:59:317 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.1.0, cost 1
*Jun 18 18:56:59:317 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.2.0, cost 2
*Jun 18 18:56:59:317 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.3.0, cost 2
*Jun 18 18:56:59:317 2019 R2 RIP/7/RIPDEBUG:  AFI 2, destination 192.168.1.0, cost 16 # 刪除network 192.168.1.0就直接變為16,在過段時間就從路由器上面自動刪除了
*Jun 18 18:56:59:317 2019 R2 RIP/7/RIPDEBUG: RIP 1 : Sending response on interface GigabitEthernet0/1 from 172.16.1.1 to 255.255.255.255
*Jun 18 18:56:59:317 2019 R2 RIP/7/RIPDEBUG:   Packet: version 1, cmd response, length 64
*Jun 18 18:56:59:317 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.0.0, cost 1
*Jun 18 18:56:59:317 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.5.0, cost 2
*Jun 18 18:56:59:317 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 192.168.0.0, cost 2
*Jun 18 18:57:13:760 2019 R2 RIP/7/RIPDEBUG: RIP 1 : Receiving response from 172.16.0.1 on GigabitEthernet0/0
*Jun 18 18:57:13:760 2019 R2 RIP/7/RIPDEBUG:   Packet: version 1, cmd response, length 64
*Jun 18 18:57:13:760 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.4.0, cost 2
*Jun 18 18:57:13:760 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 172.16.5.0, cost 1 
*Jun 18 18:57:13:760 2019 R2 RIP/7/RIPDEBUG:     AFI 2, destination 192.168.0.0, cost 1

③、恢復R6的network

[R6] system-view

[R6] rip 1
[R6-rip-1]network 192.168.1.0
[R6-rip-1]display this 
#
rip 1
network 172.16.0.0
network 192.168.1.0
#
return

步驟5、配置路由器接口不發送RIP路由更新

第一步:開啟監控模式,監控R1上0/0接口單一的監控
<R1>terminal monitor 
The current terminal is enabled to display logs.
<R1>terminal debugging 
The current terminal is enabled to display debugging logs.
<R1>debugging rip 1 packet interface GigabitEthernet 0/0    

第二步:關閉R1路由器0/0接口發送rip協議更新
方法一:在rip 1 進程上面進行關閉
[R1]rip 1
[R1-rip-1]silent-interface GigabitEthernet 0/0   [想要開啟的話,在前面直接加一個no就好了]
方法二:進入0/0接口,在接口上設置關閉rip發送功能
[R1]interface GigabitEthernet 0/0
[R1-GigabitEthernet0/0]rip
[R1-GigabitEthernet0/0]no rip output  [不知道命令的話,可以使用rip ?查看幫助手冊]
第三步:關閉監控模式
<R1>no debugging all

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM