理論+實操:華爲動態路由協議,rip

一:前言:

1.1 rip協議概述

1.1.1 按照路由執行的算法分類

1.距離矢量路由協議

  • 依據從源網絡到目標網絡所經過的路由器的個數選擇路由
    ●RIP、 IGRP
2.鏈路狀態路由協議
  • 綜合考慮從源網絡到目標網絡的各條路徑的情況選擇路由
    ●OSPF、IS-IS

1.2 rip路由協議工作原理

1.2.1 rip是距離——矢量路由選擇協議

1.2.2 rip的基本概念

  • 定期更新 (路由器每經過一-段時間週期-30S後, 向鄰居發送更新信息)
  • 鄰居(與其相連的路由器)
  • 廣播更新(Ripv1 255.255.255.255)
  • 組播更新 (Ripv2 224.0.0.9)
  • 泛洪路由表(路由器將從鄰居學習到的路由放進自己的路由表中,然後將路由表所有路由信息在通告給其他路由器,直到整個網絡學習到)

1.2.3 RIP度量值爲跳數

  • 最大跳數爲15跳,16跳爲不可達

1.2.4 RIP更新時間

  • 每隔30s發送路由更新消息,UDP520端口

1.2.5 RIP路由更新消息

  • 發送整個路由表信息(除了從接收端接收到的路由條目外)

1.3 rip命令

理論+實操:華爲動態路由協議,rip

理論+實操:華爲動態路由協議,rip

理論+實操:華爲動態路由協議,rip

二:實驗

2.1 實驗測試兼容模式————即不宣告rip版本

理論+實操:華爲動態路由協議,rip

2.1.1 AR2配置

