动态路由协议 RIP

 

RIP【Routing Information Protocol】路由信息协议,它是一种基于矢量(Distance-Vector)算法的协议,使用跳数作为度量来衡量到达目的网络的距离,RIP主要应用于规模较小的网络中,缺点:古老、收敛速度很慢
运行原理如下:

 

  • 路由器每 30秒会与相邻的路由器交换路由表数据包,以动态的建立路由表,如果240秒没有收到对方消息,就将对方的路由表从自身删除
  • RIP只看距离远近,距离是以跳数(经过路由器的个数)来衡量
  • RIP 允许最大的hop数(跳数)为15----->多于15跳不可达
  • 路由协议如下:


网络拓扑图如下:运用 RIP 动态路由协议来实现所有PC网络互相通信(如想要禁止某网段访问可直接在RIP中不进行宣告即可

实现方法如下:

R1 配置命令:

<Huawei>system-view
[Huawei]sysname R1
[R1]undo info-center enable
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 1.1.1.1 24    #g0/0/0配置IP
[R1-GigabitEthernet0/0/0]quit
[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1]ip address 10.10.10.1 24    #g0/0/1配置IP
[R1]rip    #进入RIP
[R1-rip-1]version 2    #版本为V2
[R1-rip-1]undo summary    #关闭汇总
[R1-rip-1]network 10.0.0.0    #宣告网段,区分ABC类地址默认掩码,A类为 X.0.0.0     B类 X.X.0.0    C类 X.X.X.0
[R1-rip-1]network 1.0.0.0    #宣告网段,区分ABC类地址默认掩码,A类为 X.0.0.0     B类 X.X.0.0    C类 X.X.X.0
[R1-rip-1]silent-interface GigabitEthernet 0/0/1    #开启静默端口G0/0/1,防止RIP包对计算机进行组播
  • 查看路由表:display ip routing-table


R2 配置命令:

<Huawei>system-view
[Huawei]sysname R2
[R2]undo info-center enable
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ip address 1.1.1.2 24
[R2-GigabitEthernet0/0/0]quit
[R2]interface Ethernet0/0/0
[R2-Ethernet0/0/0]port link-type access
[R2-Ethernet0/0/0]vlan 10
[R2-vlan10]port Ethernet 0/0/0
[R2-vlan10]quit
[R2]interface vlanif 10
[R2-Vlanif10]ip address 20.20.20.1 24
[R2-Vlanif10]quit
[R2]interface GigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1]ip address 172.16.20.1 24
[R2-GigabitEthernet0/0/1]quit
[R2]rip    #进入RIP
[R2-rip-1]version 2    #版本V2
[R2-rip-1]undo summary    #关闭汇总
[R2-rip-1]network 1.0.0.0    #宣告自己网段地址
[R2-rip-1]network 20.0.0.0    #宣告自己网段地址
[R2-rip-1]network 172.16.0.0    #宣告自己网段地址
[R2-rip-1]silent-interface Ethernet 0/0/0    #静默端口E0/0/0
  • 查看路由表:display ip routing-table


 R3 配置命令:

<Huawei>system-view
[Huawei]sysname R3
[R3]undo info-center enable
[R3]interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ip address 172.16.20.2 24
[R3-GigabitEthernet0/0/0]quit
[R3]vlan 10
[R3-vlan10]quit
[R3]interface Ethernet0/0/0
[R3-Ethernet0/0/0]port link-type  access
[R3-Ethernet0/0/0]port default vlan 10
[R3-Ethernet0/0/0]quit
[R3]interface vlanif 10
[R3-Vlanif10]ip address 30.30.30.1 24
[R3-Vlanif10]quit
[R3]interface GigabitEthernet 0/0/1
[R3-GigabitEthernet0/0/1]ip address 192.168.1.1 24
[R3-GigabitEthernet0/0/1]quit
[R3]rip
[R3-rip-1]version 2    #版本V2
[R3-rip-1]undo summary    #关闭汇总
[R3-rip-1]network 172.16.0.0    #宣告网段
[R3-rip-1]network 30.0.0.0    #宣告网段
[R3-rip-1]network 192.168.1.0    #宣告网段
[R3-rip-1]silent-interface Ethernet 0/0/0    #静默端口E0/0/0
  • 查看路由表:display ip routing-table


 R4 配置命令:

<Huawei>system-view
[Huawei]sysname R4
[R4]undo info-center enable
[R4]interface GigabitEthernet 0/0/0
[R4-GigabitEthernet0/0/0]ip address 192.168.1.2 24
[R4-GigabitEthernet0/0/0]quit
[R4]interface GigabitEthernet 0/0/1
[R4-GigabitEthernet0/0/1]ip address 40.40.40.1 24
[R4-GigabitEthernet0/0/1]quit
[R4]rip    #进入RIP
[R4-rip-1]version 2    #版本V2
[R4-rip-1]undo summary    #关闭汇总
[R4-rip-1]network 192.168.1.0    #宣告地址
[R4-rip-1]network 40.0.0.0    #宣告地址
[R4-rip-1]silent-interface GigabitEthernet 0/0/1    #静默端口G0/0/1
  • 查看路由表:display ip routing-table

 

 

 

posted @ 2021-02-02 19:37  凡是過往;皆為序章  阅读(459)  评论(0编辑  收藏  举报