The device is running!
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname AR2
[AR2-GigabitEthernet0/0/0]int lo 0
[AR2-LoopBack0]ip add 192.168.200.1 30
[AR2-LoopBack0]int g 0/0/0
[AR2-GigabitEthernet0/0/0]ip add 12.0.0.2 30
[AR2-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[AR2-GigabitEthernet0/0/0]q
[AR2]rip 1
[AR2-rip-1]network 192.168.200.0
[AR2-rip-1]network 12.0.0.0
[AR2-rip-1]q
[AR2]

2.1.2 AR1 配置

The device is running!
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname AR1
[AR1]int g0/0/0
[AR1-GigabitEthernet0/0/0]ip add 12.0.0.1 30
[AR1-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[AR1-GigabitEthernet0/0/0]int lo 0
[AR1-LoopBack0]ip add 192.168.100.1 24
[AR1-LoopBack0]q
[AR1]rip 1
[AR1-rip-1]network 192.168.100.0
[AR1-rip-1]network 12.0.0.0
[AR1-rip-1]

2.1.3 查看路由表

[AR1]dis ip routing
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 11       Routes : 11       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       12.0.0.0/30  Direct  0    0           D   12.0.0.1        GigabitEthernet
0/0/0
       12.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       12.0.0.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
  192.168.100.0/24  Direct  0    0           D   192.168.100.1   LoopBack0
  192.168.100.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
192.168.100.255/32  Direct  0    0           D   127.0.0.1       LoopBack0
  192.168.200.0/24  RIP     100  1           D   12.0.0.2        GigabitEthernet
0/0/0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
[AR2]dis ip routing
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 11       Routes : 11       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       12.0.0.0/30  Direct  0    0           D   12.0.0.2        GigabitEthernet
0/0/0
       12.0.0.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       12.0.0.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
  192.168.100.0/24  RIP     100  1           D   12.0.0.1        GigabitEthernet
0/0/0
  192.168.200.0/30  Direct  0    0           D   192.168.200.1   LoopBack0
  192.168.200.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
  192.168.200.3/32  Direct  0    0           D   127.0.0.1       LoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

抓包查看,不設置版本的兼容模式,默認發送的是rip v1 版本,以廣播的形式接收
理論+實操:華爲動態路由協議,rip

2.2 實驗測試兼容模式中在接口配置命令去發送rip v2 信息,或者在rip v2 的路由中設置接收rip v1 數據

理論+實操:華爲動態路由協議,rip

備註:rip協議中,通過UDP520端口發送的路由條目信息,最大支持25條路由條目

2.2.1 設置接口IP

AR1:

The device is running!
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname AR1
[AR1]int lo 0
[AR1-LoopBack0]ip add 1.1.1.1 24
[AR1-LoopBack0]int g 0/0/0
[AR1-GigabitEthernet0/0/0]ip add 12.0.0.1 30
[AR1-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[AR1-GigabitEthernet0/0/0]

AR2:

The device is running!
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname AR2
[AR2]int lo 0
[AR2-LoopBack0]ip add 2.2.2.2 24
[AR2-LoopBack0]int g 0/0/0
[AR2-GigabitEthernet0/0/0]ip add 12.0.0.2 30
[AR2-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[AR2-GigabitEthernet0/0/0]int g 0/0/1
[AR2-GigabitEthernet0/0/1]ip add 23.0.0.1 30
[AR2-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[AR2-GigabitEthernet0/0/1]

AR3:

The device is running!
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname AR3
[AR3]int lo 0
[AR3-LoopBack0]ip add 3.3.3.3 24
[AR3-LoopBack0]int g 0/0/1
[AR3-GigabitEthernet0/0/1]ip add 23.0.0.2 30
[AR3-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[AR3-GigabitEthernet0/0/1]

2.2.2 開始設置RIP

AR1:

[AR1-GigabitEthernet0/0/0]q
[AR1]rip 1  
[AR1-rip-1]?
rip-1 interface view commands:
  arp-ping          ARP-ping
  backup            Backup  information
  bfd               Bidirectional Forwarding Detection
  checkzero         Perform the checkzero operation in the zero fields of RIP   
                    packets
  clear             Clear
  default-cost      Specify default metric for imported routes
  default-route     Enable advertisement of default routes
  description       Specify the process description
  dialer            Dialer
  display           Display information
  filter-policy     Specify route filtering policy
  graceful-restart  Graceful restart information
  host-route        Enable sending and receiving host routes
  import-route      Import routes from other protocols into RIP
  maximum           Set the maximum number of equal-cost multipaths
  mtrace            Trace route to multicast source
  network           Enable the routing protocol on the related network or       
                    interface
  peer              Specify a peer router
  ping              <Group> ping command group
  preference        Specify RIP route preference
  quit              Exit from current mode and enter prior mode
  reset             <Group> reset command group
  return            Enter the privileged mode
  silent-interface  Suppress RIP packets from being sent on the specified       
                    interface
  summary           Enable route summarization
  test-aaa          Accounts test
  timers            Adjust the protocol timers
  tracert           <Group> tracert command group
  undo              Negate a command or set its defaults
  verify-source     Validate the source IP address of received RIP updates
  version           Specify RIP version
[AR1-rip-1]version 1
[AR1-rip-1]network 1.1.1.0
Error: The network address is invalid, and the specified address must be major-n
et address without any subnets.
[AR1-rip-1]network 1.0.0.0
[AR1-rip-1]network 12.0.0.0
[AR1-rip-1]undo summary 

AR2:

[AR2-GigabitEthernet0/0/1]q
[AR2]rip 1
[AR2-rip-1]network 2.0.0.0
[AR2-rip-1]network 12.0.0.0
[AR2-rip-1]network 23.0.0.0
[AR2-rip-1]
[AR2-rip-1]un summary 

AR3:

[AR3-GigabitEthernet0/0/1]q
[AR3]rip 1
[AR3-rip-1]version 2
[AR3-rip-1]network 23.0.0.0 30
                            ^
Error:Too many parameters found at '^' position.
[AR3-rip-1]network 23.0.0.0
[AR3-rip-1]network 3.3.3.0
Error: The network address is invalid, and the specified address must be major-n
et address without any subnets.
[AR3-rip-1]network 3.3.3.0 24
                           ^
Error:Too many parameters found at '^' position.
[AR3-rip-1]network 3.0.0.0
[AR3-rip-1]undo summary 
[AR3-rip-1]

2.2.3 抓包AR1的g0/0/0瞅一眼

理論+實操:華爲動態路由協議,rip

理論+實操:華爲動態路由協議,rip

2.2.4 再抓一個AR3的g0/0/1

理論+實操:華爲動態路由協議,rip

理論+實操:華爲動態路由協議,rip

2.2.5 小結:可以發現rip v1 不支持子網劃分,網段沒有經過劃分;rip v2 支持子網劃分,宣告出來的網段經過子網劃分

2.2.6 這時候看一下各個路由的路由表

AR1:

[AR1]dis ip routing-table 

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.0/24  Direct  0    0           D   1.1.1.1         LoopBack0
        1.1.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
      1.1.1.255/32  Direct  0    0           D   127.0.0.1       LoopBack0
        2.0.0.0/8   RIP     100  1           D   12.0.0.2        GigabitEthernet
0/0/0
        3.0.0.0/8   RIP     100  2           D   12.0.0.2        GigabitEthernet
0/0/0
       12.0.0.0/30  Direct  0    0           D   12.0.0.1        GigabitEthernet
0/0/0
       12.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       12.0.0.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       23.0.0.0/8   RIP     100  1           D   12.0.0.2        GigabitEthernet
0/0/0
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

AR2:

[AR2]dis ip routing
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 15       Routes : 15       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.0.0.0/8   RIP     100  1           D   12.0.0.1        GigabitEthernet
0/0/0
        2.2.2.0/24  Direct  0    0           D   2.2.2.2         LoopBack0
        2.2.2.2/32  Direct  0    0           D   127.0.0.1       LoopBack0
      2.2.2.255/32  Direct  0    0           D   127.0.0.1       LoopBack0
        3.3.3.0/24  RIP     100  1           D   23.0.0.2        GigabitEthernet
0/0/1
       12.0.0.0/30  Direct  0    0           D   12.0.0.2        GigabitEthernet
0/0/0
       12.0.0.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       12.0.0.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       23.0.0.0/30  Direct  0    0           D   23.0.0.1        GigabitEthernet
0/0/1
       23.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
       23.0.0.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

AR3:

[AR3]dis ip routing
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 10       Routes : 10       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        3.3.3.0/24  Direct  0    0           D   3.3.3.3         LoopBack0
        3.3.3.3/32  Direct  0    0           D   127.0.0.1       LoopBack0
      3.3.3.255/32  Direct  0    0           D   127.0.0.1       LoopBack0
       23.0.0.0/30  Direct  0    0           D   23.0.0.2        GigabitEthernet
0/0/1
       23.0.0.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
       23.0.0.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

2.2.7 在路由表中,兼容模式路由接收到的3.3.3.0路由條目轉發給rip v1,路由條目變爲3.0.0.0,證明rip v1不支持子網劃分

2.2.8 當前rip v2 中沒有獲得新的路由條目,,因爲兼容模式可以收rip v1和rip v2路由信息,但發只能是rip v1路由信息

2.2.9 需要解決這個問題

兩種方法:

第一種、進入R3的接收接口
int g0/0/1
rip version 1
第二種、進入R2的發送接口(發送給vip v2路由的接口)
int g 0/0/1
rip version 2 multicast

這裏實驗第二種方法,然後查看抓包數據

是不是發生改變,然後再看路由表

[AR2]int g 0/0/1
[AR2-GigabitEthernet0/0/1]rip version 2 multicast 

rip版本發生改變

理論+實操:華爲動態路由協議,rip

AR3路由表,路由信息同步

[AR3]dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 13       Routes : 13       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.0.0.0/8   RIP     100  2           D   23.0.0.1        GigabitEthernet
0/0/1
        2.2.2.0/24  RIP     100  1           D   23.0.0.1        GigabitEthernet
0/0/1
        3.3.3.0/24  Direct  0    0           D   3.3.3.3         LoopBack0
        3.3.3.3/32  Direct  0    0           D   127.0.0.1       LoopBack0
      3.3.3.255/32  Direct  0    0           D   127.0.0.1       LoopBack0
       12.0.0.0/30  RIP     100  1           D   23.0.0.1        GigabitEthernet
0/0/1
       23.0.0.0/30  Direct  0    0           D   23.0.0.2        GigabitEthernet
0/0/1
       23.0.0.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
       23.0.0.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章